changes to prepare revgraphics
This commit is contained in:
parent
b1e1487745
commit
4afbe43e6f
|
@ -8,22 +8,22 @@ OPTION(USE_PCH "Use precompiled header" ON)
|
||||||
OPTION(NO_CONSOLE "Disable console window on Windows" OFF)
|
OPTION(NO_CONSOLE "Disable console window on Windows" OFF)
|
||||||
OPTION(HANDLE_EXCEPTIONS "Generate crash reports" OFF)
|
OPTION(HANDLE_EXCEPTIONS "Generate crash reports" OFF)
|
||||||
OPTION(FORBIDDEN_FUNCTIONS "Enable forbidden lua functions" ON)
|
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
|
# find needed packages
|
||||||
SET(Boost_USE_STATIC_LIBS ON)
|
SET(Boost_USE_STATIC_LIBS ON)
|
||||||
SET(Boost_USE_MULTITHREADED OFF)
|
SET(Boost_USE_MULTITHREADED OFF)
|
||||||
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
|
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
|
||||||
|
|
||||||
IF(USE_GLES)
|
IF(USE_OPENGLES2)
|
||||||
FIND_PACKAGE(OpenGLES REQUIRED)
|
FIND_PACKAGE(OpenGLES2 REQUIRED)
|
||||||
FIND_PACKAGE(EGL REQUIRED)
|
FIND_PACKAGE(EGL REQUIRED)
|
||||||
SET(OPENGL_INCLUDE_DIR ${OPENGLES_INCLUDE_DIR} ${EGL_INCLUDE_DIR})
|
SET(OPENGL_INCLUDE_DIR ${OPENGLES_INCLUDE_DIR} ${EGL_INCLUDE_DIR})
|
||||||
SET(OPENGL_LIBRARIES ${OPENGLES_LIBRARY} ${EGL_LIBRARY})
|
SET(OPENGL_LIBRARIES ${OPENGLES_LIBRARY} ${EGL_LIBRARY})
|
||||||
ADD_DEFINITIONS(-DGLES -DEGL)
|
ADD_DEFINITIONS(-DOPENGLES2)
|
||||||
ELSE(USE_GLES)
|
ELSE(USE_OPENGLES2)
|
||||||
FIND_PACKAGE(OpenGL REQUIRED)
|
FIND_PACKAGE(OpenGL REQUIRED)
|
||||||
ENDIF(USE_GLES)
|
ENDIF(USE_OPENGLES2)
|
||||||
|
|
||||||
FIND_PACKAGE(Lua REQUIRED)
|
FIND_PACKAGE(Lua REQUIRED)
|
||||||
FIND_PACKAGE(PhysFS 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_DEBUG "-O0 -g3 -ggdb3 -fno-inline")
|
||||||
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
|
||||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -g -fno-inline")
|
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)
|
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ SET(SOURCES
|
||||||
src/framework/core/eventdispatcher.cpp
|
src/framework/core/eventdispatcher.cpp
|
||||||
src/framework/core/modulemanager.cpp
|
src/framework/core/modulemanager.cpp
|
||||||
src/framework/core/module.cpp
|
src/framework/core/module.cpp
|
||||||
|
src/framework/core/engine.cpp
|
||||||
|
|
||||||
# framework graphics
|
# framework graphics
|
||||||
src/framework/graphics/font.cpp
|
src/framework/graphics/font.cpp
|
||||||
|
@ -190,7 +191,8 @@ IF(WIN32)
|
||||||
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
|
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
|
||||||
SET(SOURCES ${SOURCES} icon.o)
|
SET(SOURCES ${SOURCES} icon.o)
|
||||||
ELSE(WIN32)
|
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)
|
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
|
|
@ -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)
|
|
@ -48,8 +48,7 @@ void Logger::log(Fw::LogLevel level, std::string message)
|
||||||
|
|
||||||
if(level == Fw::LogFatal) {
|
if(level == Fw::LogFatal) {
|
||||||
m_terminated = true;
|
m_terminated = true;
|
||||||
g_platform.displayFatalError(message);
|
throw std::runtime_error(message);
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
struct LogMessage {
|
struct LogMessage {
|
||||||
LogMessage(Fw::LogLevel level, const std::string& message, std::size_t when) : level(level), message(message), when(when) { }
|
LogMessage(Fw::LogLevel level, const std::string& message, std::size_t when) : level(level), message(message), when(when) { }
|
||||||
Fw::LogLevel level;
|
Fw::LogLevel level;
|
||||||
std::string message;
|
std::string message;
|
||||||
std::size_t when;
|
std::size_t when;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Logger
|
class Logger
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <framework/platform/platform.h>
|
#include <framework/platform/platform.h>
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <framework/thirdparty/glext.h>
|
#include <GL/glext.h>
|
||||||
|
|
||||||
PFNGLGENFRAMEBUFFERSPROC oglGenFramebuffers = 0;
|
PFNGLGENFRAMEBUFFERSPROC oglGenFramebuffers = 0;
|
||||||
PFNGLBINDFRAMEBUFFERPROC oglBindFramebuffer = 0;
|
PFNGLBINDFRAMEBUFFERPROC oglBindFramebuffer = 0;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <framework/graphics/texture.h>
|
#include <framework/graphics/texture.h>
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <framework/thirdparty/glext.h>
|
#include <GL/glext.h>
|
||||||
|
|
||||||
Graphics g_graphics;
|
Graphics g_graphics;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "graphics.h"
|
#include "graphics.h"
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <framework/thirdparty/glext.h>
|
#include <GL/glext.h>
|
||||||
|
|
||||||
Texture::Texture()
|
Texture::Texture()
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ class OTMLNode : public std::enable_shared_from_this<OTMLNode>
|
||||||
public:
|
public:
|
||||||
virtual ~OTMLNode() { }
|
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);
|
static OTMLNodePtr create(std::string tag, std::string value);
|
||||||
|
|
||||||
std::string tag() const { return m_tag; }
|
std::string tag() const { return m_tag; }
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,10 +29,22 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
|
#include <chrono>
|
||||||
|
#include <unistd.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
namespace Fw {
|
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
|
// read utilities for istream
|
||||||
inline uint8 getU8(std::istream& in) {
|
inline uint8 getU8(std::istream& in) {
|
||||||
uint8 tmp;
|
uint8 tmp;
|
||||||
|
@ -256,9 +268,6 @@ inline std::string ip2str(uint32 ip) {
|
||||||
return std::string(host);
|
return std::string(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
// an empty string to use anywhere needed
|
|
||||||
const static std::string empty_string;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shortcut for Fw::dump
|
// shortcut for Fw::dump
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
|
|
||||||
void OTClient::registerLuaFunctions()
|
void OTClient::registerLuaFunctions()
|
||||||
{
|
{
|
||||||
|
using namespace std::placeholders;
|
||||||
|
|
||||||
g_lua.bindGlobalFunction("exit", std::bind(&OTClient::exit, &g_client));
|
g_lua.bindGlobalFunction("exit", std::bind(&OTClient::exit, &g_client));
|
||||||
g_lua.bindGlobalFunction("setOnClose", std::bind(&OTClient::setOnClose, &g_client, _1));
|
g_lua.bindGlobalFunction("setOnClose", std::bind(&OTClient::setOnClose, &g_client, _1));
|
||||||
g_lua.bindGlobalFunction("importDat", std::bind(&ThingsType::load, &g_thingsType, _1));
|
g_lua.bindGlobalFunction("importDat", std::bind(&ThingsType::load, &g_thingsType, _1));
|
||||||
|
|
|
@ -147,7 +147,7 @@ void OTClient::run()
|
||||||
g_platform.swapBuffers();
|
g_platform.swapBuffers();
|
||||||
} else {
|
} else {
|
||||||
// sleeps until next poll to avoid massive cpu usage
|
// sleeps until next poll to avoid massive cpu usage
|
||||||
g_platform.sleep(POLL_CYCLE_DELAY+1);
|
Fw::sleep(POLL_CYCLE_DELAY+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue