adding text surfaces to m_texts, switched floats to Uint8's for SDL_Color
git-svn-id: svn://anubis/anaglym/trunk@157 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
4831fd7658
commit
01c65d68dd
12
Engine.cc
12
Engine.cc
@ -79,6 +79,7 @@ Engine::Engine(const string & path, Video & video)
|
||||
: m_video(video)
|
||||
{
|
||||
m_next_object_index = 1;
|
||||
m_next_text_index = 1;
|
||||
m_eye[0] = 0;
|
||||
m_eye[1] = -1;
|
||||
m_eye[2] = 0;
|
||||
@ -462,8 +463,8 @@ void Engine::debug_hook(lua_Debug * debug)
|
||||
}
|
||||
}
|
||||
|
||||
int Engine::renderText(const char * text, int mode, float r, float g, float b,
|
||||
float br, float bg, float bb)
|
||||
int Engine::renderText(const char * text, int mode, Uint8 r, Uint8 g, Uint8 b,
|
||||
Uint8 br, Uint8 bg, Uint8 bb)
|
||||
{
|
||||
SDL_Surface * surf = NULL;
|
||||
SDL_Color color = {r, g, b};
|
||||
@ -480,6 +481,13 @@ int Engine::renderText(const char * text, int mode, float r, float g, float b,
|
||||
surf = TTF_RenderText_Blended(m_font, text, color);
|
||||
break;
|
||||
}
|
||||
if (surf != NULL)
|
||||
{
|
||||
int id = m_next_text_index++;
|
||||
m_texts[id] = surf;
|
||||
return id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* called by SDL when the update timer expires */
|
||||
|
7
Engine.h
7
Engine.h
@ -135,8 +135,8 @@ class Engine
|
||||
bool import(const char * name);
|
||||
GLuint loadTexture(const char * name);
|
||||
void debug_hook(lua_Debug * debug);
|
||||
int renderText(const char * text, int mode, float r, float g, float b,
|
||||
float br = 0.0, float bg = 0.0, float bb = 0.0);
|
||||
int renderText(const char * text, int mode, Uint8 r, Uint8 g, Uint8 b,
|
||||
Uint8 br = 0, Uint8 bg = 0, Uint8 bb = 0);
|
||||
|
||||
/* lua services */
|
||||
int setCamera(lua_State * L);
|
||||
@ -169,8 +169,9 @@ class Engine
|
||||
std::string m_engine_path;
|
||||
OdeWorld m_world;
|
||||
std::map<int, Object *> m_objects;
|
||||
std::map<int, SDL_Surface *> m_texts;
|
||||
int m_next_object_index;
|
||||
std::map<int, SDL_Surface *> m_texts;
|
||||
int m_next_text_index;
|
||||
GLdouble m_eye[3];
|
||||
GLdouble m_center[3];
|
||||
GLdouble m_up[3];
|
||||
|
Loading…
x
Reference in New Issue
Block a user