Skip to content

Commit

Permalink
Added input_handle_key_combos
Browse files Browse the repository at this point in the history
  • Loading branch information
twist84 committed Sep 19, 2024
1 parent a5a139f commit 8c15a92
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions game/source/input/input_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#include "input/input_abstraction.hpp"
#include "input/input_xinput.hpp"
#include "main/console.hpp"
#include "main/global_preferences.hpp"
#include "memory/module.hpp"
#include "rasterizer/rasterizer.hpp"
#include "shell/shell_windows.hpp"

//#include <windows.h> // for `key_to_virtual_table`
Expand Down Expand Up @@ -529,6 +531,8 @@ void __cdecl input_update()
input_update_mouse(duration_ms);
input_update_gamepads(duration_ms);
input_update_gamepads_rumble();

input_handle_key_combos();
}
}

Expand Down Expand Up @@ -690,6 +694,16 @@ void __cdecl update_key(key_state* key, bool key_down, long duration_ms)
//}
}

void input_handle_key_combos()
{
if (input_key_frames_down(_key_code_alt, _input_type_ui) && input_key_frames_down(_key_code_enter, _input_type_ui) == 1 ||
input_key_frames_down(_key_code_alt, _input_type_ui) && input_key_frames_down(_key_code_keypad_enter, _input_type_ui) == 1)
{
global_preferences_set_fullscreen(!global_preferences_get_fullscreen());
rasterizer_reset_device();
}
}

void input_get_raw_data_string(char* buffer, short size)
{
// For some reason buffer is displayed incorrectly for both H3EK and Donkey
Expand Down
1 change: 1 addition & 0 deletions game/source/input/input_windows.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ extern void __cdecl input_update_gamepads_rumble();
extern void __cdecl update_button(byte* frames_down, word* msec_down, bool key_down, long duration_ms);
extern void __cdecl update_key(key_state* key, bool key_down, long duration_ms);

extern void input_handle_key_combos();
extern void input_get_raw_data_string(char* buffer, short size);
extern void input_mouse_state_get_raw_data_string(char* buffer, short size);

0 comments on commit 8c15a92

Please sign in to comment.