From acd63979b7e9ecc097eebe9ea1f2068babb45a1d Mon Sep 17 00:00:00 2001 From: emb <> Date: Wed, 11 Nov 2015 22:57:56 -0600 Subject: [PATCH] Adding misted LuaDisplay.cpp --- RetroFE/Source/Lua/LuaDisplay.cpp | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 RetroFE/Source/Lua/LuaDisplay.cpp diff --git a/RetroFE/Source/Lua/LuaDisplay.cpp b/RetroFE/Source/Lua/LuaDisplay.cpp new file mode 100644 index 0000000..aae1435 --- /dev/null +++ b/RetroFE/Source/Lua/LuaDisplay.cpp @@ -0,0 +1,59 @@ +#include "LuaDisplay.h" +#include "../SDL.h" + +int LuaDisplay::getDimensions(lua_State *l) +{ + int h = SDL::getWindowHeight(); + int w = SDL::getWindowWidth(); + + lua_pushnumber(l, w); + lua_pushnumber(l, h); + + return 2; +} + + +int LuaDisplay::getWidth(lua_State *l) +{ + int w = SDL::getWindowWidth(); + + lua_pushnumber(l, w); + + return 1; +} + + +int LuaDisplay::getHeight(lua_State *l) +{ + int h = SDL::getWindowHeight(); + + lua_pushnumber(l, h); + + return 1; +} + + +int LuaDisplay::getCenter(lua_State *l) +{ + int h = SDL::getWindowHeight(); + int w = SDL::getWindowWidth(); + + lua_pushnumber(l, w); + lua_pushnumber(l, h); + + lua_pushnumber(l, w/2); + lua_pushnumber(l, h/2); + + return 2; +} + + +int LuaDisplay::isFullscreen(lua_State *l) +{ + + bool fullscreen = SDL::isFullscreen(); + + lua_pushnumber(l, fullscreen); + + return 1; +}