changes to prepare revgraphics

This commit is contained in:
Eduardo Bart 2011-12-01 17:38:46 -02:00
parent b1e1487745
commit 4afbe43e6f
12 changed files with 44 additions and 11508 deletions

View File

@ -8,22 +8,22 @@ OPTION(USE_PCH "Use precompiled header" ON)
OPTION(NO_CONSOLE "Disable console window on Windows" OFF)
OPTION(HANDLE_EXCEPTIONS "Generate crash reports" OFF)
OPTION(FORBIDDEN_FUNCTIONS "Enable forbidden lua functions" ON)
OPTION(USE_GLES "Use OpenGLES (for mobiles devices)" OFF)
OPTION(USE_OPENGLES2 "Use OpenGL ES 2.0 (for mobiles devices)" OFF)
# find needed packages
SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_MULTITHREADED OFF)
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
IF(USE_GLES)
FIND_PACKAGE(OpenGLES REQUIRED)
IF(USE_OPENGLES2)
FIND_PACKAGE(OpenGLES2 REQUIRED)
FIND_PACKAGE(EGL REQUIRED)
SET(OPENGL_INCLUDE_DIR ${OPENGLES_INCLUDE_DIR} ${EGL_INCLUDE_DIR})
SET(OPENGL_LIBRARIES ${OPENGLES_LIBRARY} ${EGL_LIBRARY})
ADD_DEFINITIONS(-DGLES -DEGL)
ELSE(USE_GLES)
ADD_DEFINITIONS(-DOPENGLES2)
ELSE(USE_OPENGLES2)
FIND_PACKAGE(OpenGL REQUIRED)
ENDIF(USE_GLES)
ENDIF(USE_OPENGLES2)
FIND_PACKAGE(Lua REQUIRED)
FIND_PACKAGE(PhysFS REQUIRED)
@ -44,7 +44,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-inline")
SET(CMAKE_CXX_LINK_FLAGS "-rdynamic -static-libgcc -static-libstdc++ -Wl,--as-needed")
SET(CMAKE_CXX_LINK_FLAGS "-static-libgcc -static-libstdc++ -Wl,--as-needed")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
@ -117,6 +117,7 @@ SET(SOURCES
src/framework/core/eventdispatcher.cpp
src/framework/core/modulemanager.cpp
src/framework/core/module.cpp
src/framework/core/engine.cpp
# framework graphics
src/framework/graphics/font.cpp
@ -190,7 +191,8 @@ IF(WIN32)
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
SET(SOURCES ${SOURCES} icon.o)
ELSE(WIN32)
SET(ADDITIONAL_LIBRARIES -lpthread)
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic")
SET(ADDITIONAL_LIBRARIES pthread)
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp)
ENDIF(WIN32)

10
cmake/FindOpenGLES2.cmake Normal file
View File

@ -0,0 +1,10 @@
# Try to find the OpenGLES librairy
# OPENGLES_FOUND - system has OpenGLES
# OPENGLES_INCLUDE_DIR - the OpenGLES include directory
# OPENGLES_LIBRARY - the OpenGLES library
FIND_PATH(OPENGLES_INCLUDE_DIR gl2.h PATH_SUFFIXES GLES2)
FIND_LIBRARY(OPENGLES_LIBRARY NAMES GLESv2)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGLES DEFAULT_MSG OPENGLES_LIBRARY OPENGLES_INCLUDE_DIR)
MARK_AS_ADVANCED(OPENGLES_LIBRARY OPENGLES_INCLUDE_DIR)

View File

@ -48,8 +48,7 @@ void Logger::log(Fw::LogLevel level, std::string message)
if(level == Fw::LogFatal) {
m_terminated = true;
g_platform.displayFatalError(message);
exit(-1);
throw std::runtime_error(message);
}
}

View File

@ -27,7 +27,7 @@
#include <framework/platform/platform.h>
#include <GL/gl.h>
#include <framework/thirdparty/glext.h>
#include <GL/glext.h>
PFNGLGENFRAMEBUFFERSPROC oglGenFramebuffers = 0;
PFNGLBINDFRAMEBUFFERPROC oglBindFramebuffer = 0;

View File

@ -26,7 +26,7 @@
#include <framework/graphics/texture.h>
#include <GL/gl.h>
#include <framework/thirdparty/glext.h>
#include <GL/glext.h>
Graphics g_graphics;

View File

@ -24,7 +24,7 @@
#include "graphics.h"
#include <GL/gl.h>
#include <framework/thirdparty/glext.h>
#include <GL/glext.h>
Texture::Texture()
{

View File

@ -30,7 +30,7 @@ class OTMLNode : public std::enable_shared_from_this<OTMLNode>
public:
virtual ~OTMLNode() { }
static OTMLNodePtr create(std::string tag = Fw::empty_string, bool unique = false);
static OTMLNodePtr create(std::string tag = "", bool unique = false);
static OTMLNodePtr create(std::string tag, std::string value);
std::string tag() const { return m_tag; }

File diff suppressed because it is too large Load Diff

View File

@ -29,10 +29,22 @@
#include <sstream>
#include <exception>
#include <cxxabi.h>
#include <chrono>
#include <unistd.h>
#include "types.h"
namespace Fw {
inline int getTicks() {
static auto firstTick = std::chrono::high_resolution_clock::now();
auto tickNow = std::chrono::high_resolution_clock::now();
return std::chrono::duration_cast<std::chrono::milliseconds>(tickNow - firstTick).count();
}
inline void sleep(int ms) {
usleep(ms);
}
// read utilities for istream
inline uint8 getU8(std::istream& in) {
uint8 tmp;
@ -256,9 +268,6 @@ inline std::string ip2str(uint32 ip) {
return std::string(host);
}
// an empty string to use anywhere needed
const static std::string empty_string;
}
// shortcut for Fw::dump

View File

@ -43,6 +43,8 @@
void OTClient::registerLuaFunctions()
{
using namespace std::placeholders;
g_lua.bindGlobalFunction("exit", std::bind(&OTClient::exit, &g_client));
g_lua.bindGlobalFunction("setOnClose", std::bind(&OTClient::setOnClose, &g_client, _1));
g_lua.bindGlobalFunction("importDat", std::bind(&ThingsType::load, &g_thingsType, _1));

View File

@ -147,7 +147,7 @@ void OTClient::run()
g_platform.swapBuffers();
} else {
// sleeps until next poll to avoid massive cpu usage
g_platform.sleep(POLL_CYCLE_DELAY+1);
Fw::sleep(POLL_CYCLE_DELAY+1);
}
}