MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / osk_control

Function osk_control

src/inputdevice.cpp:219–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217static int osk_accumulated_state = 0;
218
219void osk_control(int x, int y, int button, int buttonstate)
220{
221 if (!imgui_osk_is_active()) {
222 osk_accumulated_state = 0;
223 return;
224 }
225 if (vkbd_allowed(0))
226 {
227 // Update accumulated direction state: always refresh direction bits
228 if (!button) {
229 // Direction event: replace all direction bits
230 osk_accumulated_state &= ~(OSK_LEFT | OSK_RIGHT | OSK_UP | OSK_DOWN);
231 if (x < 0) osk_accumulated_state |= OSK_LEFT;
232 if (x > 0) osk_accumulated_state |= OSK_RIGHT;
233 if (y < 0) osk_accumulated_state |= OSK_UP;
234 if (y > 0) osk_accumulated_state |= OSK_DOWN;
235 } else {
236 // Button event: update button bit
237 if (buttonstate)
238 osk_accumulated_state |= OSK_BUTTON;
239 else
240 osk_accumulated_state &= ~OSK_BUTTON;
241 }
242
243 int code;
244 int pressed;
245 // imgui_osk_process handles inputdevice_do_keyboard internally
246 // via press_key/release_key — don't call it again here
247 imgui_osk_process(osk_accumulated_state, &code, &pressed);
248 }
249}
250
251static int isdevice (struct uae_input_device *id)
252{

Callers 2

handle_input_event2Function · 0.85

Calls 3

vkbd_allowedFunction · 0.85
imgui_osk_is_activeFunction · 0.50
imgui_osk_processFunction · 0.50

Tested by

no test coverage detected