Просмотр исходного кода

Merge branch 'master' of github.com:taylor001/crown

Daniele Bartolini 10 лет назад
Родитель
Сommit
10c571f998
4 измененных файлов с 16 добавлено и 29 удалено
  1. 1 17
      genie/crown.lua
  2. 1 1
      src/device.cpp
  3. 11 10
      src/input/input_manager.cpp
  4. 3 1
      src/input/input_manager.h

+ 1 - 17
genie/crown.lua

@@ -20,7 +20,6 @@ function crown_project(_name, _kind, _defines)
 			CROWN_DIR .. "src/core/math",
 			CROWN_DIR .. "src/core/memory",
 			CROWN_DIR .. "src/core/network",
-			CROWN_DIR .. "src/core/settings",
 			CROWN_DIR .. "src/core/strings",
 			CROWN_DIR .. "src/core/thread",
 			CROWN_DIR .. "src/input",
@@ -130,22 +129,7 @@ function crown_project(_name, _kind, _defines)
 				CROWN_DIR .. "third/openal/include"
 			}
 
-			-- Fix this in GENie
-			configuration { "debug", "x32", "linux-*" }
-				linkoptions { "-Lbin/debug", "-lopenal-debug-32", }
-			configuration { "development", "x32", "linux-*" }
-				linkoptions { "-Lbin/debug", "-lopenal-development-32", }
-			configuration { "release", "x32", "linux-*" }
-				linkoptions { "-Lbin/debug", "-lopenal-release-32", }
-			configuration { "debug", "x64", "linux-*" }
-				linkoptions { "-Lbin/debug", "-lopenal-debug-64", }
-			configuration { "development", "x64", "linux-*" }
-				linkoptions { "-Lbin/debug", "-lopenal-development-64", }
-			configuration { "release", "x64", "linux-*" }
-				linkoptions { "-Lbin/debug", "-lopenal-release-64", }
-
-			configuration { "vs*" }
-				links { "openal", }
+			links { "openal" }
 
 			configuration {}
 		end

+ 1 - 1
src/device.cpp

@@ -86,7 +86,7 @@ void Device::init()
 
 	read_config();
 
-	_input_manager = CE_NEW(_allocator, InputManager)();
+	_input_manager = CE_NEW(_allocator, InputManager)(default_allocator());
 
 	bgfx::init(bgfx::RendererType::Count
 		, BGFX_PCI_ID_NONE

+ 11 - 10
src/input/input_manager.cpp

@@ -157,26 +157,27 @@ static const char* s_pad_axis_names[] =
 };
 CE_STATIC_ASSERT(CE_COUNTOF(s_pad_axis_names) == JoypadAxis::COUNT);
 
-InputManager::InputManager()
-	: _keyboard(NULL)
+InputManager::InputManager(Allocator& a)
+	: _allocator(&a)
+	, _keyboard(NULL)
 	, _mouse(NULL)
 	, _touch(NULL)
 {
-	_keyboard = InputDevice::create(default_allocator()
+	_keyboard = InputDevice::create(*_allocator
 		, "Keyboard"
 		, KeyboardButton::COUNT
 		, 0
 		, s_keyboard_button_names
 		, NULL
 		);
-	_mouse = InputDevice::create(default_allocator()
+	_mouse = InputDevice::create(*_allocator
 		, "Mouse"
 		, MouseButton::COUNT
 		, MouseAxis::COUNT
 		, s_mouse_button_names
 		, s_mouse_axis_names
 		);
-	_touch = InputDevice::create(default_allocator()
+	_touch = InputDevice::create(*_allocator
 		, "Touch"
 		, TouchButton::COUNT
 		, 0
@@ -186,7 +187,7 @@ InputManager::InputManager()
 
 	for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
 	{
-		_joypad[i] = InputDevice::create(default_allocator()
+		_joypad[i] = InputDevice::create(*_allocator
 			, "Joypad"
 			, JoypadButton::COUNT
 			, JoypadAxis::COUNT
@@ -203,11 +204,11 @@ InputManager::InputManager()
 InputManager::~InputManager()
 {
 	for (uint8_t i = 0; i < CROWN_MAX_JOYPADS; ++i)
-		InputDevice::destroy(default_allocator(), _joypad[i]);
+		InputDevice::destroy(*_allocator, _joypad[i]);
 
-	InputDevice::destroy(default_allocator(), _touch);
-	InputDevice::destroy(default_allocator(), _mouse);
-	InputDevice::destroy(default_allocator(), _keyboard);
+	InputDevice::destroy(*_allocator, _touch);
+	InputDevice::destroy(*_allocator, _mouse);
+	InputDevice::destroy(*_allocator, _keyboard);
 }
 
 InputDevice* InputManager::keyboard()

+ 3 - 1
src/input/input_manager.h

@@ -8,6 +8,7 @@
 #include "config.h"
 #include "types.h"
 #include "input_types.h"
+#include "memory_types.h"
 
 namespace crown
 {
@@ -19,7 +20,7 @@ class InputManager
 {
 public:
 
-	InputManager();
+	InputManager(Allocator& a);
 	~InputManager();
 
 	/// Returns the default keyboard input device.
@@ -42,6 +43,7 @@ public:
 
 private:
 
+	Allocator* _allocator;
 	InputDevice* _keyboard;
 	InputDevice* _mouse;
 	InputDevice* _touch;