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

input: fix various input bugs.

Devices were not properly reset at each frame, which caused
button_pressed() and other functions to fail.
legacy
Sam Hocevar 5 лет назад
Родитель
Сommit
df7f58e20d
3 измененных файлов: 9 добавлений и 1 удалений
  1. +2
    -0
      src/application/android-app.cpp
  2. +2
    -0
      src/ui/d3d9-input.cpp
  3. +5
    -1
      src/ui/sdl-input.cpp

+ 2
- 0
src/application/android-app.cpp Просмотреть файл

@@ -363,6 +363,8 @@ void lol::AndroidApp::Tick()
int events;
struct android_poll_source* source;

input::mouse()->internal_begin_frame();

/* Loop until all events are read, then continue to draw the next
* frame of animation. */
while ((ident = ALooper_pollAll(0, nullptr, &events,


+ 2
- 0
src/ui/d3d9-input.cpp Просмотреть файл

@@ -13,6 +13,7 @@
#if HAVE_CONFIG_H
# include "config.h"
#endif

#if defined LOL_USE_XINPUT
# include <d3d9.h>
# include <xinput.h>
@@ -97,6 +98,7 @@ void D3d9Input::tick_game(float seconds)
continue;

auto stick = m_data->m_joysticks[i].m2;
stick->internal_begin_frame();
stick->internal_set_axis(input::axis::LeftX, state.Gamepad.sThumbLX / 32768.f);
stick->internal_set_axis(input::axis::LeftY, -state.Gamepad.sThumbLY / 32768.f);
stick->internal_set_axis(input::axis::RightX, state.Gamepad.sThumbRX / 32768.f);


+ 5
- 1
src/ui/sdl-input.cpp Просмотреть файл

@@ -133,6 +133,11 @@ void SdlInput::tick(float seconds)
auto keyboard = input::keyboard();
auto mouse = input::mouse();

keyboard->internal_begin_frame();
mouse->internal_begin_frame();
for (int j = 0; j < m_joysticks.count(); j++)
m_joysticks[j].m2->internal_begin_frame();

/* Pump all joystick events because no event is coming to us. */
# if SDL_FORCE_POLL_JOYSTICK && !__EMSCRIPTEN__
SDL_JoystickUpdate();
@@ -145,7 +150,6 @@ void SdlInput::tick(float seconds)
}
# endif

keyboard->internal_begin_frame();
float mouse_wheel = 0.f;

if (keyboard->capture_text())


Загрузка…
Отмена
Сохранить