53 ImGuiIO &io = ImGui::GetIO();
54 io.KeyMap[ImGuiKey_LeftSuper] = SDL_GetScancodeFromKey(SDLK_LGUI);
55 io.KeyMap[ImGuiKey_Backspace] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
56 io.KeyMap[ImGuiKey_LeftShift] = SDL_GetScancodeFromKey(SDLK_LSHIFT);
57 io.KeyMap[ImGuiKey_Enter] = SDL_GetScancodeFromKey(SDLK_RETURN);
58 io.KeyMap[ImGuiKey_UpArrow] = SDL_GetScancodeFromKey(SDLK_UP);
59 io.KeyMap[ImGuiKey_DownArrow] = SDL_GetScancodeFromKey(SDLK_DOWN);
60 io.KeyMap[ImGuiKey_LeftArrow] = SDL_GetScancodeFromKey(SDLK_LEFT);
61 io.KeyMap[ImGuiKey_RightArrow] = SDL_GetScancodeFromKey(SDLK_RIGHT);
62 io.KeyMap[ImGuiKey_Delete] = SDL_GetScancodeFromKey(SDLK_DELETE);
63 io.KeyMap[ImGuiKey_Escape] = SDL_GetScancodeFromKey(SDLK_ESCAPE);
64 io.KeyMap[ImGuiKey_Tab] = SDL_GetScancodeFromKey(SDLK_TAB);
65 io.KeyMap[ImGuiKey_LeftCtrl] = SDL_GetScancodeFromKey(SDLK_LCTRL);
66 io.KeyMap[ImGuiKey_PageUp] = SDL_GetScancodeFromKey(SDLK_PAGEUP);
67 io.KeyMap[ImGuiKey_PageDown] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
68 io.KeyMap[ImGuiKey_Home] = SDL_GetScancodeFromKey(SDLK_HOME);
69 io.KeyMap[ImGuiKey_Space] = SDL_GetScancodeFromKey(SDLK_SPACE);
70 io.KeyMap[ImGuiKey_1] = SDL_GetScancodeFromKey(SDLK_1);
71 io.KeyMap[ImGuiKey_2] = SDL_GetScancodeFromKey(SDLK_2);
72 io.KeyMap[ImGuiKey_3] = SDL_GetScancodeFromKey(SDLK_3);
73 io.KeyMap[ImGuiKey_4] = SDL_GetScancodeFromKey(SDLK_4);
74 io.KeyMap[ImGuiKey_5] = SDL_GetScancodeFromKey(SDLK_5);
75 io.KeyMap[ImGuiKey_6] = SDL_GetScancodeFromKey(SDLK_6);
76 io.KeyMap[ImGuiKey_7] = SDL_GetScancodeFromKey(SDLK_7);
77 io.KeyMap[ImGuiKey_8] = SDL_GetScancodeFromKey(SDLK_8);
78 io.KeyMap[ImGuiKey_9] = SDL_GetScancodeFromKey(SDLK_9);
79 io.KeyMap[ImGuiKey_0] = SDL_GetScancodeFromKey(SDLK_0);
80 io.KeyMap[ImGuiKey_A] = SDL_GetScancodeFromKey(SDLK_a);
81 io.KeyMap[ImGuiKey_B] = SDL_GetScancodeFromKey(SDLK_b);
82 io.KeyMap[ImGuiKey_C] = SDL_GetScancodeFromKey(SDLK_c);
83 io.KeyMap[ImGuiKey_D] = SDL_GetScancodeFromKey(SDLK_d);
84 io.KeyMap[ImGuiKey_E] = SDL_GetScancodeFromKey(SDLK_e);
85 io.KeyMap[ImGuiKey_F] = SDL_GetScancodeFromKey(SDLK_f);
86 io.KeyMap[ImGuiKey_G] = SDL_GetScancodeFromKey(SDLK_g);
87 io.KeyMap[ImGuiKey_H] = SDL_GetScancodeFromKey(SDLK_h);
88 io.KeyMap[ImGuiKey_I] = SDL_GetScancodeFromKey(SDLK_i);
89 io.KeyMap[ImGuiKey_J] = SDL_GetScancodeFromKey(SDLK_j);
90 io.KeyMap[ImGuiKey_K] = SDL_GetScancodeFromKey(SDLK_k);
91 io.KeyMap[ImGuiKey_L] = SDL_GetScancodeFromKey(SDLK_l);
92 io.KeyMap[ImGuiKey_M] = SDL_GetScancodeFromKey(SDLK_m);
93 io.KeyMap[ImGuiKey_N] = SDL_GetScancodeFromKey(SDLK_n);
94 io.KeyMap[ImGuiKey_O] = SDL_GetScancodeFromKey(SDLK_o);
95 io.KeyMap[ImGuiKey_P] = SDL_GetScancodeFromKey(SDLK_p);
96 io.KeyMap[ImGuiKey_Q] = SDL_GetScancodeFromKey(SDLK_q);
97 io.KeyMap[ImGuiKey_R] = SDL_GetScancodeFromKey(SDLK_r);
98 io.KeyMap[ImGuiKey_S] = SDL_GetScancodeFromKey(SDLK_s);
99 io.KeyMap[ImGuiKey_T] = SDL_GetScancodeFromKey(SDLK_t);
100 io.KeyMap[ImGuiKey_U] = SDL_GetScancodeFromKey(SDLK_u);
101 io.KeyMap[ImGuiKey_V] = SDL_GetScancodeFromKey(SDLK_v);
102 io.KeyMap[ImGuiKey_W] = SDL_GetScancodeFromKey(SDLK_w);
103 io.KeyMap[ImGuiKey_X] = SDL_GetScancodeFromKey(SDLK_x);
104 io.KeyMap[ImGuiKey_Y] = SDL_GetScancodeFromKey(SDLK_y);
105 io.KeyMap[ImGuiKey_Z] = SDL_GetScancodeFromKey(SDLK_z);
106 io.KeyMap[ImGuiKey_F1] = SDL_GetScancodeFromKey(SDLK_F1);
107 io.KeyMap[ImGuiKey_F2] = SDL_GetScancodeFromKey(SDLK_F2);
108 io.KeyMap[ImGuiKey_F3] = SDL_GetScancodeFromKey(SDLK_F3);
109 io.KeyMap[ImGuiKey_F4] = SDL_GetScancodeFromKey(SDLK_F4);
110 io.KeyMap[ImGuiKey_F5] = SDL_GetScancodeFromKey(SDLK_F5);
111 io.KeyMap[ImGuiKey_F6] = SDL_GetScancodeFromKey(SDLK_F6);
112 io.KeyMap[ImGuiKey_F7] = SDL_GetScancodeFromKey(SDLK_F7);
113 io.KeyMap[ImGuiKey_F8] = SDL_GetScancodeFromKey(SDLK_F8);
114 io.KeyMap[ImGuiKey_F9] = SDL_GetScancodeFromKey(SDLK_F9);
115 io.KeyMap[ImGuiKey_F10] = SDL_GetScancodeFromKey(SDLK_F10);
116 io.KeyMap[ImGuiKey_F11] = SDL_GetScancodeFromKey(SDLK_F11);
117 io.KeyMap[ImGuiKey_F12] = SDL_GetScancodeFromKey(SDLK_F12);
121 ImGuiIO &io = ImGui::GetIO();
122 io.KeysDown[
event.key.keysym.scancode] = (
event.type == SDL_KEYDOWN);
123 io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
124 io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
125 io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
126 io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
128 switch (event.key.keysym.sym) {
133 io.KeysDown[
event.key.keysym.scancode] = (
event.type == SDL_KEYDOWN);
136 editor.
emulator().snes().SetButtonState(1, 0,
true);
139 editor.
emulator().snes().SetButtonState(1, 1,
true);
142 editor.
emulator().snes().SetButtonState(1, 2,
true);
145 editor.
emulator().snes().SetButtonState(1, 3,
true);
148 editor.
emulator().snes().SetButtonState(1, 4,
true);
151 editor.
emulator().snes().SetButtonState(1, 5,
true);
154 editor.
emulator().snes().SetButtonState(1, 6,
true);
157 editor.
emulator().snes().SetButtonState(1, 7,
true);
160 editor.
emulator().snes().SetButtonState(1, 8,
true);
163 editor.
emulator().snes().SetButtonState(1, 9,
true);
166 editor.
emulator().snes().SetButtonState(1, 10,
true);
169 editor.
emulator().snes().SetButtonState(1, 11,
true);
177 ImGuiIO &io = ImGui::GetIO();
178 int key =
event.key.keysym.scancode;
179 IM_ASSERT(key >= 0 && key < IM_ARRAYSIZE(io.KeysDown));
180 io.KeysDown[key] = (
event.type == SDL_KEYDOWN);
181 io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
182 io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
183 io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
184 io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
186 switch (event.key.keysym.sym) {
188 editor.
emulator().snes().SetButtonState(1, 0,
false);
191 editor.
emulator().snes().SetButtonState(1, 1,
false);
194 editor.
emulator().snes().SetButtonState(1, 2,
false);
197 editor.
emulator().snes().SetButtonState(1, 3,
false);
200 editor.
emulator().snes().SetButtonState(1, 4,
false);
203 editor.
emulator().snes().SetButtonState(1, 5,
false);
206 editor.
emulator().snes().SetButtonState(1, 6,
false);
209 editor.
emulator().snes().SetButtonState(1, 7,
false);
212 editor.
emulator().snes().SetButtonState(1, 8,
false);
215 editor.
emulator().snes().SetButtonState(1, 9,
false);
218 editor.
emulator().snes().SetButtonState(1, 10,
false);
221 editor.
emulator().snes().SetButtonState(1, 11,
false);