Added missing pieces for Android support
This commit is contained in:
parent
fdb6e83b04
commit
e2f32cfe94
2 changed files with 77 additions and 5 deletions
|
@ -22,6 +22,9 @@
|
|||
#include <SDL_ttf.h>
|
||||
#include <cmath>
|
||||
#endif
|
||||
#ifdef ANDROIDSDL
|
||||
#include <SDL_screenkeyboard.h>
|
||||
#endif
|
||||
#ifdef USE_DISPMANX
|
||||
#include "bcm_host.h"
|
||||
#include "threaddep/thread.h"
|
||||
|
@ -331,8 +334,6 @@ int graphics_setup(void)
|
|||
const auto should_be_zero = SDL_GetCurrentDisplayMode(0, ¤t);
|
||||
if (should_be_zero == 0)
|
||||
host_hz = current.refresh_rate;
|
||||
else
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef USE_DISPMANX
|
||||
|
@ -392,6 +393,71 @@ void graphics_subshutdown()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef ANDROIDSDL
|
||||
void update_onscreen()
|
||||
{
|
||||
SDL_ANDROID_SetScreenKeyboardFloatingJoystick(changed_prefs.floatingJoystick);
|
||||
if (changed_prefs.onScreen == 0)
|
||||
{
|
||||
SDL_ANDROID_SetScreenKeyboardShown(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_SetScreenKeyboardShown(1);
|
||||
SDL_Rect pos_textinput, pos_dpad, pos_button1, pos_button2, pos_button3, pos_button4, pos_button5, pos_button6;
|
||||
pos_textinput.x = changed_prefs.pos_x_textinput*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_textinput.y = changed_prefs.pos_y_textinput*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_textinput.h = SDL_ListModes(NULL, 0)[0]->h / (float)10;
|
||||
pos_textinput.w = pos_textinput.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, &pos_textinput);
|
||||
pos_dpad.x = changed_prefs.pos_x_dpad*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_dpad.y = changed_prefs.pos_y_dpad*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_dpad.h = SDL_ListModes(NULL, 0)[0]->h / (float)2.5;
|
||||
pos_dpad.w = pos_dpad.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &pos_dpad);
|
||||
pos_button1.x = changed_prefs.pos_x_button1*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_button1.y = changed_prefs.pos_y_button1*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_button1.h = SDL_ListModes(NULL, 0)[0]->h / (float)5;
|
||||
pos_button1.w = pos_button1.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &pos_button1);
|
||||
pos_button2.x = changed_prefs.pos_x_button2*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_button2.y = changed_prefs.pos_y_button2*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_button2.h = SDL_ListModes(NULL, 0)[0]->h / (float)5;
|
||||
pos_button2.w = pos_button2.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &pos_button2);
|
||||
pos_button3.x = changed_prefs.pos_x_button3*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_button3.y = changed_prefs.pos_y_button3*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_button3.h = SDL_ListModes(NULL, 0)[0]->h / (float)5;
|
||||
pos_button3.w = pos_button3.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &pos_button3);
|
||||
pos_button4.x = changed_prefs.pos_x_button4*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_button4.y = changed_prefs.pos_y_button4*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_button4.h = SDL_ListModes(NULL, 0)[0]->h / (float)5;
|
||||
pos_button4.w = pos_button4.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &pos_button4);
|
||||
pos_button5.x = changed_prefs.pos_x_button5*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_button5.y = changed_prefs.pos_y_button5*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_button5.h = SDL_ListModes(NULL, 0)[0]->h / (float)5;
|
||||
pos_button5.w = pos_button5.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, &pos_button5);
|
||||
pos_button6.x = changed_prefs.pos_x_button6*(SDL_ListModes(NULL, 0)[0]->w / (float)480);
|
||||
pos_button6.y = changed_prefs.pos_y_button6*(SDL_ListModes(NULL, 0)[0]->h / (float)360);
|
||||
pos_button6.h = SDL_ListModes(NULL, 0)[0]->h / (float)5;
|
||||
pos_button6.w = pos_button6.h;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, &pos_button6);
|
||||
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT, changed_prefs.onScreen_textinput);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, changed_prefs.onScreen_dpad);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, changed_prefs.onScreen_button1);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, changed_prefs.onScreen_button2);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, changed_prefs.onScreen_button3);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, changed_prefs.onScreen_button4);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_4, changed_prefs.onScreen_button5);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_5, changed_prefs.onScreen_button6);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL2
|
||||
// Check if the requested Amiga resolution can be displayed with the current Screen mode as a direct multiple
|
||||
// Based on this we make the decision to use Linear (smooth) or Nearest Neighbor (pixelated) scaling
|
||||
|
@ -412,7 +478,9 @@ static void open_screen(struct uae_prefs* p)
|
|||
}
|
||||
|
||||
currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect;
|
||||
|
||||
#ifdef ANDROIDSDL
|
||||
update_onscreen();
|
||||
#endif
|
||||
if (screen_is_picasso)
|
||||
{
|
||||
display_width = picasso_vidinfo.width ? picasso_vidinfo.width : 640;
|
||||
|
@ -526,7 +594,6 @@ int check_prefs_changed_gfx()
|
|||
|
||||
int lockscr()
|
||||
{
|
||||
init_row_map();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -771,7 +838,8 @@ void graphics_leave()
|
|||
uae_sem_destroy(&display_sem);
|
||||
display_sem = nullptr;
|
||||
}
|
||||
#elif USE_SDL2
|
||||
#endif
|
||||
#ifdef USE_SDL2
|
||||
if (texture)
|
||||
{
|
||||
SDL_DestroyTexture(texture);
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#ifdef USE_SDL1
|
||||
#include <guichan/sdl.hpp>
|
||||
#elif USE_SDL2
|
||||
#include <guisan/sdl.hpp>
|
||||
#endif
|
||||
|
||||
void androidsdl_event(SDL_Event event, gcn::SDLInput* gui_input) {
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue