Skip to content

Commit

Permalink
aaaaah: removed GAINPUT, glfw works too, it even works with my PS4 co…
Browse files Browse the repository at this point in the history
…ntroller
  • Loading branch information
andreasdr committed Nov 4, 2023
1 parent a39f904 commit 5364632
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 169 deletions.
12 changes: 0 additions & 12 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -460,18 +460,6 @@ Third party library licenses:
https://www.freetype.org


ext/gainput-1.0.0/LICENSE
---------------------------

Copyright (c) 2013-2017 Johannes Kuhlmann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


ext/glfw3/LICENSE
-------------------

Expand Down
41 changes: 2 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ SRCS_PLATFORM =
CPPVERSION = -std=c++2a
OFLAGS =
EXTRAFLAGS = -DRAPIDJSON_HAS_STDSTRING
INCLUDES = -Isrc -Iext -I. -Iext/reactphysics3d/include/ -Iext/vhacd/include/ -Iext/cpp-spline/src -Iext/zlib -Iext/gainput-1.0.0/lib/include/
INCLUDES = -Isrc -Iext -I. -Iext/reactphysics3d/include/ -Iext/vhacd/include/ -Iext/cpp-spline/src -Iext/zlib

#
CXX := $(CXX) -fPIC
Expand Down Expand Up @@ -191,7 +191,6 @@ OGLCOMPILERSDLL = vulkan/OGLCompilersDLL
VMA = vulkan/vma
CPPSPLINE = cpp-spline
BC7 = bc7enc_rdo
GAINPUT = gainput-1.0.0

SRCS_DEBUG =

Expand Down Expand Up @@ -823,38 +822,6 @@ EXT_BC7_SRCS = \
ext/bc7enc_rdo/bc7decomp.cpp \
ext/bc7enc_rdo/bc7enc.cpp

EXT_GAINPUT_SRCS = \
ext/gainput-1.0.0/lib/source/gainput/keyboard/GainputInputDeviceKeyboard.cpp \
ext/gainput-1.0.0/lib/source/gainput/keyboard/GainputInputDeviceKeyboardMac.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputTapGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputPinchGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputButtonStickGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputHoldGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputDoubleClickGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputSimultaneouslyDownGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputRotateGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/builtin/GainputInputDeviceBuiltIn.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputDevice.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputAllocator.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputMapFilters.cpp \
ext/gainput-1.0.0/lib/source/gainput/touch/GainputInputDeviceTouch.cpp \
ext/gainput-1.0.0/lib/source/gainput/pad/GainputInputDevicePadMac.cpp \
ext/gainput-1.0.0/lib/source/gainput/pad/GainputInputDevicePad.cpp \
ext/gainput-1.0.0/lib/source/gainput/mouse/GainputInputDeviceMouse.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputMemoryStream.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputNetConnection.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputNetAddress.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputNetListener.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputDev.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputMap.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputDeltaState.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputManager.cpp \
ext/gainput-1.0.0/lib/source/gainput/recorder/GainputInputRecording.cpp \
ext/gainput-1.0.0/lib/source/gainput/recorder/GainputInputPlayer.cpp \
ext/gainput-1.0.0/lib/source/gainput/recorder/GainputInputRecorder.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputState.cpp \
ext/gainput-1.0.0/lib/source/gainput/gainput.cpp

OPENGL2_RENDERER_LIB_SRCS = \
src/tdme/engine/subsystems/renderer/EngineGL2Renderer.cpp \
src/tdme/engine/subsystems/renderer/GL2Renderer.cpp
Expand Down Expand Up @@ -1013,7 +980,6 @@ EXT_SHA256_OBJS = $(EXT_SHA256_SRCS:ext/$(SHA256)/%.cpp=$(OBJ)/%.o)
EXT_REACTPHYSICS3D_OBJS = $(EXT_REACTPHYSICS3D_SRCS:ext/$(REACTPHYSICS3D)/%.cpp=$(OBJ)/%.o)
EXT_CPPSPLINE_OBJS = $(EXT_CPPSPLINE_SRCS:ext/$(CPPSPLINE)/%.cpp=$(OBJ)/%.o)
EXT_BC7_OBJS = $(EXT_BC7_SRCS:ext/$(BC7)/%.cpp=$(OBJ)/%.o)
EXT_GAINPUT_OBJS = $(EXT_GAINPUT_SRCS:ext/$(GAINPUT)/%.cpp=$(OBJ)/%.o)
EXT_SPIRV_OBJS = $(EXT_SPIRV_SRCS:ext/$(SPIRV)/%.cpp=$(OBJ)/vulkan/%.o)
EXT_GLSLANG_OBJS = $(EXT_GLSLANG_SRCS:ext/$(GLSLANG)/%.cpp=$(OBJ)/vulkan/%.o)
EXT_OGLCOMPILERSDLL_OBJS = $(EXT_OGLCOMPILERSDLL_SRCS:ext/$(OGLCOMPILERSDLL)/%.cpp=$(OBJ)/vulkan/%.o)
Expand Down Expand Up @@ -1082,9 +1048,6 @@ $(EXT_CPPSPLINE_OBJS):$(OBJ)/%.o: ext/$(CPPSPLINE)/%.cpp | print-opts
$(EXT_BC7_OBJS):$(OBJ)/%.o: ext/$(BC7)/%.cpp | print-opts
$(cpp-command)

$(EXT_GAINPUT_OBJS):$(OBJ)/%.o: ext/$(GAINPUT)/%.cpp | print-opts
$(cpp-command)

$(EXT_SPIRV_OBJS):$(OBJ)/vulkan/%.o: ext/$(SPIRV)/%.cpp | print-opts
$(cpp-command)

Expand Down Expand Up @@ -1207,7 +1170,7 @@ endif

$(LIB_DIR)/$(LIB): $(OBJS) $(OBJS_DEBUG)

$(LIB_DIR)/$(EXT_LIB): $(EXT_OBJS) $(EXT_TINYXML_OBJS) $(EXT_ZLIB_OBJS) $(EXT_LIBPNG_OBJS) $(EXT_VORBIS_OBJS) $(EXT_OGG_OBJS) $(EXT_SHA256_OBJS) $(EXT_REACTPHYSICS3D_OBJS) $(EXT_CPPSPLINE_OBJS) $(EXT_BC7_OBJS) $(EXT_GAINPUT_OBJS)
$(LIB_DIR)/$(EXT_LIB): $(EXT_OBJS) $(EXT_TINYXML_OBJS) $(EXT_ZLIB_OBJS) $(EXT_LIBPNG_OBJS) $(EXT_VORBIS_OBJS) $(EXT_OGG_OBJS) $(EXT_SHA256_OBJS) $(EXT_REACTPHYSICS3D_OBJS) $(EXT_CPPSPLINE_OBJS) $(EXT_BC7_OBJS)

$(LIB_DIR)/$(OPENGL2_RENDERER_LIB): $(OPENGL2_RENDERER_LIB_OBJS)

Expand Down
35 changes: 0 additions & 35 deletions Makefile.nmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ INCLUDES = \
/I "ext\rapidjson\include" \
/I "ext\cpp-spline\src" \
/I "ext\zlib" \
/I "ext\gainput-1.0.0\lib\include"

# For some reason this works only once LOL
# WINDOWS_SDK_DIR = %WindowsSdkDir%Lib\%WindowsSDKLibVersion%
Expand All @@ -36,7 +35,6 @@ LIBS_LDFLAGS = \
/LIBPATH "$(WINDOWS_SDK_DIR)\um\x64\user32.lib" \
/LIBPATH "$(WINDOWS_SDK_DIR)\um\x64\ws2_32.lib" \
/LIBPATH "$(WINDOWS_SDK_DIR)\um\x64\dbghelp.lib" \
/LIBPATH "$(WINDOWS_SDK_DIR)\um\x64\xinput.lib" \
/LIBPATH "ext\glfw3\lib\win64\glfw3dll.lib" \
/LIBPATH "ext\windows-msc\openal-soft\libs\OpenAL32.lib" \
/LIBPATH "ext\freetype\lib\win64\freetype.lib" \
Expand Down Expand Up @@ -688,38 +686,6 @@ EXT_BC7_SRCS = \
ext/bc7enc_rdo/bc7decomp.cpp \
ext/bc7enc_rdo/bc7enc.cpp

EXT_GAINPUT_SRCS = \
ext/gainput-1.0.0/lib/source/gainput/keyboard/GainputInputDeviceKeyboard.cpp \
ext/gainput-1.0.0/lib/source/gainput/keyboard/GainputInputDeviceKeyboardMac.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputTapGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputPinchGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputButtonStickGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputHoldGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputDoubleClickGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputSimultaneouslyDownGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/gestures/GainputRotateGesture.cpp \
ext/gainput-1.0.0/lib/source/gainput/builtin/GainputInputDeviceBuiltIn.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputDevice.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputAllocator.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputMapFilters.cpp \
ext/gainput-1.0.0/lib/source/gainput/touch/GainputInputDeviceTouch.cpp \
ext/gainput-1.0.0/lib/source/gainput/pad/GainputInputDevicePadMac.cpp \
ext/gainput-1.0.0/lib/source/gainput/pad/GainputInputDevicePad.cpp \
ext/gainput-1.0.0/lib/source/gainput/mouse/GainputInputDeviceMouse.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputMemoryStream.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputNetConnection.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputNetAddress.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputNetListener.cpp \
ext/gainput-1.0.0/lib/source/gainput/dev/GainputDev.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputMap.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputDeltaState.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputManager.cpp \
ext/gainput-1.0.0/lib/source/gainput/recorder/GainputInputRecording.cpp \
ext/gainput-1.0.0/lib/source/gainput/recorder/GainputInputPlayer.cpp \
ext/gainput-1.0.0/lib/source/gainput/recorder/GainputInputRecorder.cpp \
ext/gainput-1.0.0/lib/source/gainput/GainputInputState.cpp \
ext/gainput-1.0.0/lib/source/gainput/gainput.cpp

EXT_SRCS = \
$(EXT_TINYXML_SRCS) \
$(EXT_ZLIB_SRCS) \
Expand All @@ -730,7 +696,6 @@ EXT_SRCS = \
$(EXT_REACTPHYSICS3D_SRCS) \
$(EXT_CPPSPLINE_SRCS) \
$(EXT_BC7_SRCS) \
$(EXT_GAINPUT_SRCS)

OPENGL3CORE_RENDERER_LIB_SRCS = \
src/tdme/engine/subsystems/renderer/EngineGL3Renderer.cpp \
Expand Down
134 changes: 74 additions & 60 deletions src/tdme/application/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include <dlfcn.h>
#endif

// experimental
#include <gainput/gainput.h>

#include <stdlib.h>

#include <array>
Expand All @@ -52,18 +49,13 @@
#include <tdme/utilities/ByteBuffer.h>
#include <tdme/utilities/Character.h>
#include <tdme/utilities/Console.h>
#include <tdme/utilities/Exception.h>
#include <tdme/utilities/Hex.h>
#include <tdme/utilities/RTTI.h>
#include <tdme/utilities/StringTokenizer.h>
#include <tdme/utilities/StringTools.h>
#include <tdme/utilities/Time.h>

// experimental
using gainput::DeviceId;
using gainput::InputDevicePad;
using gainput::InputManager;
using gainput::InputMap;

using std::array;
using std::shared_ptr;
using std::string;
Expand All @@ -82,6 +74,7 @@ using tdme::os::threading::Thread;
using tdme::utilities::ByteBuffer;
using tdme::utilities::Character;
using tdme::utilities::Console;
using tdme::utilities::Exception;
using tdme::utilities::Hex;
using tdme::utilities::RTTI;
using tdme::utilities::StringTokenizer;
Expand Down Expand Up @@ -347,7 +340,7 @@ void Application::exit(int exitCode) {
}
#endif

Application::Application(): gaInputMap(gaInputManager) {
Application::Application() {
Application::application = this;
installExceptionHandler();
}
Expand Down Expand Up @@ -709,26 +702,21 @@ int Application::run(int argc, char** argv, const string& title, InputEventHandl
}
#endif

// experimental
auto padId = gaInputManager.CreateDevice<gainput::InputDevicePad>();
gaInputManager.SetDisplaySize(getWindowWidth(), getWindowHeight());
gaInputMap.MapBool(GAMEPADBUTTON_LEFT, padId, gainput::PadButtonLeft);
gaInputMap.MapBool(GAMEPADBUTTON_RIGHT, padId, gainput::PadButtonRight);
gaInputMap.MapBool(GAMEPADBUTTON_UP, padId, gainput::PadButtonUp);
gaInputMap.MapBool(GAMEPADBUTTON_DOWN, padId, gainput::PadButtonDown);
gaInputMap.MapBool(GAMEPADBUTTON_SHIFTTAB, padId, gainput::PadButtonL1);
gaInputMap.MapBool(GAMEPADBUTTON_TAB, padId, gainput::PadButtonR1);
gaInputMap.MapBool(GAMEPADBUTTON_RETURN, padId, gainput::PadButtonX);
gaInputMap.MapBool(GAMEPADBUTTON_ESCAPE, padId, gainput::PadButtonB);
try {
auto gameControllerDatabase = FileSystem::getInstance()->getContentAsString("resources/engine/misc", "gamecontrollerdb.txt");
glfwUpdateGamepadMappings(gameControllerDatabase.c_str());
} catch (Exception& exception) {
Console::println("An error occurred: " + string(exception.what()));
}

//
while (glfwWindowShouldClose(glfwWindow) == false) {
displayInternal();
if (Engine::getRenderer()->getRendererType() != Renderer::RENDERERTYPE_VULKAN) glfwSwapBuffers(glfwWindow);
//
glfwPollEvents();
// experimental
updatePadInput();
//
updateJoystickInput();
}
glfwTerminate();
//
Expand Down Expand Up @@ -798,8 +786,6 @@ void Application::reshapeInternal(int width, int height) {
Application::application->initialized = true;
}
Application::application->reshape(width, height);
// experimental
Application::application->gaInputManager.SetDisplaySize(width, height);
}

void Application::glfwOnChar(GLFWwindow* window, unsigned int key) {
Expand Down Expand Up @@ -889,45 +875,73 @@ void Application::glfwOnDrop(GLFWwindow* window, int count, const char** paths)
Application::application->onDrop(pathsVector);
}

void Application::updatePadInput() {
void Application::updateJoystickInput() {
if (Application::inputEventHandler == nullptr) return;
//
gaInputManager.Update();
//
double mouseX, mouseY;
glfwGetCursorPos(glfwWindow, &mouseX, &mouseY);
//
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_LEFT) == true) {
Console::println("\tLEFT");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_LEFT, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
}
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_RIGHT) == true) {
Console::println("\tRIGHT");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_RIGHT, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
}
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_UP) == true) {
Console::println("\tUP");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_UP, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
}
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_DOWN) == true) {
Console::println("\tDOWN");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_DOWN, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
}
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_SHIFTTAB) == true) {
Console::println("\tSHIFTAB");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_TAB, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_SHIFT);
}
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_TAB) == true) {
Console::println("\tTAB");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_TAB, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
}
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_RETURN) == true) {
Console::println("\tRETURN");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_RETURN, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
}
if (gaInputMap.GetBoolWasDown(GAMEPADBUTTON_ESCAPE) == true) {
Console::println("\tCANCEL");
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_ESCAPE, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
// TODO: finish me!!!
// Console::println(glfwGetJoystickName(GLFW_JOYSTICK_1));
GLFWgamepadstate gamepadState;
if (glfwGetGamepadState(GLFW_JOYSTICK_1, &gamepadState) == true) {
// left
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_LEFT] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_LEFT, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_LEFT] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_LEFT, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
// right
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_RIGHT] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_RIGHT, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_RIGHT] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_RIGHT, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
// up
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_UP] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_UP, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_UP] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_UP, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
// down
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_DOWN] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_DOWN, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_DPAD_DOWN] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_DOWN, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
// shift/tab
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_LEFT_BUMPER] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_TAB, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_SHIFT);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_LEFT_BUMPER] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_TAB, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
// tab
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_TAB, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_TAB, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
// return
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_CROSS] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_RETURN, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_CROSS] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_RETURN, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
// back
if (gamepadState.buttons[GLFW_GAMEPAD_BUTTON_CIRCLE] == true) {
Application::inputEventHandler->onKeyDown(-1, KEYBOARD_KEYCODE_ESCAPE, static_cast<int>(mouseX), static_cast<int>(mouseY), false, KEYBOARD_MODIFIER_NONE);
} else
if (lastGamepadState.buttons[GLFW_GAMEPAD_BUTTON_CIRCLE] == true) {
Application::inputEventHandler->onKeyUp(-1, KEYBOARD_KEYCODE_ESCAPE, static_cast<int>(mouseX), static_cast<int>(mouseY));
}
//
lastGamepadState = gamepadState;
}
}

Expand Down
Loading

0 comments on commit 5364632

Please sign in to comment.