blender/source/gameengine/Ketsji/KX_FontObject.h
Dalai Felinto c52f780021 cucumber merge, multiline font object:
revisions: 38384,38387,38403,38404,38407,42997,42998

#42998 by dfelinto
BGE Font Object - fix for offset
(scaling also has to be taken into account here)

#42997 by dfelinto
Font Object Multiline fix.
The offset was totally wrong when object had scale[1] != 1

#38407 by kupoman
Changing the "text" property of a KX_FontObject now changes the text. This allows for control of a FontObject through logic bricks.

#38404 by kupoman
KX_FontObject now supports the x and y offset options.

#38403 by kupoman
KX_FontObject now makes use of the font's line spacing option, and correctly accounts for rotation and font size when applying the spacing.

#38387 by kupoman
The KX_FontObject text attribute is working again.

#38384 by kupoman
Primitive support for the new line character added to KX_FontObjects. The line spacing is fixed, and does not work when the FontObject is rotated. Also, the text attribute has been temporarily disabled, as it needs some updating to support the multiline changes.
2011-12-30 12:28:51 +00:00

88 lines
2.3 KiB
C++

/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file KX_FontObject.h
* \ingroup ketsji
*/
#ifndef __KX_FONTOBJECT
#define __KX_FONTOBJECT
#include "KX_GameObject.h"
#include "DNA_vfont_types.h"
#include "RAS_IRenderTools.h"
class KX_FontObject : public KX_GameObject
{
public:
Py_Header
KX_FontObject( void* sgReplicationInfo,
SG_Callbacks callbacks,
RAS_IRenderTools* rendertools,
Object *ob);
virtual ~KX_FontObject();
void DrawText();
/**
* Inherited from CValue -- return a new copy of this
* instance allocated on the heap. Ownership of the new
* object belongs with the caller.
*/
virtual CValue* GetReplica();
virtual void ProcessReplica();
protected:
std::vector<STR_String> m_text;
Object* m_object;
int m_fontid;
int m_dpi;
float m_fsize;
float m_resolution;
float m_color[4];
float m_line_spacing;
MT_Vector3 m_offset;
class RAS_IRenderTools* m_rendertools; //needed for drawing routine
/*
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_FontObject"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
#endif
*/
#ifdef WITH_PYTHON
static PyObject* pyattr_get_text(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_text(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
#endif
};
#endif //__KX_FONTOBJECT