diff --git a/.gitignore b/.gitignore index 6482f96c..85bf8c49 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ libtool stamp-* *-stamp lolengine-*.tar.* +test-suite.log # Personal stuff patch-*.diff # Debugging cruft @@ -96,4 +97,6 @@ doc/doxygen.log doc/html doc/latex doc/man - +# Our test suites +test/testsuite.log +test/testsuite.trs diff --git a/demos/tutorial/07_input.cpp b/demos/tutorial/07_input.cpp index 17c793ae..e3127132 100644 --- a/demos/tutorial/07_input.cpp +++ b/demos/tutorial/07_input.cpp @@ -121,7 +121,7 @@ public: m_text->SetText("no mouse detected"); } - mat4 anim = mat4::rotate(m_yaw_angle, vec3(0, 1, 0)) * mat4::rotate(m_pitch_angle, vec3(1, 0, 0)); + mat4 anim = mat4::fromeuler_yxz(m_yaw_angle, m_pitch_angle, 0.f); mat4 model = mat4::translate(vec3(0, 0, -4.5)); mat4 view = mat4::lookat(vec3(0, 2, 0), vec3(0, 0, -4), vec3(0, 1, 0)); mat4 proj = mat4::perspective(45.0f, 640.0f, 480.0f, 0.1f, 10.0f); diff --git a/demos/tutorial/Makefile.am b/demos/tutorial/Makefile.am index b4b206e6..c8566a05 100644 --- a/demos/tutorial/Makefile.am +++ b/demos/tutorial/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/autotools/common.am noinst_PROGRAMS = 01_triangle 02_cube 03_noise 04_texture 05_easymesh \ - 06_sprite 08_fbo 11_fractal \ + 06_sprite 07_input 08_fbo 11_fractal \ 12_voronoi 01_triangle_SOURCES = 01_triangle.cpp 01_triangle.lolfx diff --git a/src/Makefile.am b/src/Makefile.am index ff756141..c0cdd6fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -84,6 +84,8 @@ liblolcore_sources = \ input/input.cpp input/input.h \ input/keyboard.cpp input/keyboard.h \ input/stick.cpp input/stick.h \ + input/inputdevice.cpp input/inputdevice.h input/inputdevice_internal.h \ + input/controller.cpp input/controller.h \ \ gpu/defaultmaterial.lolfx \ gpu/tile.lolfx gpu/line.lolfx \ diff --git a/src/eglapp.cpp b/src/eglapp.cpp index 2e360e3f..a0c5d1e3 100644 --- a/src/eglapp.cpp +++ b/src/eglapp.cpp @@ -251,7 +251,11 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : # endif # if defined USE_SDL +# if defined LOL_INPUT_V2 + new SdlInput(res.x, res.y, data->screen_size.x, data->screen_size.y); +# else new SdlInput(); +# endif # endif /* Initialise everything */ diff --git a/src/input/controller.cpp b/src/input/controller.cpp index d488c82c..aea78275 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -8,14 +8,14 @@ // http://www.wtfpl.net/ for more details. // -#ifdef LOL_INPUT_V2 - #if defined HAVE_CONFIG_H # include "config.h" #endif #include "core.h" +#ifdef LOL_INPUT_V2 + namespace lol { diff --git a/src/input/controller.h b/src/input/controller.h index f7774b46..37baa190 100644 --- a/src/input/controller.h +++ b/src/input/controller.h @@ -11,17 +11,17 @@ #if !defined __LOL_INPUT_CONTROLLER_H__ #define __LOL_INPUT_CONTROLLER_H__ -#if defined LOL_INPUT_V2 - #include "core.h" +#if defined LOL_INPUT_V2 + namespace lol { class KeyBinding { public: - KeyBinding() : m_current(false), m_previous(false), m_device(nullptr) {} + KeyBinding() : m_device(nullptr), m_current(false), m_previous(false) {} bool IsDown() const { return m_current; } bool IsUp() const { return !m_current; } @@ -44,7 +44,7 @@ protected: class AxisBinding { public: - AxisBinding() : m_current(0.0f), m_previous(0.0f), m_device(nullptr) {} + AxisBinding() : m_device(nullptr), m_current(0.0f), m_previous(0.0f) {} float GetValue() const { return m_current; } float GetDelta() const { return m_current - m_previous; } diff --git a/src/input/input.cpp b/src/input/input.cpp index 4dbeb228..c0cd8c65 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -8,7 +8,6 @@ // http://www.wtfpl.net/ for more details. // -#ifndef LOL_INPUT_V2 #if defined HAVE_CONFIG_H # include "config.h" @@ -18,6 +17,8 @@ #include "core.h" +#ifndef LOL_INPUT_V2 + namespace lol { diff --git a/src/input/input.h b/src/input/input.h index 5eb3b3d2..4d9eb84c 100644 --- a/src/input/input.h +++ b/src/input/input.h @@ -16,13 +16,13 @@ #if !defined __LOL_INPUT_INPUT_H__ #define __LOL_INPUT_INPUT_H__ -#ifndef LOL_INPUT_V2 - #include #include #include "core.h" +#ifndef LOL_INPUT_V2 + #include "lol/math/vector.h" #include "input/keyboard.h" #include "input/stick.h" diff --git a/src/input/inputdevice.cpp b/src/input/inputdevice.cpp index 7ff3e4cc..b944e526 100644 --- a/src/input/inputdevice.cpp +++ b/src/input/inputdevice.cpp @@ -8,14 +8,14 @@ // http://www.wtfpl.net/ for more details. // -#ifdef LOL_INPUT_V2 - #if defined HAVE_CONFIG_H # include "config.h" #endif #include "core.h" +#ifdef LOL_INPUT_V2 + #include "input/inputdevice_internal.h" namespace lol diff --git a/src/input/inputdevice.h b/src/input/inputdevice.h index ab78d8c7..4e7434d5 100644 --- a/src/input/inputdevice.h +++ b/src/input/inputdevice.h @@ -11,10 +11,10 @@ #if !defined __LOL_INPUT_DEVICE_H__ #define __LOL_INPUT_DEVICE_H__ -#if defined LOL_INPUT_V2 - #include "core.h" +#if defined LOL_INPUT_V2 + namespace lol { diff --git a/src/input/inputdevice_internal.h b/src/input/inputdevice_internal.h index 2e47265c..66d0d439 100644 --- a/src/input/inputdevice_internal.h +++ b/src/input/inputdevice_internal.h @@ -11,10 +11,10 @@ #if !defined __LOL_INPUT_DEVICE_INTERNAL_H__ #define __LOL_INPUT_DEVICE_H__ -#if defined LOL_INPUT_V2 - #include "core.h" +#if defined LOL_INPUT_V2 + namespace lol { diff --git a/src/input/keyboard.cpp b/src/input/keyboard.cpp index b2b384d3..96085c48 100644 --- a/src/input/keyboard.cpp +++ b/src/input/keyboard.cpp @@ -8,8 +8,6 @@ // http://www.wtfpl.net/ for more details. // -#ifndef LOL_INPUT_V2 - #if defined HAVE_CONFIG_H # include "config.h" #endif @@ -18,6 +16,8 @@ #include "core.h" +#ifndef LOL_INPUT_V2 + namespace lol { diff --git a/src/input/keyboard.h b/src/input/keyboard.h index e9e8358c..49f5ed3f 100644 --- a/src/input/keyboard.h +++ b/src/input/keyboard.h @@ -16,10 +16,10 @@ #if !defined __LOL_INPUT_KEYBOARD_H__ #define __LOL_INPUT_KEYBOARD_H__ -#ifndef LOL_INPUT_V2 - #include "entity.h" +#ifndef LOL_INPUT_V2 + namespace lol { diff --git a/src/input/stick.cpp b/src/input/stick.cpp index 05fee2d4..8d33e545 100644 --- a/src/input/stick.cpp +++ b/src/input/stick.cpp @@ -8,8 +8,6 @@ // http://www.wtfpl.net/ for more details. // -#ifndef LOL_INPUT_V2 - #if defined HAVE_CONFIG_H # include "config.h" #endif @@ -18,6 +16,8 @@ #include "core.h" +#ifndef LOL_INPUT_V2 + namespace lol { diff --git a/src/input/stick.h b/src/input/stick.h index da5c64a4..7bbc6785 100644 --- a/src/input/stick.h +++ b/src/input/stick.h @@ -16,10 +16,10 @@ #if !defined __LOL_INPUT_STICK_H__ #define __LOL_INPUT_STICK_H__ -#ifndef LOL_INPUT_V2 - #include "entity.h" +#ifndef LOL_INPUT_V2 + namespace lol {