cli: add --horizontal command line option
this option puts the touchscreen to the right, allowing higher scales on widescreen monitors.
This commit is contained in:
parent
90326ea1f9
commit
9868c00fca
|
@ -81,6 +81,7 @@ CommandLine::CommandLine()
|
|||
, disable_limiter(0)
|
||||
, windowed_fullscreen(0)
|
||||
, frameskip(0)
|
||||
, horizontal(0)
|
||||
, scale(1.0)
|
||||
, _rtc_day(-1)
|
||||
, _rtc_hour(-1)
|
||||
|
@ -125,6 +126,7 @@ static const char* help_string = \
|
|||
" Launches in windowed fullscreen (same as alt+enter)" ENDL
|
||||
#else
|
||||
" --scale N scale factor for window; default 1.0" ENDL
|
||||
" --horizontal display touch screen to the right; default OFF" ENDL
|
||||
" --nojoy Disables joystick support" ENDL
|
||||
#endif
|
||||
" --disable-sound Disables the sound output" ENDL
|
||||
|
@ -264,6 +266,7 @@ bool CommandLine::parse(int argc,char **argv)
|
|||
{ "windowed-fullscreen", no_argument, &windowed_fullscreen, 1 },
|
||||
#else
|
||||
{ "nojoy", no_argument, &_commandline_linux_nojoy, 1},
|
||||
{ "horizontal", no_argument, &horizontal, 1},
|
||||
{ "scale", required_argument, NULL, OPT_SCALE},
|
||||
#endif
|
||||
{ "frameskip", required_argument, NULL, OPT_FRAMESKIP},
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
int disable_limiter;
|
||||
int windowed_fullscreen;
|
||||
int frameskip;
|
||||
int horizontal;
|
||||
|
||||
bool parse(int argc,char **argv);
|
||||
|
||||
|
|
|
@ -270,10 +270,14 @@ static void Draw(class configured_features *cfg) {
|
|||
const size_t pixCount = w * h;
|
||||
ColorspaceApplyIntensityToBuffer16<false, false>(displayInfo.nativeBuffer16[NDSDisplayID_Main], pixCount, displayInfo.backlightIntensity[NDSDisplayID_Main]);
|
||||
ColorspaceApplyIntensityToBuffer16<false, false>(displayInfo.nativeBuffer16[NDSDisplayID_Touch], pixCount, displayInfo.backlightIntensity[NDSDisplayID_Touch]);
|
||||
SDL_Rect destrect[2] = {
|
||||
const SDL_Rect destrect_v[2] = {
|
||||
{ 0, 0 , ws, hs},
|
||||
{ 0, hs, ws, hs},
|
||||
};
|
||||
const SDL_Rect destrect_h[2] = {
|
||||
{ 0, 0 , ws, hs},
|
||||
{ ws, 0, ws, hs},
|
||||
};
|
||||
unsigned i, off = 0, n = pixCount*2;
|
||||
for(i = 0; i < 2; ++i) {
|
||||
void *p = 0;
|
||||
|
@ -281,7 +285,7 @@ static void Draw(class configured_features *cfg) {
|
|||
SDL_LockTexture(screen[i], NULL, &p, &pitch);
|
||||
memcpy(p, ((char*)displayInfo.masterNativeBuffer16)+off, n);
|
||||
SDL_UnlockTexture(screen[i]);
|
||||
SDL_RenderCopy(renderer, screen[i], NULL, &destrect[i]);
|
||||
SDL_RenderCopy(renderer, screen[i], NULL, cfg->horizontal ? &destrect_h[i] : &destrect_v[i]);
|
||||
off += n;
|
||||
}
|
||||
SDL_RenderPresent(renderer);
|
||||
|
@ -482,9 +486,12 @@ int main(int argc, char ** argv) {
|
|||
}
|
||||
|
||||
nds_screen_size_ratio = my_config.scale;
|
||||
ctrls_cfg.horizontal = my_config.horizontal;
|
||||
unsigned width = 256 + my_config.horizontal*256;
|
||||
unsigned height = 192 + 192 * !my_config.horizontal;
|
||||
sdl_videoFlags |= SDL_WINDOW_OPENGL;
|
||||
window = SDL_CreateWindow( "Desmume SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
256*my_config.scale, 384*my_config.scale, sdl_videoFlags );
|
||||
width*my_config.scale, height*my_config.scale, sdl_videoFlags );
|
||||
|
||||
if ( !window ) {
|
||||
fprintf( stderr, "Window creation failed: %s\n", SDL_GetError( ) );
|
||||
|
|
|
@ -589,8 +589,10 @@ process_ctrls_event( SDL_Event& event,
|
|||
screen_to_touch_range( event.button.y,
|
||||
cfg->nds_screen_size_ratio);
|
||||
|
||||
if( scaled_y >= 192)
|
||||
if(!cfg->horizontal && scaled_y >= 192)
|
||||
set_mouse_coord( scaled_x, scaled_y - 192);
|
||||
else if(cfg->horizontal && scaled_x >= 256)
|
||||
set_mouse_coord( scaled_x - 256, scaled_y);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ extern mouse_status mouse;
|
|||
struct ctrls_event_config {
|
||||
unsigned short keypad;
|
||||
float nds_screen_size_ratio;
|
||||
int horizontal;
|
||||
int auto_pause;
|
||||
int focused;
|
||||
int sdl_quit;
|
||||
|
|
Loading…
Reference in New Issue