Skip to content

Commit 8aaf250

Browse files
committed
first commit
0 parents  commit 8aaf250

File tree

198 files changed

+47913
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+47913
-0
lines changed

CMakeLists.txt

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
cmake_minimum_required(VERSION 2.8)
2+
3+
# define a macro that helps defining an option
4+
macro(lxgui_set_option var default type docstring)
5+
if(NOT DEFINED ${var})
6+
set(${var} ${default})
7+
endif()
8+
set(${var} ${${var}} CACHE ${type} ${docstring} FORCE)
9+
endmacro()
10+
11+
# set defaults
12+
# this has to be done before the project() instruction!
13+
lxgui_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
14+
lxgui_set_option(LXGUI_BUILD_GUI_GL_IMPL TRUE BOOL "Build the OpenGL gui implementation")
15+
lxgui_set_option(LXGUI_BUILD_INPUT_SFML_IMPL TRUE BOOL "Build the SFML input implementation")
16+
lxgui_set_option(LXGUI_BUILD_INPUT_GLFW_IMPL TRUE BOOL "Build the GLFW input implementation")
17+
lxgui_set_option(LXGUI_BUILD_INPUT_OIS_IMPL TRUE BOOL "Build the OIS input implementation")
18+
lxgui_set_option(LXGUI_BUILD_TEST TRUE BOOL "Build the test program")
19+
20+
# project name
21+
project(lxgui)
22+
23+
# setup version numbers
24+
set(VERSION_MAJOR 1)
25+
set(VERSION_MINOR 1)
26+
27+
# check compiler version for C++11 features
28+
if(CMAKE_COMPILER_IS_GNUCXX)
29+
add_definitions(-Wall)
30+
add_definitions(-O2)
31+
if(CMAKE_BUILD_TYPE MATCHES Debug)
32+
add_definitions(-g)
33+
endif()
34+
35+
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
36+
OUTPUT_VARIABLE GCC_VERSION)
37+
38+
string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION})
39+
list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR)
40+
list(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR)
41+
set(GCC_VERSION ${GCC_MAJOR}.${GCC_MINOR})
42+
43+
if(GCC_VERSION VERSION_EQUAL 4.6)
44+
message(STATUS "gcc version >= 4.6 (${GCC_VERSION})")
45+
add_definitions(-std=c++0x)
46+
elseif(GCC_VERSION VERSION_GREATER 4.6)
47+
message(STATUS "gcc version >= 4.6 (${GCC_VERSION})")
48+
add_definitions(-std=c++11)
49+
else()
50+
message(ERROR ": lxgui requires advanced features from the C++11 norm that are only available with gcc 4.6 or higher (your version: ${GCC_VERSION}). Please upgrade your compiler.")
51+
endif()
52+
elseif(MSVC)
53+
add_definitions(/DMSVC)
54+
add_definitions(/W4)
55+
add_definitions(/GR)
56+
add_definitions(/EHs)
57+
add_definitions(/O2)
58+
if(CMAKE_BUILD_TYPE MATCHES Debug)
59+
add_definitions(/Zi)
60+
endif()
61+
62+
if(MSVC_VERSION VERSION_EQUAL 1600)
63+
add_definitions(/DNO_CPP11_EXPLICIT_CONV)
64+
add_definitions(/DNO_CPP11_DELETE_FUNCTION)
65+
add_definitions(/DNO_CPP11_FUNCTION_TEMPLATE_DEFAULT)
66+
add_definitions(/DNO_CPP11_CONSTEXPR)
67+
add_definitions(/DNO_CPP11_UNICODE_LITTERAL)
68+
add_definitions(/D_CRT_SECURE_NO_DEPRECATE)
69+
message(STATUS "Using MSVC 2010: some C++11 features are not supported by this compiler. Workarounds are used but never perfectly mimic the C++11 code.")
70+
elseif(MSVC_VERSION VERSION_GREATER 1600)
71+
add_definitions(/DNO_CPP11_EXPLICIT_CONV)
72+
add_definitions(/DNO_CPP11_DELETE_FUNCTION)
73+
add_definitions(/DNO_CPP11_FUNCTION_TEMPLATE_DEFAULT)
74+
add_definitions(/DNO_CPP11_CONSTEXPR)
75+
add_definitions(/DNO_CPP11_UNICODE_LITTERAL)
76+
add_definitions(/D_CRT_SECURE_NO_DEPRECATE)
77+
message(STATUS "Using MSVC > 2010: some C++11 features are not supported by this compiler. Workarounds are used but never perfectly mimic the C++11 code.")
78+
else()
79+
message(ERROR ": lxgui requires advanced features from the C++11 norm that are only available with MSVC 2010 or higher (your version: ${MSVC_VERSION}). Please upgrade your compiler.")
80+
endif()
81+
else()
82+
message(STATUS "Warning: your compiler has not been setup by the CMake script, do not expect it to work")
83+
endif()
84+
85+
# set OS preprocessor defines
86+
if (UNIX)
87+
add_definitions(-DLINUX)
88+
endif()
89+
if (WINDOWS)
90+
add_definitions(-DWIN32)
91+
endif()
92+
93+
# find libraries
94+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
95+
find_package(Lua51 REQUIRED)
96+
find_package(Freetype)
97+
find_package(PNG)
98+
find_package(ZLIB)
99+
find_package(GLFW)
100+
find_package(SFML 2 COMPONENTS system window)
101+
find_package(GLEW)
102+
find_package(OpenGL)
103+
find_package(OIS)
104+
105+
# add the subdirectories
106+
add_subdirectory(utils)
107+
add_subdirectory(xml)
108+
add_subdirectory(luapp)
109+
add_subdirectory(gui)
110+
if(LXGUI_BUILD_GUI_GL_IMPL)
111+
if(OPENGL_FOUND AND GLEW_FOUND AND FREETYPE_FOUND AND PNG_FOUND AND ZLIB_FOUND)
112+
add_subdirectory(gui/impl/gui/gl)
113+
else()
114+
message(ERROR ": the OpenGL implementation of the GUI requires OpenGL, GLEW, freetype, libpng and zlib")
115+
set(LXGUI_BUILD_GUI_GL_IMPL FALSE)
116+
endif()
117+
endif()
118+
if(LXGUI_BUILD_INPUT_GLFW_IMPL)
119+
if(GLFW_FOUND)
120+
add_subdirectory(gui/impl/input/glfw)
121+
else()
122+
message(ERROR ": the GLFW implementation of the input requires the GLFW library")
123+
set(LXGUI_BUILD_INPUT_GLFW_IMPL FALSE)
124+
endif()
125+
endif()
126+
if(LXGUI_BUILD_INPUT_SFML_IMPL)
127+
if(SFML_FOUND)
128+
add_subdirectory(gui/impl/input/sfml)
129+
else()
130+
message(ERROR ": the SFML implementation of the input requires the SFML library")
131+
set(LXGUI_BUILD_INPUT_SFML_IMPL FALSE)
132+
endif()
133+
endif()
134+
if(LXGUI_BUILD_INPUT_OIS_IMPL)
135+
if(OIS_FOUND)
136+
add_subdirectory(gui/impl/input/ois)
137+
else()
138+
message(ERROR ": the OIS implementation of the input requires the OIS library")
139+
set(LXGUI_BUILD_INPUT_OIS_IMPL FALSE)
140+
endif()
141+
endif()
142+
if(LXGUI_BUILD_TEST)
143+
if(OPENGL_FOUND AND GLEW_FOUND AND FREETYPE_FOUND AND PNG_FOUND AND ZLIB_FOUND AND SFML_FOUND)
144+
add_subdirectory(gui/test)
145+
else()
146+
message(ERROR ": the test program requires OpenGL, GLEW, freetype, libpng, zlib and SFML.")
147+
endif()
148+
endif()
149+

changelog.txt

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
v1.2.0:
2+
- added support for MSVC 2010
3+
- gui: added the quad2<T> type
4+
- gui::layer: added missing default constructor
5+
- gui::text, gui::font_string, gui::edit_box: cleaned some UTF8 to unicode conversions
6+
- gui::manager: fixed bug when parsing empty lines in toc files
7+
- xml::document: fixed bug with multiline comments
8+
- various fixes detected by MSVC
9+
10+
v1.1.6:
11+
- colors can now be given with the standard '#RRGGBB[AA]' format (both in C++ and XML/Lua)
12+
- gui::color: added hue/luminosity/saturation operations and istream >> operator
13+
14+
v1.1.5:
15+
- gui::texture: added texture filtering mode (none or linear)
16+
17+
v1.1.4:
18+
- gui: uiobject types should now have a CLASS_NAME static member containing the class name
19+
- gui::frame: create_child() and create_region() can now have a template argument to cast their return value
20+
- gui::manager: create_frame() can now have a template argument to cast its return value
21+
- gui::manager: added new versions of register_frame_type() and register_region_type()
22+
- note: the older versions of the above two are deprecated (will be removed in the future)
23+
- replaced remaining "can't", "couldn't", "doesn't" in error messages
24+
- test: now also displaying the C++ created frames by default (check of the recent template stuff)
25+
26+
v1.1.3:
27+
- gui::event::get() now has a template version, shortcut to the underlying lua::var
28+
- lua: improved performances of lua::var
29+
30+
v1.1.2:
31+
- replaced "can't" by "cannot" in error messages
32+
33+
v1.1.1:
34+
- gui::frame: get_child() and get_region() can now have a template argument to cast their return value
35+
- gui::frame: the above two functions can now find objects with their relative names
36+
- gui::uiobject: added set_abs_dimensions() and set_rel_dimensions()
37+
38+
v1.1.0:
39+
- added Findlxgui.cmake helper to locate the library with CMake
40+
- changed the version number of the library to 1.1 in the CMake scripts (for future release)
41+
- added the lxgui.hpp file (contains the version number of the library)
42+
43+
v1.0.32:
44+
- added CMake build scripts
45+
46+
v1.0.31:
47+
- fixed 64bit build
48+
- input: fixed GLFW Linux implementation
49+
- gui::slider: fixed uninitialized variable
50+
51+
v1.0.29:
52+
- gui::frame: can now use std::function as script handler
53+
- gui::backdrop: can now change vertex color
54+
- gui::uiobject: the last two arguments of set_abs_point() and set_rel_point() are now optional (default: 0)
55+
56+
v1.0.28:
57+
- input: SFML and GLFW implementations now provide mouse delta information
58+
59+
v1.0.27:
60+
- gui::manager: fixed const-correctness of render_ui()
61+
62+
v1.0.26:
63+
- updating parts of the code to use C++11
64+
65+
v1.0.25:
66+
- input: renamed the GLFW implementation from input_glfw to input_glfw2 (anticipating the release of GLFW3)
67+
68+
v1.0.24:
69+
- input: added a new implementation for GLFW (not fully functional: no keyboard layout independence input and no mouse grab)
70+
71+
v1.0.23:
72+
- input: fixed Windows code of the SFML input handler
73+
74+
v1.0.22:
75+
- input: implemented mouse wheel for the SFML handler
76+
- input: renamed input::sfml_handler::on_text_entered() to a more generic on_sfml_event()
77+
- gui::edit_box: fixed focus not always being removed when hiding an edit_box
78+
- gui::manager: removed a remaining reference to gui::locale
79+
80+
v1.0.21:
81+
- input: fixed outputting the 'A' key press when an unkown key is pressed for the SFML handler (fix from SFML)
82+
83+
v1.0.20:
84+
- input: improved the output of get_key_name() for the SFML handler (names will still always be in english though)
85+
- gui test: removed virtual build targets from the code::blocks project file
86+
87+
v1.0.19: (warning: API breaking update)
88+
- input: removed the locale class (now useless, see below)
89+
- input: added a way to get system interpreted keyboard characters
90+
- input: get_key_name() is now implementation dependent
91+
- input: to be fully functional, the SFML handler now needs to be notified of window events (see the test application)
92+
- input: mouse grab is not a feature required for all input handlers (added implementation for OIS handler)
93+
- gui: fixed class names in lua::functions not being capitalized
94+
- gui: added missing "reverse" flag to StatusBar
95+
- gui::edit_box: updated to use the new key localization system
96+
- gui::manager: fixed saved variables directory not being created
97+
- gui::manager: now using lower case folders by default
98+
- lua: improved exception message when casting a lua::var to a wrong type
99+
- utils: fixed make_directory() when some directories already extist
100+
101+
v1.0.18:
102+
- using std::ifstream and std::ofstream instead of std::fstream all the time
103+
- input: updated the SFML handler to the lastest SFML 2.0 snapshot
104+
- gui::manager: fixed bug with windows line endings when reading addons.txt
105+
106+
v1.0.17:
107+
- input: implemented mouse grab in SFML handler (toggle_mouse_grab())
108+
- input: added a get_impl() method to input::handler
109+
110+
v1.0.16:
111+
- input: fixed some input data not being properly updated when using manually updated input::handlers
112+
- input: fixed focus not being properly removed when calling set_focus(false)
113+
- gui::focus_frame: fixed set_focus(false) removing any focus even if the frame wasn't focused in the first place
114+
- gui::manager: fixed request_focus() doing useless work if the requested focus is already focused
115+
116+
v1.0.15:
117+
- input: fixed SFML handler not giving mouse position relative to the window, but to the desktop
118+
- input: fixed wrong logic in input::manager::force_input_allowed()
119+
- gui::frame: using std::set instead of std::map (redundant information)
120+
- gui::edit_box: added missing "positive" and "integer" parameters to the UI XML definition file
121+
- gui::anchor: removed useless warning when an anchor has no parent
122+
- lua: added lua::state::push_userdata() and lua::state::get_userdata()
123+
- lua: fixed const correctness of lua::var::operator!=()
124+
- utils: addded utils::make_directory()
125+
126+
v1.0.14:
127+
- input: added screen relative mouse movement
128+
- utils: added uchar typedef
129+
- utils: ustring (unicode string) is now using char32_t instead of unsiged int interally
130+
- gui test: added an accentuated character to check that unicode characters are properly displayed
131+
132+
v1.0.13:
133+
- improved doxygen documentation for disk usage (not using directories)
134+
135+
v1.0.12:
136+
- made lua::state, lua::function and lua::argument explictely non copiable classes
137+
138+
v1.0.11:
139+
- fixed new render strata not being rendered when caching is enabled
140+
141+
v1.0.10:
142+
- fixed STRATA_HIGH being misspelled as STRATA_HPPIGH (careless find & replace)
143+
- removed old and unused code in gui::backdrop
144+
145+
v1.0.9:
146+
- fixed input::manager::mouse_last_dragged() not working
147+
148+
v1.0.8:
149+
- fixed code::blocks project files
150+
151+
v1.0.7:
152+
- fixed bug introduced in last version (uninitialized variable)
153+
154+
v1.0.6:
155+
- fixed badly formatted error message in xml library
156+
157+
v1.0.5:
158+
- fixed missing documentation for input::handler and input::handler_impl
159+
- added a "manually updated" flag to input::handler, so that is can be shared by several input::managers (hence several gui::managers)
160+
161+
v1.0.4:
162+
- changed the project's directory structure
163+
- fixed missing constructor and destructor for gui::strata
164+
165+
v1.0.3:
166+
- changed licence from GPL to LGPL
167+
168+
v1.0.0:
169+
- first version

cmake/Modules/FindGLEW.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Try to find GLEW. Once done, this will define:
2+
#
3+
# GLEW_FOUND - variable which returns the result of the search
4+
# GLEW_INCLUDE_DIRS - list of include directories
5+
# GLEW_LIBRARIES - options for the linker
6+
7+
find_package(PkgConfig)
8+
pkg_check_modules(PC_GLEW QUIET glew)
9+
10+
find_path(GLEW_INCLUDE_DIR
11+
GL/glew.h
12+
HINTS ${PC_GLEW_INCLUDEDIR} ${PC_GLEW_INCLUDE_DIRS}
13+
)
14+
find_library(GLEW_LIBRARY
15+
GLEW
16+
HINTS ${PC_GLEW_LIBDIR} ${PC_GLEW_LIBRARY_DIRS}
17+
)
18+
19+
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
20+
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
21+
22+
include(FindPackageHandleStandardArgs)
23+
find_package_handle_standard_args(GLEW DEFAULT_MSG
24+
GLEW_INCLUDE_DIR
25+
GLEW_LIBRARY
26+
)
27+
28+
mark_as_advanced(
29+
GLEW_INCLUDE_DIR
30+
GLEW_LIBRARY
31+
)

0 commit comments

Comments
 (0)