added Engine::getTextSize()
git-svn-id: svn://anubis/anaglym/trunk@164 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
c478b44d28
commit
c26a3e7deb
@ -477,7 +477,7 @@ void Engine::getScreenSize(int * width, int * height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
|
void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
|
||||||
int ptsize, int x, int y)
|
int ptsize, float x, float y)
|
||||||
{
|
{
|
||||||
m_font->FaceSize(ptsize);
|
m_font->FaceSize(ptsize);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@ -488,6 +488,13 @@ void Engine::drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::getTextSize(const char * text, float * width, float * height)
|
||||||
|
{
|
||||||
|
FTBBox box = m_font->BBox(text);
|
||||||
|
*width = box.Upper().Xf() - box.Lower().Xf();
|
||||||
|
*height = box.Upper().Yf() - box.Lower().Yf();
|
||||||
|
}
|
||||||
|
|
||||||
/* called by SDL when the update timer expires */
|
/* called by SDL when the update timer expires */
|
||||||
Uint32 Engine::updateCallback(Uint32 interval, void * param)
|
Uint32 Engine::updateCallback(Uint32 interval, void * param)
|
||||||
{
|
{
|
||||||
|
3
Engine.h
3
Engine.h
@ -137,7 +137,8 @@ class Engine
|
|||||||
void debug_hook(lua_Debug * debug);
|
void debug_hook(lua_Debug * debug);
|
||||||
void getScreenSize(int * width, int * height);
|
void getScreenSize(int * width, int * height);
|
||||||
void drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
|
void drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
|
||||||
int ptsize, int x, int y);
|
int ptsize, float x, float y);
|
||||||
|
void getTextSize(const char * text, float * width, float * height);
|
||||||
|
|
||||||
/* lua services */
|
/* lua services */
|
||||||
int setCamera(lua_State * L);
|
int setCamera(lua_State * L);
|
||||||
|
@ -44,5 +44,5 @@ function mouse_moves(x, y, xrel, yrel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function update_overlay_event()
|
function update_overlay_event()
|
||||||
ag.drawText("Hi there everyone!", 1, 0.7, 0, 16, 40, 40)
|
ag.drawText("Hi there everyone!", 1, 0.7, 0, 16, 0, 0)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user