X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=7d85f6171925be6137208f50461354d0dd751626;hb=689f2d77f8684374e0c70c9842db4f131a61f1e8;hp=d8c79937451ab0b05fa4b517a54c225c54c5fb21;hpb=3e3b2e2cbfb978e4a18276ddfe872eed61dc1d95;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index d8c79937..7d85f617 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -386,6 +386,12 @@ void InitVideoBuffer(int width, int height, int depth, boolean fullscreen) video.frame_delay = 0; video.frame_delay_value = GAME_FRAME_DELAY; + video.shifted_up = FALSE; + video.shifted_up_pos = 0; + video.shifted_up_pos_last = 0; + video.shifted_up_delay = 0; + video.shifted_up_delay_value = ONE_SECOND_DELAY / 4; + SDLInitVideoBuffer(fullscreen); video.initialized = TRUE; @@ -1511,6 +1517,38 @@ KeyMod GetKeyModStateFromEvents() return HandleKeyModState(KSYM_UNDEFINED, 0); } +void StartTextInput(int x, int y, int width, int height) +{ +#if defined(TARGET_SDL2) + SDL_StartTextInput(); + +#if defined(HAS_SCREEN_KEYBOARD) + if (y + height > SCREEN_KEYBOARD_POS(video.height)) + { + video.shifted_up_pos = y + height - SCREEN_KEYBOARD_POS(video.height); + video.shifted_up_delay = SDL_GetTicks(); + video.shifted_up = TRUE; + } +#endif +#endif +} + +void StopTextInput() +{ +#if defined(TARGET_SDL2) + SDL_StopTextInput(); + +#if defined(HAS_SCREEN_KEYBOARD) + if (video.shifted_up) + { + video.shifted_up_pos = 0; + video.shifted_up_delay = SDL_GetTicks(); + video.shifted_up = FALSE; + } +#endif +#endif +} + boolean CheckCloseWindowEvent(ClientMessageEvent *event) { if (event->type != EVENT_CLIENTMESSAGE)