Code clean up and some minor fixes.

premake5 is being reworked, might fail in some situations.
This commit is contained in:
Martín Lucas Golini
2020-01-18 19:40:27 -03:00
parent 89df736630
commit 57c31ffcb4
33 changed files with 277 additions and 321 deletions

View File

@@ -898,7 +898,7 @@ EXCLUDE_PATTERNS =
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
EXCLUDE_SYMBOLS = pugi, EE::Maps::Private, EE::Graphics::Private, EE::System::Private
EXCLUDE_SYMBOLS = pugi, EE::Maps::Private, EE::Graphics::Private, EE::System::Private, EE::System::Platform, EE::Window::Platform, EE::Window::Backend
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include

View File

@@ -14,7 +14,8 @@ using namespace EE::System;
namespace EE { namespace Graphics {
struct eeVertex {
/// Holds the position texture UV and color of a vertex.
struct VertexData {
Vector2f pos;
Vector2f tex;
Color color;
@@ -143,7 +144,7 @@ class EE_API BatchRenderer {
const PrimitiveType& primitiveType = PRIMITIVE_POINTS );
/** Adds to the batch a point list */
void batchPointList( const std::vector<eeVertex>& points,
void batchPointList( const std::vector<VertexData>& points,
const PrimitiveType& primitiveType = PRIMITIVE_POINTS );
/** This will set as the default batch rendering to PRIMITIVE_LINES. And will reset the line
@@ -299,9 +300,9 @@ class EE_API BatchRenderer {
const bool& getForceBlendModeChange() const;
protected:
eeVertex* mVertex;
VertexData* mVertex;
unsigned int mVertexSize;
eeVertex* mTVertex;
VertexData* mTVertex;
unsigned int mNumVertex;
const Texture* mTexture;

View File

@@ -19,7 +19,7 @@ class RendererGL3CP;
class RendererGLES2;
/** @brief This class is an abstraction of some OpenGL functionality.
* eepp have 4 different rendering pipelines: OpenGL 2, OpenGL 3, OpenGL 3 Core Profile and OpenGL
* eepp has 4 different rendering pipelines: OpenGL 2, OpenGL 3, OpenGL 3 Core Profile and OpenGL
*ES 2. This abstraction is to encapsulate this pipelines. eepp implements its own state machine to
*simulate fixed-pipeline commands with OpenGL 3 and OpenGL ES 2. Most of the commands can be found
*in the OpenGL documentation. This is only useful for advanced users that want some control of the
@@ -27,7 +27,7 @@ class RendererGLES2;
*/
class EE_API Renderer {
public:
static Renderer* createSingleton( EEGL_version ver );
static Renderer* createSingleton( GraphicsLibraryVersion ver );
static Renderer* createSingleton();
@@ -60,7 +60,7 @@ class EE_API Renderer {
bool isExtension( const std::string& name );
/** @return If the extension from the EEGL_extensions is present on the GPU. */
bool isExtension( EEGL_extensions name );
bool isExtension( GraphicsLibraryExtension name );
bool pointSpriteSupported();
@@ -133,7 +133,7 @@ class EE_API Renderer {
virtual void enable( unsigned int cap );
virtual EEGL_version version() = 0;
virtual GraphicsLibraryVersion version() = 0;
virtual std::string versionStr() = 0;

View File

@@ -14,7 +14,7 @@ class EE_API RendererGL : public Renderer {
~RendererGL();
EEGL_version version();
GraphicsLibraryVersion version();
std::string versionStr();

View File

@@ -19,7 +19,7 @@ class EE_API RendererGL3 : public RendererGLShader {
~RendererGL3();
EEGL_version version();
GraphicsLibraryVersion version();
std::string versionStr();

View File

@@ -19,7 +19,7 @@ class EE_API RendererGL3CP : public RendererGLShader {
~RendererGL3CP();
EEGL_version version();
GraphicsLibraryVersion version();
std::string versionStr();

View File

@@ -25,7 +25,7 @@ class EE_API RendererGLES2 : public RendererGLShader {
~RendererGLES2();
EEGL_version version();
GraphicsLibraryVersion version();
std::string versionStr();

View File

@@ -3,8 +3,8 @@
namespace EE { namespace Graphics {
/** Just for reference */
enum EEGL_ARRAY_STATES {
/** Internal reference of Vertex Arrays States */
enum VertexArrayStates {
EEGL_VERTEX_ARRAY = 0,
EEGL_NORMAL_ARRAY,
EEGL_COLOR_ARRAY,
@@ -12,7 +12,8 @@ enum EEGL_ARRAY_STATES {
EEGL_TEXTURE_COORD_ARRAY
};
enum EEGL_extensions {
/// Graphics Library Extensions used by eepp when available.
enum GraphicsLibraryExtension {
EEGL_ARB_texture_non_power_of_two = 0,
EEGL_ARB_point_parameters,
EEGL_ARB_point_sprite,
@@ -33,7 +34,21 @@ enum EEGL_extensions {
EEGL_EXT_blend_subtract
};
enum EEGL_version { GLv_2, GLv_3, GLv_3CP, GLv_ES1, GLv_ES2, GLv_default };
/// Graphics Library Renderer version available.
enum GraphicsLibraryVersion {
/// OpenGL 2
GLv_2,
/// OpenGL 3
GLv_3,
/// OpenGL 3 Core Profile
GLv_3CP,
/// OpenGL ES 1
GLv_ES1,
/// OpenGL ES 2
GLv_ES2,
/// Selects the most appropriate graphics library version for each platform.
GLv_default
};
}} // namespace EE::Graphics

View File

@@ -17,7 +17,7 @@ class EE_API VertexBuffer {
public:
/** @brief Creates a new Vertex Buffer.
* @param VertexFlags The vertex flags indicates which vertex data will be used. @see
*EE_VERTEX_FLAGS
*VertexFlags
* @param DrawType The type of the primitive to draw.
* @param ReserveVertexSize If the vertex size is known is possible to reserve the space in
*memory to avoid resizeing the array.
@@ -30,15 +30,15 @@ class EE_API VertexBuffer {
static VertexBuffer* New( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT,
PrimitiveType DrawType = PRIMITIVE_QUADS,
const Int32& ReserveVertexSize = 0, const Int32& ReserveIndexSize = 0,
EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
VertexBufferUsageType UsageType = VertexBufferUsageType::Static );
/** Creates the simple vertex array implementation ( without VBOs or VAO ), which it's faster
* for many cases. */
static VertexBuffer* NewVertexArray( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT,
PrimitiveType DrawType = PRIMITIVE_QUADS,
const Int32& ReserveVertexSize = 0,
const Int32& ReserveIndexSize = 0,
EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
static VertexBuffer*
NewVertexArray( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT,
PrimitiveType DrawType = PRIMITIVE_QUADS, const Int32& ReserveVertexSize = 0,
const Int32& ReserveIndexSize = 0,
VertexBufferUsageType UsageType = VertexBufferUsageType::Static );
virtual ~VertexBuffer();
@@ -144,7 +144,7 @@ class EE_API VertexBuffer {
protected:
Uint32 mVertexFlags;
PrimitiveType mDrawType;
EE_VBO_USAGE_TYPE mUsageType;
VertexBufferUsageType mUsageType;
Int32 mElemDraw;
std::vector<Float> mVertexArray[VERTEX_FLAGS_COUNT - 1];
std::vector<Uint8> mColorArray;
@@ -153,7 +153,7 @@ class EE_API VertexBuffer {
VertexBuffer( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT,
PrimitiveType DrawType = PRIMITIVE_QUADS, const Int32& ReserveVertexSize = 0,
const Int32& ReserveIndexSize = 0,
EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
VertexBufferUsageType UsageType = VertexBufferUsageType::Static );
virtual void setVertexStates() = 0;
};

View File

@@ -3,14 +3,14 @@
namespace EE { namespace Graphics {
enum EE_VBO_USAGE_TYPE {
VBO_USAGE_TYPE_STATIC,
VBO_USAGE_TYPE_DYNAMIC,
VBO_USAGE_TYPE_STREAM,
VBO_USAGE_TYPE_COUNT
/// VBO default usage type
enum class VertexBufferUsageType : int {
Static,
Dynamic,
Stream,
};
enum EE_VERTEX_FLAGS {
enum VertexFlags {
VERTEX_FLAG_POSITION = 0,
VERTEX_FLAG_TEXTURE0 = 1,
VERTEX_FLAG_TEXTURE1 = 2,
@@ -23,7 +23,7 @@ enum EE_VERTEX_FLAGS {
#define VERTEX_FLAGS_COUNT_ARR ( 5 )
#define VERTEX_FLAGS_COUNT ( 6 )
const int eeVertexElements[] = {
const int VertexElementCount[] = {
2, // Position
2, // Texture0
2, // Texture1
@@ -38,9 +38,12 @@ const int eeVertexElements[] = {
F |= VERTEX_FLAG_GET( X );
#define VERTEX_FLAG_QUERY( F, X ) ( F & VERTEX_FLAG_GET( X ) )
/// Vertex data will have position, color and texture UV.
#define VERTEX_FLAGS_DEFAULT \
( VERTEX_FLAG_GET( VERTEX_FLAG_POSITION ) | VERTEX_FLAG_GET( VERTEX_FLAG_TEXTURE0 ) | \
VERTEX_FLAG_GET( VERTEX_FLAG_COLOR ) )
/// Vertex data will have position and color.
#define VERTEX_FLAGS_PRIMITIVE \
( VERTEX_FLAG_GET( VERTEX_FLAG_POSITION ) | VERTEX_FLAG_GET( VERTEX_FLAG_COLOR ) )

View File

@@ -14,7 +14,7 @@ class EE_API VertexBufferOGL : public VertexBuffer {
VertexBufferOGL( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT,
PrimitiveType DrawType = PRIMITIVE_QUADS, const Int32& ReserveVertexSize = 0,
const Int32& ReserveIndexSize = 0,
EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
VertexBufferUsageType UsageType = VertexBufferUsageType::Static );
void bind();

View File

@@ -15,7 +15,7 @@ class EE_API VertexBufferVBO : public VertexBuffer {
VertexBufferVBO( const Uint32& VertexFlags = VERTEX_FLAGS_DEFAULT,
PrimitiveType DrawType = PRIMITIVE_QUADS, const Int32& ReserveVertexSize = 0,
const Int32& ReserveIndexSize = 0,
EE_VBO_USAGE_TYPE UsageType = VBO_USAGE_TYPE_STATIC );
VertexBufferUsageType UsageType = VertexBufferUsageType::Static );
virtual ~VertexBufferVBO();

View File

@@ -31,7 +31,7 @@ using namespace EE::Scene;
namespace EE { namespace Scene {
enum NODE_FLAGS_VALUES {
enum NodeFlags {
NODE_FLAG_SCHEDULED_UPDATE = ( 1 << 0 ),
NODE_FLAG_VIEW_DIRTY = ( 1 << 1 ),
NODE_FLAG_POSITION_DIRTY = ( 1 << 2 ),

View File

@@ -12,7 +12,7 @@ class IniFile;
class Pack;
}} // namespace EE::System
namespace EE { namespace Window { namespace Backend {
class WindowBackend;
class WindowBackendLibrary;
}}} // namespace EE::Window::Backend
namespace EE { namespace Window {
@@ -104,10 +104,10 @@ class EE_API Engine {
ContextSettings createContextSettings( IniFile* ini, std::string iniKeyName = "EEPP" );
/** Enabling Shared GL Context allows asynchronous OpenGL resource loading ( only if is
*supported by the backend and the OS, SDL 2 backend is the only one supported ). * If the
*TextureLoader is threaded, will upload the texture in another thread to the GPU. So, it will
*not block the main rendering thread. * Shared GL Context is disabled by default.
*/
*supported by the backend and the OS, SDL 2 backend is the only one supported ). * If the
*TextureLoader is threaded, will upload the texture in another thread to the GPU. So, it will
*not block the main rendering thread. * Shared GL Context is disabled by default.
*/
void enableSharedGLContext();
/** Disable the Shared GL Context
@@ -130,7 +130,7 @@ class EE_API Engine {
protected:
friend class Window;
Backend::WindowBackend* mBackend;
Backend::WindowBackendLibrary* mBackend;
std::list<Window*> mWindows;
EE::Window::Window* mWindow;
bool mSharedGLContext;
@@ -143,7 +143,7 @@ class EE_API Engine {
void destroy();
Backend::WindowBackend* createSDL2Backend( const WindowSettings& Settings );
Backend::WindowBackendLibrary* createSDL2Backend( const WindowSettings& Settings );
EE::Window::Window* createSDL2Window( const WindowSettings& Settings,
const ContextSettings& Context );
@@ -151,7 +151,7 @@ class EE_API Engine {
EE::Window::Window* createDefaultWindow( const WindowSettings& Settings,
const ContextSettings& Context );
Uint32 getDefaultBackend() const;
WindowBackend getDefaultBackend() const;
};
}} // namespace EE::Window

View File

@@ -1,26 +1,13 @@
#ifndef EE_WINDOWCINPUTTEXTBUFFER_H
#define EE_WINDOWCINPUTTEXTBUFFER_H
#include <climits>
#include <eepp/window/base.hpp>
#include <eepp/window/input.hpp>
#include <eepp/window/window.hpp>
namespace EE { namespace Window {
enum INPUT_TEXTBUFFER_FLAGS {
INPUT_TB_SUPPORT_NEW_LINE = 0,
INPUT_TB_ALLOW_ONLY_NUMBERS = 1,
INPUT_TB_ALLOW_DOT_IN_NUMBERS = 2,
INPUT_TB_ACTIVE = 3,
INPUT_TB_CHANGE_SINCE_LAST_UPDATE = 4,
INPUT_TB_FREE_EDITING = 5,
INPUT_TB_PROMPT_AUTO_POS = 6,
INPUT_TB_SUPPORT_COPY_PASTE = 7,
INPUT_TB_TEXT_SELECTION_ENABLED = 8
};
#define INPUT_LENGHT_MAX 0xFFFFFFFF
/** @brief A class to keep a buffer of the user writed text */
class EE_API InputTextBuffer {
public:
@@ -31,13 +18,12 @@ class EE_API InputTextBuffer {
static InputTextBuffer* New( const bool& active, const bool& newLineEnabled,
const bool& freeEditing, EE::Window::Window* window = NULL,
const Uint32& maxLength = INPUT_LENGHT_MAX );
const Uint32& maxLength = UINT32_MAX );
static InputTextBuffer* New( EE::Window::Window* window = NULL );
InputTextBuffer( const bool& active, const bool& newLineEnabled, const bool& freeEditing,
EE::Window::Window* window = NULL,
const Uint32& maxLength = INPUT_LENGHT_MAX );
EE::Window::Window* window = NULL, const Uint32& maxLength = UINT32_MAX );
InputTextBuffer( EE::Window::Window* window = NULL );
@@ -155,6 +141,18 @@ class EE_API InputTextBuffer {
void setSelectionChangeCallback( const SelectionChangeCallback& selectionChangeCallback );
protected:
enum Flags {
SUPPORT_NEW_LINE = 0,
ALLOW_ONLY_NUMBERS = 1,
ALLOW_DOT_IN_NUMBERS = 2,
ACTIVE = 3,
CHANGE_SINCE_LAST_UPDATE = 4,
FREE_EDITING = 5,
PROMPT_AUTO_POS = 6,
SUPPORT_COPY_PASTE = 7,
TEXT_SELECTION_ENABLED = 8
};
EE::Window::Window* mWindow;
String mText;
Uint32 mFlags;

View File

@@ -16,9 +16,7 @@ class Clipboard;
class Input;
class CursorManager;
/** @namespace EE::Window::WindowStyle Define the Windows Styles */
namespace WindowStyle {
enum {
enum WindowStyle {
Borderless = ( 1 << 0 ),
Titlebar = ( 1 << 1 ),
Resize = ( 1 << 2 ),
@@ -30,12 +28,8 @@ enum {
Default = Titlebar | Resize
#endif
};
} // namespace WindowStyle
/** @namespace EE::Window::WindowBackend Define the window backends supported by eepp */
namespace WindowBackend {
enum { SDL2, Default };
}
enum class WindowBackend : Uint32 { SDL2, Default };
#ifndef EE_SCREEN_KEYBOARD_ENABLED
#if EE_PLATFORM == EE_PLATFORM_ANDROID || EE_PLATFORM == EE_PLATFORM_IOS
@@ -50,7 +44,7 @@ class WindowSettings {
public:
inline WindowSettings( Uint32 width, Uint32 height, const std::string& caption = std::string(),
Uint32 style = WindowStyle::Default,
Uint32 backend = WindowBackend::Default, Uint32 bpp = 32,
WindowBackend backend = WindowBackend::Default, Uint32 bpp = 32,
const std::string& icon = std::string(), const Float& pixelDensity = 1,
const bool& useScreenKeyboard = EE_SCREEN_KEYBOARD_ENABLED ) :
Style( style ),
@@ -78,7 +72,7 @@ class WindowSettings {
Uint32 BitsPerPixel;
std::string Icon;
std::string Caption;
Uint32 Backend;
WindowBackend Backend;
Float PixelDensity;
bool UseScreenKeyboard;
};
@@ -86,7 +80,7 @@ class WindowSettings {
/** @brief ContextSettings Small class that contains the renderer context information */
class ContextSettings {
public:
inline ContextSettings( bool vsync, EEGL_version version = GLv_default,
inline ContextSettings( bool vsync, GraphicsLibraryVersion version = GLv_default,
bool doubleBuffering = true, Uint32 depthBufferSize = 24,
Uint32 stencilBufferSize = 1, Uint32 multisamples = 0,
bool sharedGLContext = true, Int32 frameRateLimit = 0 ) :
@@ -109,7 +103,7 @@ class ContextSettings {
DoubleBuffering( true ),
SharedGLContext( true ) {}
EEGL_version Version;
GraphicsLibraryVersion Version;
Uint32 DepthBufferSize;
Uint32 StencilBufferSize;
Uint32 Multisamples;
@@ -132,7 +126,7 @@ class WindowInfo {
WindowSettings WindowConfig;
ContextSettings ContextConfig;
Uint32 Backend;
WindowBackend Backend;
Sizei DesktopResolution;
Sizei WindowSize;
Uint32 Flags;

View File

@@ -17,17 +17,6 @@ newoption {
}
}
function explode(div,str)
if (div=='') then return false end
local pos,arr = 0,{}
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,string.sub(str,pos,st-1))
pos = sp + 1
end
table.insert(arr,string.sub(str,pos))
return arr
end
function print_table( table_ref )
for _, value in pairs( table_ref ) do
print(value)
@@ -40,10 +29,6 @@ function table_length(T)
return count
end
function args_contains( element )
return table.contains( _ARGS, element )
end
function multiple_insert( parent_table, insert_table )
for _, value in pairs( insert_table ) do
table.insert( parent_table, value )
@@ -51,7 +36,7 @@ function multiple_insert( parent_table, insert_table )
end
function get_ios_arch()
local archs = explode( "-", os.target() )
local archs = string.explode( os.target(), "-" )
return archs[ table_length( archs ) ]
end
@@ -111,6 +96,13 @@ backend_selected = false
remote_sdl2_version = "SDL2-2.0.10"
remote_sdl2_devel_vc_url = "https://www.libsdl.org/release/SDL2-devel-2.0.10-VC.zip"
function incdirs( dirs )
if is_xcode() then
sysincludedirs { dirs }
end
includedirs { dirs }
end
function download_and_extract_dependencies()
if _OPTIONS["windows-vc-build"] then
print("Downloading: " .. remote_sdl2_devel_vc_url)
@@ -129,33 +121,26 @@ function download_and_extract_dependencies()
end
function build_base_configuration( package_name )
sysincludedirs { "src/thirdparty/zlib" }
if not os.istarget("windows") then
buildoptions{ "-fPIC" }
end
if is_vs() then
sysincludedirs { "src/thirdparty/libzip/vs" }
end
incdirs { "src/thirdparty/zlib" }
set_ios_config()
set_xcode_config()
configuration "debug"
defines { "DEBUG" }
symbols "On"
if not is_vs() then
buildoptions{ "-Wall", "-std=gnu99" }
end
filter "not system:windows"
buildoptions{ "-fPIC" }
filter "configurations:debug"
targetname ( package_name .. "-debug" )
configuration "release"
optimize "Speed"
if not is_vs() then
buildoptions{ "-Wall", "-std=gnu99" }
end
filter "configurations:release"
targetname ( package_name )
filter "action:not vs*"
cdialect "gnu99"
buildoptions{ "-Wall" }
filter "action:vs*"
incdirs { "src/thirdparty/libzip/vs" }
end
function build_base_cpp_configuration( package_name )
@@ -166,7 +151,7 @@ function build_base_cpp_configuration( package_name )
set_ios_config()
set_xcode_config()
configuration "debug"
filter "configurations:debug"
defines { "DEBUG" }
symbols "On"
if not is_vs() then
@@ -174,7 +159,7 @@ function build_base_cpp_configuration( package_name )
end
targetname ( package_name .. "-debug" )
configuration "release"
filter "configurations:release"
optimize "Speed"
if not is_vs() then
buildoptions{ "-Wall" }
@@ -194,20 +179,8 @@ function add_cross_config_links()
end
end
function fix_shared_lib_linking_path( package_name, libname )
if ( "4.4-beta5" == _PREMAKE_VERSION or "HEAD" == _PREMAKE_VERSION ) and not _OPTIONS["with-static-eepp"] and package_name == "eepp" then
if os.istarget("macosx") then
linkoptions { "-install_name " .. libname .. ".dylib" }
elseif os.istarget("linux") or os.istarget("freebsd") then
linkoptions { "-Wl,-soname=\"" .. libname .. "\"" }
elseif os.istarget("haiku") then
linkoptions { "-Wl,-soname=\"" .. libname .. ".so" .. "\"" }
end
end
end
function build_link_configuration( package_name, use_ee_icon )
sysincludedirs { "include" }
incdirs { "include" }
local extension = "";
@@ -254,7 +227,7 @@ function build_link_configuration( package_name, use_ee_icon )
set_ios_config()
set_xcode_config()
configuration "debug"
filter "configurations:debug"
defines { "DEBUG", "EE_DEBUG", "EE_MEMORY_MANAGER" }
symbols "On"
@@ -262,11 +235,9 @@ function build_link_configuration( package_name, use_ee_icon )
buildoptions{ "-Wall -Wno-long-long" }
end
fix_shared_lib_linking_path( package_name, "libeepp-debug" )
targetname ( package_name .. "-debug" .. extension )
configuration "release"
filter "configurations:release"
optimize "Speed"
if not is_vs() and not os.istarget("emscripten") then
@@ -277,11 +248,9 @@ function build_link_configuration( package_name, use_ee_icon )
buildoptions { "-s" }
end
fix_shared_lib_linking_path( package_name, "libeepp" )
targetname ( package_name .. extension )
configuration "windows"
filter "system:windows"
add_cross_config_links()
if _OPTIONS["windows-vc-build"] then
@@ -292,7 +261,7 @@ function build_link_configuration( package_name, use_ee_icon )
links { "SDL2", "SDL2main" }
end
configuration "emscripten"
filter "system:emscripten"
linkoptions{ "-O2 -s TOTAL_MEMORY=67108864 -s ASM_JS=1 -s VERBOSE=1 -s DISABLE_EXCEPTION_CATCHING=0 -s USE_SDL=2 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ERROR_ON_MISSING_LIBRARIES=0 -s FULL_ES3=1 -s \"BINARYEN_TRAP_MODE='clamp'\"" }
buildoptions { "-fno-strict-aliasing -O2 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=web" }
@@ -318,7 +287,7 @@ function generate_os_links()
multiple_insert( os_links, { "opengl32", "glu32", "gdi32", "ws2_32", "winmm", "ole32" } )
elseif os.istarget("macosx") then
multiple_insert( os_links, { "OpenGL.framework", "CoreFoundation.framework" } )
elseif os.istarget("freebsd") then
elseif os.istarget("bsd") then
multiple_insert( os_links, { "rt", "pthread", "X11", "GL", "Xcursor" } )
elseif os.istarget("haiku") then
multiple_insert( os_links, { "GL", "network" } )
@@ -329,7 +298,7 @@ function generate_os_links()
end
if not _OPTIONS["with-mojoal"] then
if os.istarget("linux") or os.istarget("freebsd") or os.istarget("haiku") or os.istarget("emscripten") then
if os.istarget("linux") or os.istarget("bsd") or os.istarget("haiku") or os.istarget("emscripten") then
multiple_insert( os_links, { "openal" } )
elseif os.istarget("windows") or os.istarget("mingw32") then
multiple_insert( os_links, { "OpenAL32" } )
@@ -415,7 +384,7 @@ end
function set_xcode_config()
if is_xcode() or _OPTIONS["use-frameworks"] then
linkoptions { "-F /Library/Frameworks" }
sysincludedirs { "/Library/Frameworks/SDL2.framework/Headers" }
incdirs { "/Library/Frameworks/SDL2.framework/Headers" }
defines { "EE_SDL2_FROM_ROOTPATH" }
end
end
@@ -455,11 +424,11 @@ function set_ios_config()
linkoptions { sysroot_ver }
libdirs { framework_libs_path }
linkoptions { " -F" .. framework_path .. " -L" .. framework_libs_path .. " -isysroot " .. sysroot_path }
sysincludedirs { "src/thirdparty/SDL2/include" }
incdirs { "src/thirdparty/SDL2/include" }
end
if _OPTIONS.platform == "ios-cross-arm7" or _OPTIONS.platform == "ios-cross-x86" then
sysincludedirs { "src/thirdparty/SDL2/include" }
incdirs { "src/thirdparty/SDL2/include" }
end
end
@@ -537,15 +506,15 @@ function set_macos_and_ios_config()
end
function build_eepp( build_name )
sysincludedirs { "include", "src", "src/thirdparty", "include/eepp/thirdparty", "src/thirdparty/freetype2/include", "src/thirdparty/zlib", "src/thirdparty/libogg/include", "src/thirdparty/libvorbis/include", "src/thirdparty/mbedtls/include" }
incdirs { "include", "src", "src/thirdparty", "include/eepp/thirdparty", "src/thirdparty/freetype2/include", "src/thirdparty/zlib", "src/thirdparty/libogg/include", "src/thirdparty/libvorbis/include", "src/thirdparty/mbedtls/include" }
if _OPTIONS["with-mojoal"] then
defines( "AL_LIBTYPE_STATIC" )
sysincludedirs { "src/thirdparty/mojoAL" }
incdirs { "src/thirdparty/mojoAL" }
end
if _OPTIONS["windows-vc-build"] then
sysincludedirs { "src/thirdparty/" .. remote_sdl2_version .. "/include" }
incdirs { "src/thirdparty/" .. remote_sdl2_version .. "/include" }
end
set_macos_and_ios_config()
@@ -555,7 +524,7 @@ function build_eepp( build_name )
add_static_links()
if is_vs() then
sysincludedirs { "src/thirdparty/libzip/vs" }
incdirs { "src/thirdparty/libzip/vs" }
end
if not is_vs() then
@@ -621,7 +590,6 @@ function set_targetdir( dir )
end
workspace "eepp"
targetdir("./bin/")
configurations { "debug", "release" }
rtti "On"
@@ -645,47 +613,46 @@ workspace "eepp"
generate_os_links()
parse_args()
filter "configurations:debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:release"
optimize "Speed"
project "SOIL2-static"
kind "StaticLib"
if is_vs() then
language "C++"
buildoptions { "/TP" }
else
language "C"
end
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
files { "src/thirdparty/SOIL2/src/SOIL2/*.c" }
sysincludedirs { "src/thirdparty/SOIL2" }
incdirs { "src/thirdparty/SOIL2" }
build_base_configuration( "SOIL2" )
if not os.istarget("haiku") and not os.istarget("ios") and not os.istarget("android") and not os.istarget("emscripten") then
project "glew-static"
kind "StaticLib"
filter "action:vs*"
language "C++"
buildoptions { "/TP" }
filter "action:not vs*"
language "C"
defines { "GLEW_NO_GLU", "GLEW_STATIC" }
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
files { "src/thirdparty/glew/*.c" }
sysincludedirs { "include/thirdparty/glew" }
build_base_configuration( "glew" )
end
if not _OPTIONS["with-openssl"] then
project "mbedtls-static"
kind "StaticLib"
language "C"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
sysincludedirs { "src/thirdparty/mbedtls/include/" }
files { "src/thirdparty/mbedtls/library/*.c" }
build_base_cpp_configuration( "mbedtls" )
end
project "glew-static"
kind "StaticLib"
language "C"
defines { "GLEW_NO_GLU", "GLEW_STATIC" }
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
files { "src/thirdparty/glew/*.c" }
incdirs { "include/thirdparty/glew" }
build_base_configuration( "glew" )
project "mbedtls-static"
kind "StaticLib"
language "C"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
incdirs { "src/thirdparty/mbedtls/include/" }
files { "src/thirdparty/mbedtls/library/*.c" }
build_base_cpp_configuration( "mbedtls" )
project "vorbis-static"
kind "StaticLib"
language "C"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
sysincludedirs { "src/thirdparty/libvorbis/lib/", "src/thirdparty/libogg/include", "src/thirdparty/libvorbis/include" }
incdirs { "src/thirdparty/libvorbis/lib/", "src/thirdparty/libogg/include", "src/thirdparty/libvorbis/include" }
files { "src/thirdparty/libogg/**.c", "src/thirdparty/libvorbis/**.c" }
build_base_cpp_configuration( "vorbis" )
@@ -708,7 +675,7 @@ workspace "eepp"
language "C"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
files { "src/thirdparty/libzip/*.c" }
sysincludedirs { "src/thirdparty/zlib" }
incdirs { "src/thirdparty/zlib" }
build_base_configuration( "libzip" )
project "freetype-static"
@@ -717,23 +684,20 @@ workspace "eepp"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
defines { "FT2_BUILD_LIBRARY" }
files { "src/thirdparty/freetype2/src/**.c" }
sysincludedirs { "src/thirdparty/freetype2/include" }
incdirs { "src/thirdparty/freetype2/include" }
build_base_configuration( "freetype" )
project "chipmunk-static"
kind "StaticLib"
if is_vs() then
language "C++"
buildoptions { "/TP" }
else
language "C"
end
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
files { "src/thirdparty/chipmunk/*.c", "src/thirdparty/chipmunk/constraints/*.c" }
sysincludedirs { "include/eepp/thirdparty/chipmunk" }
incdirs { "include/eepp/thirdparty/chipmunk" }
build_base_configuration( "chipmunk" )
filter "action:vs*"
language "C++"
buildoptions { "/TP" }
filter "action:not vs*"
language "C"
project "jpeg-compressor-static"
kind "StaticLib"
@@ -749,56 +713,41 @@ workspace "eepp"
files { "src/thirdparty/imageresampler/*.cpp" }
build_base_cpp_configuration( "imageresampler" )
if _OPTIONS["with-mojoal"] then
project "mojoal-static"
kind "StaticLib"
language "C"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
if _OPTIONS["windows-vc-build"] then
sysincludedirs { "src/thirdparty/" .. remote_sdl2_version .. "/include" }
end
sysincludedirs { "include/eepp/thirdparty/mojoAL" }
defines( "AL_LIBTYPE_STATIC" )
files { "src/thirdparty/mojoAL/*.c" }
build_base_cpp_configuration( "mojoal" )
end
project "mojoal-static"
kind "StaticLib"
language "C"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
incdirs { "include/eepp/thirdparty/mojoAL" }
defines( "AL_LIBTYPE_STATIC" )
files { "src/thirdparty/mojoAL/*.c" }
build_base_cpp_configuration( "mojoal" )
filter "options:windows-vc-build"
incdirs { "src/thirdparty/" .. remote_sdl2_version .. "/include" }
project "efsw-static"
kind "StaticLib"
language "C++"
set_targetdir("libs/" .. os.target() .. "/thirdparty/")
sysincludedirs { "src/thirdparty/efsw/include", "src/thirdparty/efsw/src" }
if os.istarget("windows") then
osfiles = "src/thirdparty/efsw/src/efsw/platform/win/*.cpp"
else
osfiles = "src/thirdparty/efsw/src/efsw/platform/posix/*.cpp"
end
files { "src/thirdparty/efsw/src/efsw/*.cpp", osfiles }
if os.istarget("windows") then
excludes { "src/thirdparty/efsw/src/efsw/WatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp", "src/thirdparty/efsw/src/efsw/WatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp" }
elseif os.istarget("linux") then
excludes { "src/thirdparty/efsw/src/efsw/WatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp", "src/thirdparty/efsw/src/efsw/WatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp" }
elseif os.istarget("macosx") then
excludes { "src/thirdparty/efsw/src/efsw/WatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/WatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp" }
elseif os.istarget("freebsd") then
excludes { "src/thirdparty/efsw/src/efsw/WatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/WatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp" }
end
incdirs { "src/thirdparty/efsw/include", "src/thirdparty/efsw/src" }
files { "src/thirdparty/efsw/src/efsw/*.cpp" }
build_base_cpp_configuration( "efsw" )
filter "system:windows"
files { "src/thirdparty/efsw/src/efsw/platform/win/*.cpp" }
excludes { "src/thirdparty/efsw/src/efsw/WatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp", "src/thirdparty/efsw/src/efsw/WatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp" }
filter "system:linux"
excludes { "src/thirdparty/efsw/src/efsw/WatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp", "src/thirdparty/efsw/src/efsw/WatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherKqueue.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp" }
filter "system:macosx"
excludes { "src/thirdparty/efsw/src/efsw/WatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/WatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp" }
filter "system:bsd"
excludes { "src/thirdparty/efsw/src/efsw/WatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/WatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/WatcherFSEvents.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherInotify.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherWin32.cpp", "src/thirdparty/efsw/src/efsw/FileWatcherFSEvents.cpp" }
filter "system:not windows"
files { "src/thirdparty/efsw/src/efsw/platform/posix/*.cpp" }
project "eepp-main"
kind "StaticLib"
language "C++"
set_targetdir("libs/" .. os.target() .. "/")
files { "src/eepp/main/eepp_main.cpp" }
configuration "debug"
defines { "DEBUG" }
symbols "On"
configuration "release"
optimize "Speed"
project "eepp-static"
kind "StaticLib"
@@ -865,14 +814,14 @@ workspace "eepp"
kind "ConsoleApp"
language "C++"
files { "src/examples/http_request/*.cpp" }
sysincludedirs { "src/thirdparty" }
incdirs { "src/thirdparty" }
build_link_configuration( "eehttp-request", true )
project "eepp-ui-hello-world"
set_kind()
language "C++"
files { "src/examples/ui_hello_world/*.cpp" }
sysincludedirs { "src/thirdparty" }
incdirs { "src/thirdparty" }
build_link_configuration( "eeui-hello-world", true )
-- Tools
@@ -891,19 +840,14 @@ workspace "eepp"
project "eepp-uieditor"
set_kind()
language "C++"
sysincludedirs { "src/thirdparty/efsw/include", "src/thirdparty" }
if not os.istarget("windows") and not os.istarget("haiku") then
links { "pthread" }
end
if os.istarget("macosx") then
links { "CoreFoundation.framework", "CoreServices.framework" }
end
incdirs { "src/thirdparty/efsw/include", "src/thirdparty" }
links { "efsw-static", "pugixml-static" }
files { "src/tools/uieditor/*.cpp" }
build_link_configuration( "eepp-UIEditor", true )
filter "system:macosx"
links { "CoreFoundation.framework", "CoreServices.framework" }
filter { "system:not windows", "system:not haiku" }
links { "pthread" }
if os.isfile("external_projects.lua") then
dofile("external_projects.lua")

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2020-01-13T04:18:34. -->
<!-- Written by QtCreator 4.11.0, 2020-01-18T19:39:43. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -77,7 +77,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{6d057187-158a-4883-8d5b-d470a6b6b025}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">10</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">12</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">15</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
@@ -85,7 +85,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">gmake</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">gmake2</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Command">premake5</value>
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}../../../</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
@@ -166,7 +166,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--with-backend=SDL2 gmake</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">gmake</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Command">premake5</value>
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}../../../</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
@@ -175,7 +175,7 @@
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets"/>
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand">make</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand">/usr/bin/make</value>
<value type="bool" key="GenericProjectManager.GenericMakeStep.OverrideMakeflags">false</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>

View File

@@ -62,7 +62,7 @@ void BatchRenderer::init() {
void BatchRenderer::allocVertexs( const unsigned int& size ) {
eeSAFE_DELETE_ARRAY( mVertex );
mVertex = eeNewArray( eeVertex, size );
mVertex = eeNewArray( VertexData, size );
mVertexSize = size;
mNumVertex = 0;
}
@@ -95,7 +95,7 @@ void BatchRenderer::addVertexs( const unsigned int& num ) {
mNumVertex += num;
if ( ( mNumVertex + num ) >= mVertexSize ) {
eeVertex* newVertex = eeNewArray( eeVertex, mVertexSize * 2 );
VertexData* newVertex = eeNewArray( VertexData, mVertexSize * 2 );
for ( Uint32 i = 0; i < mVertexSize; i++ )
newVertex[i] = mVertex[i];
@@ -142,21 +142,21 @@ void BatchRenderer::flush() {
GLi->translatef( -mCenter.x, -mCenter.y, 0.0f );
}
Uint32 alloc = sizeof( eeVertex ) * NumVertex;
Uint32 alloc = sizeof( VertexData ) * NumVertex;
if ( NULL != mTexture ) {
const_cast<Texture*>( mTexture )->bind( mCoordinateType );
GLi->texCoordPointer( 2, GL_FP, sizeof( eeVertex ),
GLi->texCoordPointer( 2, GL_FP, sizeof( VertexData ),
reinterpret_cast<char*>( &mVertex[0] ) + sizeof( Vector2f ), alloc );
} else {
GLi->disable( GL_TEXTURE_2D );
GLi->disableClientState( GL_TEXTURE_COORD_ARRAY );
}
GLi->vertexPointer( 2, GL_FP, sizeof( eeVertex ), reinterpret_cast<char*>( &mVertex[0] ),
GLi->vertexPointer( 2, GL_FP, sizeof( VertexData ), reinterpret_cast<char*>( &mVertex[0] ),
alloc );
GLi->colorPointer(
4, GL_UNSIGNED_BYTE, sizeof( eeVertex ),
4, GL_UNSIGNED_BYTE, sizeof( VertexData ),
reinterpret_cast<char*>( &mVertex[0] ) + sizeof( Vector2f ) + sizeof( Vector2f ), alloc );
if ( !GLi->quadsSupported() ) {
@@ -538,7 +538,7 @@ void BatchRenderer::batchPoint( const Float& x, const Float& y,
addVertexs( 1 );
}
void BatchRenderer::batchPointList( const std::vector<eeVertex>& points,
void BatchRenderer::batchPointList( const std::vector<VertexData>& points,
const PrimitiveType& primitiveType ) {
setDrawMode( primitiveType, mForceBlendMode );
@@ -546,7 +546,7 @@ void BatchRenderer::batchPointList( const std::vector<eeVertex>& points,
addVertexs( points.size() );
memcpy( (void*)&mVertex[curNumVertex], (void*)&points[0], sizeof( eeVertex ) * points.size() );
memcpy( (void*)&mVertex[curNumVertex], (void*)&points[0], sizeof( VertexData ) * points.size() );
}
void BatchRenderer::linesBegin() {

View File

@@ -41,7 +41,7 @@ Renderer* GLi = NULL;
Renderer* Renderer::sSingleton = NULL;
Renderer* Renderer::createSingleton( EEGL_version ver ) {
Renderer* Renderer::createSingleton( GraphicsLibraryVersion ver ) {
#if !defined( EE_GLES1 ) && !defined( EE_GLES2 )
if ( GLv_default == ver )
ver = GLv_2;
@@ -288,7 +288,7 @@ bool Renderer::isExtension( const std::string& name ) {
#endif
}
bool Renderer::isExtension( EEGL_extensions name ) {
bool Renderer::isExtension( GraphicsLibraryExtension name ) {
return 0 != ( mExtensions & ( 1 << name ) );
}

View File

@@ -61,7 +61,7 @@ RendererGL::RendererGL() {
RendererGL::~RendererGL() {}
EEGL_version RendererGL::version() {
GraphicsLibraryVersion RendererGL::version() {
#ifndef EE_GLES1
return GLv_2;
#else

View File

@@ -47,7 +47,7 @@ RendererGL3::RendererGL3() :
RendererGL3::~RendererGL3() {}
EEGL_version RendererGL3::version() {
GraphicsLibraryVersion RendererGL3::version() {
return GLv_3;
}

View File

@@ -71,7 +71,7 @@ RendererGL3CP::~RendererGL3CP() {
#endif
}
EEGL_version RendererGL3CP::version() {
GraphicsLibraryVersion RendererGL3CP::version() {
return GLv_3CP;
}

View File

@@ -55,7 +55,7 @@ RendererGLES2::RendererGLES2() :
RendererGLES2::~RendererGLES2() {}
EEGL_version RendererGLES2::version() {
GraphicsLibraryVersion RendererGLES2::version() {
return GLv_ES2;
}

View File

@@ -9,7 +9,7 @@ namespace EE { namespace Graphics {
VertexBuffer* VertexBuffer::New( const Uint32& VertexFlags, PrimitiveType DrawType,
const Int32& ReserveVertexSize, const Int32& ReserveIndexSize,
EE_VBO_USAGE_TYPE UsageType ) {
VertexBufferUsageType UsageType ) {
if ( GLi->isExtension( EEGL_ARB_vertex_buffer_object ) )
return eeNew( VertexBufferVBO,
( VertexFlags, DrawType, ReserveVertexSize, ReserveIndexSize, UsageType ) );
@@ -21,22 +21,22 @@ VertexBuffer* VertexBuffer::New( const Uint32& VertexFlags, PrimitiveType DrawTy
VertexBuffer* VertexBuffer::NewVertexArray( const Uint32& VertexFlags, PrimitiveType DrawType,
const Int32& ReserveVertexSize,
const Int32& ReserveIndexSize,
EE_VBO_USAGE_TYPE UsageType ) {
VertexBufferUsageType UsageType ) {
return eeNew( VertexBufferOGL,
( VertexFlags, DrawType, ReserveVertexSize, ReserveIndexSize, UsageType ) );
}
VertexBuffer::VertexBuffer( const Uint32& VertexFlags, PrimitiveType DrawType,
const Int32& ReserveVertexSize, const Int32& ReserveIndexSize,
EE_VBO_USAGE_TYPE UsageType ) :
VertexBufferUsageType UsageType ) :
mVertexFlags( VertexFlags ), mDrawType( DrawType ), mUsageType( UsageType ), mElemDraw( -1 ) {
if ( ReserveVertexSize > 0 ) {
for ( Int32 i = 0; i < VERTEX_FLAGS_COUNT; i++ ) {
if ( VERTEX_FLAG_QUERY( mVertexFlags, i ) ) {
if ( i != VERTEX_FLAG_COLOR )
mVertexArray[i].reserve( ReserveVertexSize * eeVertexElements[i] );
mVertexArray[i].reserve( ReserveVertexSize * VertexElementCount[i] );
else
mColorArray.reserve( ReserveVertexSize * eeVertexElements[i] );
mColorArray.reserve( ReserveVertexSize * VertexElementCount[i] );
}
}
}
@@ -114,7 +114,7 @@ Uint32* VertexBuffer::getIndices() {
Uint32 VertexBuffer::getVertexCount() {
return (Uint32)mVertexArray[VERTEX_FLAG_POSITION].size() /
eeVertexElements[VERTEX_FLAG_POSITION];
VertexElementCount[VERTEX_FLAG_POSITION];
}
Uint32 VertexBuffer::getIndexCount() {
@@ -124,7 +124,7 @@ Uint32 VertexBuffer::getIndexCount() {
Vector2f VertexBuffer::getVector2( const Uint32& Type, const Uint32& Index ) {
eeASSERT( Type < VERTEX_FLAGS_COUNT_ARR && !VERTEX_FLAG_QUERY( mVertexFlags, Type ) )
Int32 pos = Index * eeVertexElements[Type];
Int32 pos = Index * VertexElementCount[Type];
return Vector2f( mVertexArray[Type][pos], mVertexArray[Type][pos + 1] );
}
@@ -132,7 +132,7 @@ Vector2f VertexBuffer::getVector2( const Uint32& Type, const Uint32& Index ) {
Color VertexBuffer::getColor( const Uint32& Index ) {
eeASSERT( !VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_COLOR ) );
Int32 pos = Index * eeVertexElements[VERTEX_FLAG_COLOR];
Int32 pos = Index * VertexElementCount[VERTEX_FLAG_COLOR];
return Color( mColorArray[pos], mColorArray[pos + 1], mColorArray[pos + 2],
mColorArray[pos + 3] );

View File

@@ -7,7 +7,7 @@ namespace EE { namespace Graphics {
VertexBufferOGL::VertexBufferOGL( const Uint32& VertexFlags, PrimitiveType DrawType,
const Int32& ReserveVertexSize, const Int32& ReserveIndexSize,
EE_VBO_USAGE_TYPE UsageType ) :
VertexBufferUsageType UsageType ) :
VertexBuffer( VertexFlags, DrawType, ReserveVertexSize, ReserveIndexSize, UsageType ) {}
void VertexBufferOGL::bind() {
@@ -43,8 +43,8 @@ void VertexBufferOGL::setVertexStates() {
GLi->clientActiveTexture( GL_TEXTURE0 + i );
GLi->enableClientState( GL_TEXTURE_COORD_ARRAY );
GLi->texCoordPointer( eeVertexElements[VERTEX_FLAG_TEXTURE0 + i], GL_FP,
sizeof( Float ) * eeVertexElements[VERTEX_FLAG_TEXTURE0 + i],
GLi->texCoordPointer( VertexElementCount[VERTEX_FLAG_TEXTURE0 + i], GL_FP,
sizeof( Float ) * VertexElementCount[VERTEX_FLAG_TEXTURE0 + i],
&mVertexArray[VERTEX_FLAG_TEXTURE0 + i][0], alloc );
} else {
if ( 0 == i ) {
@@ -57,8 +57,8 @@ void VertexBufferOGL::setVertexStates() {
} else {
if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_TEXTURE0 ) ) {
GLi->enableClientState( GL_TEXTURE_COORD_ARRAY );
GLi->texCoordPointer( eeVertexElements[VERTEX_FLAG_TEXTURE0], GL_FP,
sizeof( Float ) * eeVertexElements[VERTEX_FLAG_TEXTURE0],
GLi->texCoordPointer( VertexElementCount[VERTEX_FLAG_TEXTURE0], GL_FP,
sizeof( Float ) * VertexElementCount[VERTEX_FLAG_TEXTURE0],
&mVertexArray[VERTEX_FLAG_TEXTURE0][0], alloc );
} else {
GLi->disable( GL_TEXTURE_2D );
@@ -69,8 +69,8 @@ void VertexBufferOGL::setVertexStates() {
/// POSITION
if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_POSITION ) ) {
GLi->enableClientState( GL_VERTEX_ARRAY );
GLi->vertexPointer( eeVertexElements[VERTEX_FLAG_POSITION], GL_FP,
sizeof( Float ) * eeVertexElements[VERTEX_FLAG_POSITION],
GLi->vertexPointer( VertexElementCount[VERTEX_FLAG_POSITION], GL_FP,
sizeof( Float ) * VertexElementCount[VERTEX_FLAG_POSITION],
&mVertexArray[VERTEX_FLAG_POSITION][0], alloc );
} else {
GLi->disableClientState( GL_VERTEX_ARRAY );
@@ -79,8 +79,8 @@ void VertexBufferOGL::setVertexStates() {
/// COLOR
if ( VERTEX_FLAG_QUERY( mVertexFlags, VERTEX_FLAG_COLOR ) ) {
GLi->enableClientState( GL_COLOR_ARRAY );
GLi->colorPointer( eeVertexElements[VERTEX_FLAG_COLOR], GL_UNSIGNED_BYTE,
sizeof( Uint8 ) * eeVertexElements[VERTEX_FLAG_COLOR], &mColorArray[0],
GLi->colorPointer( VertexElementCount[VERTEX_FLAG_COLOR], GL_UNSIGNED_BYTE,
sizeof( Uint8 ) * VertexElementCount[VERTEX_FLAG_COLOR], &mColorArray[0],
allocC );
} else {
GLi->disableClientState( GL_COLOR_ARRAY );

View File

@@ -10,7 +10,7 @@ namespace EE { namespace Graphics {
VertexBufferVBO::VertexBufferVBO( const Uint32& VertexFlags, PrimitiveType DrawType,
const Int32& ReserveVertexSize, const Int32& ReserveIndexSize,
EE_VBO_USAGE_TYPE UsageType ) :
VertexBufferUsageType UsageType ) :
VertexBuffer( VertexFlags, DrawType, ReserveVertexSize, ReserveIndexSize, UsageType ),
mCompiled( false ),
mBuffersSet( false ),
@@ -64,9 +64,9 @@ bool VertexBufferVBO::compile() {
#endif
unsigned int usageType = GL_STATIC_DRAW;
if ( mUsageType == VBO_USAGE_TYPE_DYNAMIC )
if ( mUsageType == VertexBufferUsageType::Dynamic )
usageType = GL_DYNAMIC_DRAW;
else if ( mUsageType == VBO_USAGE_TYPE_STREAM )
else if ( mUsageType == VertexBufferUsageType::Stream )
usageType = GL_STREAM_DRAW;
// Create the VBO vertex arrays
@@ -193,12 +193,12 @@ void VertexBufferVBO::setVertexStates() {
EEGL_TEXTURE_COORD_ARRAY ) );
if ( -1 != index )
glVertexAttribPointerARB( index, eeVertexElements[VERTEX_FLAG_TEXTURE0 + i],
glVertexAttribPointerARB( index, VertexElementCount[VERTEX_FLAG_TEXTURE0 + i],
GL_FP, GL_FALSE, 0, 0 );
} else
#endif
{
GLi->texCoordPointer( eeVertexElements[VERTEX_FLAG_TEXTURE0 + i], GL_FP, 0,
GLi->texCoordPointer( VertexElementCount[VERTEX_FLAG_TEXTURE0 + i], GL_FP, 0,
(char*)NULL, 0 );
}
@@ -228,12 +228,12 @@ void VertexBufferVBO::setVertexStates() {
EEGL_TEXTURE_COORD_ARRAY ) );
if ( -1 != index )
glVertexAttribPointerARB( index, eeVertexElements[VERTEX_FLAG_TEXTURE0], GL_FP,
glVertexAttribPointerARB( index, VertexElementCount[VERTEX_FLAG_TEXTURE0], GL_FP,
GL_FALSE, 0, 0 );
} else
#endif
{
GLi->texCoordPointer( eeVertexElements[VERTEX_FLAG_TEXTURE0], GL_FP, 0, (char*)NULL,
GLi->texCoordPointer( VertexElementCount[VERTEX_FLAG_TEXTURE0], GL_FP, 0, (char*)NULL,
0 );
}
@@ -260,12 +260,12 @@ void VertexBufferVBO::setVertexStates() {
: GLi->getRendererGLES2()->getStateIndex( EEGL_VERTEX_ARRAY ) );
if ( -1 != index )
glVertexAttribPointerARB( index, eeVertexElements[VERTEX_FLAG_POSITION], GL_FP,
glVertexAttribPointerARB( index, VertexElementCount[VERTEX_FLAG_POSITION], GL_FP,
GL_FALSE, 0, 0 );
} else
#endif
{
GLi->vertexPointer( eeVertexElements[VERTEX_FLAG_POSITION], GL_FP, 0, (char*)NULL, 0 );
GLi->vertexPointer( VertexElementCount[VERTEX_FLAG_POSITION], GL_FP, 0, (char*)NULL, 0 );
}
} else {
GLi->disableClientState( GL_VERTEX_ARRAY );
@@ -285,12 +285,12 @@ void VertexBufferVBO::setVertexStates() {
: GLi->getRendererGLES2()->getStateIndex( EEGL_COLOR_ARRAY ) );
if ( -1 != index )
glVertexAttribPointerARB( index, eeVertexElements[VERTEX_FLAG_COLOR],
glVertexAttribPointerARB( index, VertexElementCount[VERTEX_FLAG_COLOR],
GL_UNSIGNED_BYTE, GL_TRUE, 0, 0 );
} else
#endif
{
GLi->colorPointer( eeVertexElements[VERTEX_FLAG_COLOR], GL_UNSIGNED_BYTE, 0,
GLi->colorPointer( VertexElementCount[VERTEX_FLAG_COLOR], GL_UNSIGNED_BYTE, 0,
(char*)NULL, 0 );
}
} else {
@@ -306,9 +306,9 @@ void VertexBufferVBO::setVertexStates() {
void VertexBufferVBO::update( const Uint32& Types, bool Indices ) {
unsigned int usageType = GL_STATIC_DRAW;
if ( mUsageType == VBO_USAGE_TYPE_DYNAMIC )
if ( mUsageType == VertexBufferUsageType::Dynamic )
usageType = GL_DYNAMIC_DRAW;
else if ( mUsageType == VBO_USAGE_TYPE_STREAM )
else if ( mUsageType == VertexBufferUsageType::Stream )
usageType = GL_STREAM_DRAW;
for ( Int32 i = 0; i < VERTEX_FLAGS_COUNT; i++ ) {

View File

@@ -5,11 +5,11 @@
namespace EE { namespace Window { namespace Backend {
class EE_API WindowBackend {
class EE_API WindowBackendLibrary {
public:
inline WindowBackend() {}
inline WindowBackendLibrary() {}
inline virtual ~WindowBackend() {}
inline virtual ~WindowBackendLibrary() {}
};
}}} // namespace EE::Window::Backend

View File

@@ -16,7 +16,7 @@
namespace EE { namespace Window { namespace Backend { namespace SDL2 {
WindowBackendSDL2::WindowBackendSDL2() : WindowBackend() {}
WindowBackendSDL2::WindowBackendSDL2() : WindowBackendLibrary() {}
WindowBackendSDL2::~WindowBackendSDL2() {
#if EE_PLATFORM != EE_PLATFORM_MACOSX

View File

@@ -11,7 +11,7 @@
namespace EE { namespace Window { namespace Backend { namespace SDL2 {
class EE_API WindowBackendSDL2 : public WindowBackend {
class EE_API WindowBackendSDL2 : public WindowBackendLibrary {
public:
WindowBackendSDL2();

View File

@@ -23,10 +23,10 @@
#endif
#if EE_PLATFORM == EE_PLATFORM_WIN
#include <Objbase.h>
#include <objbase.h>
#include <initguid.h>
#include <shellapi.h>
#include <tlhelp32.H>
#include <tlhelp32.h>
bool WindowsIsProcessRunning( const char* processName, bool killProcess = false ) {
bool exists = false;

View File

@@ -121,7 +121,7 @@ void Engine::destroy() {
mWindow = NULL;
}
Backend::WindowBackend* Engine::createSDL2Backend( const WindowSettings& Settings ) {
Backend::WindowBackendLibrary* Engine::createSDL2Backend( const WindowSettings& Settings ) {
#if defined( EE_SDL_VERSION_2 )
return eeNew( Backend::SDL2::WindowBackendSDL2, () );
#else
@@ -223,7 +223,7 @@ bool Engine::isRunning() const {
return NULL != mWindow;
}
Uint32 Engine::getDefaultBackend() const {
WindowBackend Engine::getDefaultBackend() const {
#if DEFAULT_BACKEND == BACKEND_SDL2
return WindowBackend::SDL2;
#endif
@@ -240,10 +240,11 @@ WindowSettings Engine::createWindowSettings( IniFile* ini, std::string iniKeyNam
bool Windowed = ini->getValueB( iniKeyName, "Windowed", true );
bool Resizeable = ini->getValueB( iniKeyName, "Resizeable", true );
bool Borderless = ini->getValueB( iniKeyName, "Borderless", false );
bool UseDesktopResolution = ini->getValueB( iniKeyName, "UseDesktopResolution", false );
bool useDesktopResolution = ini->getValueB( iniKeyName, "UseDesktopResolution", false );
std::string pixelDensityStr = ini->getValue( iniKeyName, "PixelDensity" );
float pixelDensity = PixelDensity::getPixelDensity();
bool useScreenKeyboard = ini->getValueB( iniKeyName, "UseScreenKeyboard" );
bool useScreenKeyboard =
ini->getValueB( iniKeyName, "UseScreenKeyboard", EE_SCREEN_KEYBOARD_ENABLED );
if ( !pixelDensityStr.empty() ) {
if ( String::toLower( pixelDensityStr ) == "auto" ) {
@@ -258,20 +259,20 @@ WindowSettings Engine::createWindowSettings( IniFile* ini, std::string iniKeyNam
}
}
std::string Backend = ini->getValue( iniKeyName, "Backend", "" );
Uint32 WinBackend = getDefaultBackend();
std::string backend = ini->getValue( iniKeyName, "Backend", "" );
WindowBackend winBackend = getDefaultBackend();
String::toLowerInPlace( Backend );
String::toLowerInPlace( backend );
if ( "sdl2" == Backend )
WinBackend = WindowBackend::SDL2;
if ( "sdl2" == backend )
winBackend = WindowBackend::SDL2;
Uint32 Style = WindowStyle::Titlebar;
if ( Borderless )
Style = WindowStyle::Borderless;
if ( UseDesktopResolution )
if ( useDesktopResolution )
Style |= WindowStyle::UseDesktopResolution;
if ( !Windowed )
@@ -283,7 +284,7 @@ WindowSettings Engine::createWindowSettings( IniFile* ini, std::string iniKeyNam
std::string Icon = ini->getValue( iniKeyName, "WinIcon", "" );
std::string Caption = ini->getValue( iniKeyName, "WinCaption", "" );
WindowSettings WinSettings( Width, Height, Caption, Style, WinBackend, BitColor, Icon,
WindowSettings WinSettings( Width, Height, Caption, Style, winBackend, BitColor, Icon,
pixelDensity, useScreenKeyboard );
return WinSettings;
@@ -305,7 +306,7 @@ ContextSettings Engine::createContextSettings( IniFile* ini, std::string iniKeyN
String::toLowerInPlace( GLVersion );
EEGL_version GLVer;
GraphicsLibraryVersion GLVer;
if ( "3" == GLVersion || "opengl 3" == GLVersion || "gl3" == GLVersion ||
"opengl3" == GLVersion )
GLVer = GLv_3;

View File

@@ -21,7 +21,7 @@ InputTextBuffer::InputTextBuffer( const bool& active, const bool& newLineEnabled
mFlags( 0 ),
mCallback( 0 ),
mPromptPos( 0 ),
mMaxLength( INPUT_LENGHT_MAX ),
mMaxLength( UINT32_MAX ),
mSelCurInit( -1 ),
mSelCurEnd( -1 ) {
if ( NULL == mWindow ) {
@@ -46,7 +46,7 @@ InputTextBuffer::InputTextBuffer( EE::Window::Window* window ) :
mFlags( 0 ),
mCallback( 0 ),
mPromptPos( 0 ),
mMaxLength( INPUT_LENGHT_MAX ),
mMaxLength( UINT32_MAX ),
mSelCurInit( -1 ),
mSelCurEnd( -1 ) {
if ( NULL == mWindow ) {
@@ -714,15 +714,15 @@ String InputTextBuffer::getBuffer() const {
}
bool InputTextBuffer::changedSinceLastUpdate() {
return 0 != ( mFlags & ( 1 << INPUT_TB_CHANGE_SINCE_LAST_UPDATE ) );
return 0 != ( mFlags & ( 1 << CHANGE_SINCE_LAST_UPDATE ) );
}
void InputTextBuffer::setChangedSinceLastUpdate( const bool& Changed ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_CHANGE_SINCE_LAST_UPDATE, Changed == true );
BitOp::writeBitKey( &mFlags, CHANGE_SINCE_LAST_UPDATE, Changed == true );
}
void InputTextBuffer::autoPrompt( const bool& set ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_PROMPT_AUTO_POS, set == true );
BitOp::writeBitKey( &mFlags, PROMPT_AUTO_POS, set == true );
if ( set ) {
mPromptPos = (int)mText.size();
@@ -732,60 +732,60 @@ void InputTextBuffer::autoPrompt( const bool& set ) {
}
bool InputTextBuffer::autoPrompt() {
return 0 != ( mFlags & ( 1 << INPUT_TB_PROMPT_AUTO_POS ) );
return 0 != ( mFlags & ( 1 << PROMPT_AUTO_POS ) );
}
bool InputTextBuffer::isActive() const {
return 0 != ( mFlags & ( 1 << INPUT_TB_ACTIVE ) );
return 0 != ( mFlags & ( 1 << ACTIVE ) );
}
void InputTextBuffer::setActive( const bool& active ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_ACTIVE, active == true );
BitOp::writeBitKey( &mFlags, ACTIVE, active == true );
}
bool InputTextBuffer::setSupportNewLine() {
return 0 != ( mFlags & ( 1 << INPUT_TB_SUPPORT_NEW_LINE ) );
return 0 != ( mFlags & ( 1 << SUPPORT_NEW_LINE ) );
}
void InputTextBuffer::isNewLineEnabled( const bool& enabled ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_SUPPORT_NEW_LINE, enabled == true );
BitOp::writeBitKey( &mFlags, SUPPORT_NEW_LINE, enabled == true );
}
void InputTextBuffer::setAllowOnlyNumbers( const bool& onlynums, const bool& allowdots ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_ALLOW_ONLY_NUMBERS, onlynums == true );
BitOp::writeBitKey( &mFlags, INPUT_TB_ALLOW_DOT_IN_NUMBERS, allowdots == true );
BitOp::writeBitKey( &mFlags, ALLOW_ONLY_NUMBERS, onlynums == true );
BitOp::writeBitKey( &mFlags, ALLOW_DOT_IN_NUMBERS, allowdots == true );
}
bool InputTextBuffer::onlyNumbersAllowed() {
return 0 != ( mFlags & ( 1 << INPUT_TB_ALLOW_ONLY_NUMBERS ) );
return 0 != ( mFlags & ( 1 << ALLOW_ONLY_NUMBERS ) );
}
bool InputTextBuffer::dotsInNumbersAllowed() {
return 0 != ( mFlags & ( 1 << INPUT_TB_ALLOW_DOT_IN_NUMBERS ) );
return 0 != ( mFlags & ( 1 << ALLOW_DOT_IN_NUMBERS ) );
}
bool InputTextBuffer::isFreeEditingEnabled() const {
return 0 != ( mFlags & ( 1 << INPUT_TB_FREE_EDITING ) );
return 0 != ( mFlags & ( 1 << FREE_EDITING ) );
}
void InputTextBuffer::setFreeEditing( const bool& enabled ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_FREE_EDITING, enabled == true );
BitOp::writeBitKey( &mFlags, FREE_EDITING, enabled == true );
}
void InputTextBuffer::supportCopyPaste( const bool& support ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_SUPPORT_COPY_PASTE, support == true );
BitOp::writeBitKey( &mFlags, SUPPORT_COPY_PASTE, support == true );
}
bool InputTextBuffer::supportCopyPaste() {
return 0 != ( mFlags & ( 1 << INPUT_TB_SUPPORT_COPY_PASTE ) );
return 0 != ( mFlags & ( 1 << SUPPORT_COPY_PASTE ) );
}
bool InputTextBuffer::isTextSelectionEnabled() {
return 0 != ( mFlags & ( 1 << INPUT_TB_TEXT_SELECTION_ENABLED ) );
return 0 != ( mFlags & ( 1 << TEXT_SELECTION_ENABLED ) );
}
void InputTextBuffer::setTextSelectionEnabled( const bool& enabled ) {
BitOp::writeBitKey( &mFlags, INPUT_TB_TEXT_SELECTION_ENABLED, enabled == true );
BitOp::writeBitKey( &mFlags, TEXT_SELECTION_ENABLED, enabled == true );
}
void InputTextBuffer::cursorToEnd() {