From 717bd1c24802d67a7d5226f1137d9b32b21c62ee Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Thu, 13 Jul 2017 05:29:54 -0400 Subject: [PATCH] Fixed typo. Added comments about GLFW 3.3 controller support. (#18064) --- cocos/base/CCController-linux-win32.cpp | 14 ++++++++++++++ cocos/base/CCController.h | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cocos/base/CCController-linux-win32.cpp b/cocos/base/CCController-linux-win32.cpp index c6eba3655a..bec6d8bfeb 100644 --- a/cocos/base/CCController-linux-win32.cpp +++ b/cocos/base/CCController-linux-win32.cpp @@ -42,6 +42,15 @@ class CC_DLL ControllerImpl ControllerImpl() { + //FIXME: Once GLFW 3.3 is bundled with cocos2d-x and no extra + //controllers have been added here, remove all the code here. If + //extra controllers were added, make sure to add them to the SDL + //Controller Database at + //https://github.com/gabomdq/SDL_GameControllerDB which GLFW uses + //for providing the new gamepad API. We are going to map the GLFW + //game pad events to Controller::Key key codes. + + // Note: the controllers input profile were taken from the // RetroArch joypad autoconfig project at: // https://github.com/libretro/retroarch-joypad-autoconfig/tree/master/udev @@ -4854,6 +4863,11 @@ class CC_DLL ControllerImpl } private: + //FIXME: Once GLFW 3.3 is bundled with cocos2d-x, remove these + //controller profiles and all the related code. We will only need to + //provide a mapping from the GLFW gamepad key codes to the + //Controller::Key keycodes. So far an std::unordered_map + //should suffice. static std::map, std::unordered_map > > s_controllerProfiles; }; diff --git a/cocos/base/CCController.h b/cocos/base/CCController.h index e1068b0af3..282732468f 100644 --- a/cocos/base/CCController.h +++ b/cocos/base/CCController.h @@ -220,10 +220,14 @@ private: EventController *_axisEvent; #if ( CC_TARGET_PLATFORM == CC_PLATFORM_LINUX || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 ) + //FIXME: Once GLFW 3.3 is bundled with cocos2d-x, remove these unordered + //maps. They won't be needed. We will only need to provide a mapping from + //the GLFW gamepad key codes to the Controller::Key. + // Attach the controller profiles from CCController-linux-win32.cpp to each // of the Controller variables in order to minimize profile lookup time. - // Note: this increases memory usage unecessarily since the same maps are + // Note: this increases memory usage unnecessarily since the same maps are // already stored on ControllerImpl within the static member variable // "s_controllerProfiles", but on these platforms the increase in memory // usage is negligible. Peformance over memory optimization was