diff --git a/gamemgr/bggame.cc b/gamemgr/bggame.cc index 199186b5f..0702a4a7a 100644 --- a/gamemgr/bggame.cc +++ b/gamemgr/bggame.cc @@ -2239,11 +2239,9 @@ bool BG_Game::new_game(Vga_file& shapes) { // visible initially } SDL_Window* window = gwin->get_win()->get_screen_window(); -#if !defined(SDL_PLATFORM_IOS) && !defined(ANDROID) if (!SDL_TextInputActive(window)) { SDL_StartTextInput(window); } -#endif do { Delay(); if (redraw) { @@ -2298,6 +2296,16 @@ bool BG_Game::new_game(Vga_file& shapes) { } else if (Mouse::mouse() && Mouse::mouse()->is_onscreen()) { gwin->get_win()->ShowFillGuardBand(); } + if (touchui != nullptr) { + int yoffset = static_cast(-gwin->get_height() / 3.0 + 132); + SDL_Rect screenRect = {topx, topy + yoffset, 1, 1}; + int screen_x = screenRect.x; + int screen_y = screenRect.y; + gwin->get_win()->game_to_screen(screenRect.x, screenRect.y, false, screen_x,screen_y); + screenRect.x = screen_x; + screenRect.y = screen_y; + SDL_SetTextInputArea(window, &screenRect, 0); + } SDL_Renderer* renderer = SDL_GetRenderer(gwin->get_win()->get_screen_window()); SDL_Event event; @@ -2325,6 +2333,7 @@ bool BG_Game::new_game(Vga_file& shapes) { const SDL_Rect rectOnward = {topx + 10, topy + 180, 130, 16}; const SDL_Rect rectReturn = {centerx + 10, topy + 180, 130, 16}; SDL_Point point; + gwin->get_win()->screen_to_game( event.button.x, event.button.y, gwin->get_fastmouse(), point.x, point.y); @@ -2332,7 +2341,11 @@ bool BG_Game::new_game(Vga_file& shapes) { if (event.type == SDL_EVENT_MOUSE_BUTTON_DOWN) { selected = 0; } else if (selected == 0 && touchui != nullptr) { - touchui->promptForName(npc_name); + if (!SDL_TextInputActive(window)) { + SDL_StartTextInput(window); + } else { + SDL_StopTextInput(window); + } } redraw = true; } else if (SDL_GetRectEnclosingPoints(