added getScreenSize()
git-svn-id: svn://anubis/anaglym/trunk@159 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
f7f6c83795
commit
3f429be13b
@ -496,6 +496,12 @@ int Engine::renderText(const char * text, int mode, Uint8 r, Uint8 g, Uint8 b,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Engine::getScreenSize(int * width, int * height)
|
||||
{
|
||||
*width = m_video.getWidth();
|
||||
*height = m_video.getHeight();
|
||||
}
|
||||
|
||||
/* called by SDL when the update timer expires */
|
||||
Uint32 Engine::updateCallback(Uint32 interval, void * param)
|
||||
{
|
||||
|
1
Engine.h
1
Engine.h
@ -137,6 +137,7 @@ class Engine
|
||||
void debug_hook(lua_Debug * debug);
|
||||
int renderText(const char * text, int mode, Uint8 r, Uint8 g, Uint8 b,
|
||||
Uint8 br = 0, Uint8 bg = 0, Uint8 bb = 0);
|
||||
void getScreenSize(int * width, int * height);
|
||||
|
||||
/* lua services */
|
||||
int setCamera(lua_State * L);
|
||||
|
4
Video.cc
4
Video.cc
@ -29,6 +29,8 @@ Video::Video()
|
||||
|
||||
m_surface = NULL;
|
||||
m_inputGrabbed = false;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
}
|
||||
|
||||
void Video::start(int width, int height, bool fullscreen, bool grab_input,
|
||||
@ -58,6 +60,8 @@ void Video::start(int width, int height, bool fullscreen, bool grab_input,
|
||||
}
|
||||
m_inputGrabbed = grab_input;
|
||||
m_fullscreen = fullscreen;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
|
4
Video.h
4
Video.h
@ -15,10 +15,14 @@ class Video
|
||||
int getDefaultWidth() { return m_defaultWidth; }
|
||||
int getDefaultHeight() { return m_defaultHeight; }
|
||||
void toggleFullScreen() { SDL_WM_ToggleFullScreen(m_surface); }
|
||||
int getWidth() { return m_width; }
|
||||
int getHeight() { return m_height; }
|
||||
|
||||
protected:
|
||||
int m_defaultWidth;
|
||||
int m_defaultHeight;
|
||||
int m_width;
|
||||
int m_height;
|
||||
SDL_Surface * m_surface;
|
||||
bool m_fullscreen;
|
||||
bool m_inputGrabbed;
|
||||
|
10
ag.cc
10
ag.cc
@ -43,6 +43,7 @@ namespace ag
|
||||
{ "exit", exit },
|
||||
{ "import", import },
|
||||
{ "loadTexture", loadTexture },
|
||||
{ "getScreenSize", getScreenSize },
|
||||
|
||||
{ "createBox", createBox},
|
||||
{ "createStaticBox", createStaticBox},
|
||||
@ -337,6 +338,15 @@ namespace ag
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getScreenSize(lua_State * L)
|
||||
{
|
||||
int width, height;
|
||||
g_engine->getScreenSize(&width, &height);
|
||||
lua_pushinteger(L, width);
|
||||
lua_pushinteger(L, height);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static void addManagedObject(lua_State * L, bool is_static,
|
||||
OdeWorld::GeomType geom_type, refptr< vector<float> > args)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user