From a8b9dcbf1782fcfa6fbc4dd0fad370dc2ac59df3 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 6 Jun 2012 22:01:49 -0300 Subject: [PATCH] bind new system information functions --- src/framework/CMakeLists.txt | 4 ---- src/framework/application.h | 2 ++ src/framework/graphics/graphics.h | 5 +++++ src/framework/luafunctions.cpp | 6 ++++++ src/framework/platform/win32window.cpp | 1 - 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 9c3d47a2..43fcb1ce 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -21,10 +21,6 @@ SET(CXX_WARNS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-v SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARNS} -std=gnu++0x -pipe") SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -ggdb") - -# -ffast-math => has historical behaviour that may cause the app to work incorrectly or crash -# -msse -msse2 -mfpmath=sse => I have experienced crashs with these optimizations on some windows machines -#SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -msse -msse2 -mfpmath=sse") SET(CMAKE_CXX_FLAGS_RELEASE "-O3") SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -static-libgcc -static-libstdc++ -Wl,--as-needed") diff --git a/src/framework/application.h b/src/framework/application.h index d66c1575..d04a0746 100644 --- a/src/framework/application.h +++ b/src/framework/application.h @@ -59,6 +59,8 @@ public: int getForegroundPaneFps() { return m_foregroundFrameCounter.getLastFps(); } int getBackgroundPaneFps() { return m_backgroundFrameCounter.getLastFps(); } + int getForegroundPaneMaxFps() { return m_foregroundFrameCounter.getMaxFps(); } + int getBackgroundPaneMaxFps() { return m_backgroundFrameCounter.getMaxFps(); } std::string getBuildCompiler() { return BUILD_COMPILER; } std::string getBuildDate() { return BUILD_DATE; } std::string getBuildRevision() { return BUILD_REVISION; } diff --git a/src/framework/graphics/graphics.h b/src/framework/graphics/graphics.h index 002dd1f6..ab81df21 100644 --- a/src/framework/graphics/graphics.h +++ b/src/framework/graphics/graphics.h @@ -55,6 +55,11 @@ public: const Size& getViewportSize() { return m_viewportSize; } TexturePtr& getEmptyTexture() { return m_emptyTexture; } + std::string getVendor() { return (const char*)glGetString(GL_VENDOR); } + std::string getRenderer() { return (const char*)glGetString(GL_RENDERER); } + std::string getVersion() { return (const char*)glGetString(GL_VERSION); } + std::string getExtensions() { return (const char*)glGetString(GL_EXTENSIONS); } + bool canUseDrawArrays(); bool canUseShaders(); bool canUseFBO(); diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index c2d95310..1293e6cb 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -477,6 +477,8 @@ void Application::registerLuaFunctions() g_lua.bindClassStaticFunction("g_app", "getVersion", std::bind(&Application::getVersion, g_app)); g_lua.bindClassStaticFunction("g_app", "getForegroundPaneFps", std::bind(&Application::getForegroundPaneFps, g_app)); g_lua.bindClassStaticFunction("g_app", "getBackgroundPaneFps", std::bind(&Application::getBackgroundPaneFps, g_app)); + g_lua.bindClassStaticFunction("g_app", "getForegroundPaneMaxFps", std::bind(&Application::getForegroundPaneMaxFps, g_app)); + g_lua.bindClassStaticFunction("g_app", "getBackgroundPaneMaxFps", std::bind(&Application::getBackgroundPaneMaxFps, g_app)); g_lua.bindClassStaticFunction("g_app", "getBuildCompiler", std::bind(&Application::getBuildCompiler, g_app)); g_lua.bindClassStaticFunction("g_app", "getBuildDate", std::bind(&Application::getBuildDate, g_app)); g_lua.bindClassStaticFunction("g_app", "getBuildRevision", std::bind(&Application::getBuildRevision, g_app)); @@ -548,6 +550,10 @@ void Application::registerLuaFunctions() g_lua.bindClassStaticFunction("g_graphics", "isPainterEngineAvailable", std::bind(&Graphics::isPainterEngineAvailable, &g_graphics, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_graphics", "selectPainterEngine", std::bind(&Graphics::selectPainterEngine, &g_graphics, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_graphics", "getPainterEngine", std::bind(&Graphics::getPainterEngine, &g_graphics)); + g_lua.bindClassStaticFunction("g_graphics", "getViewportSize", std::bind(&Graphics::getViewportSize, &g_graphics)); + g_lua.bindClassStaticFunction("g_graphics", "getVendor", std::bind(&Graphics::getVendor, &g_graphics)); + g_lua.bindClassStaticFunction("g_graphics", "getRenderer", std::bind(&Graphics::getRenderer, &g_graphics)); + g_lua.bindClassStaticFunction("g_graphics", "getVersion", std::bind(&Graphics::getVersion, &g_graphics)); // Logger g_lua.registerStaticClass("g_logger"); diff --git a/src/framework/platform/win32window.cpp b/src/framework/platform/win32window.cpp index 1e8c83d9..af8eb458 100644 --- a/src/framework/platform/win32window.cpp +++ b/src/framework/platform/win32window.cpp @@ -857,4 +857,3 @@ std::string WIN32Window::getPlatformType() { return "WIN32-WGL"; } -