vg.refresh_rate = mode.refresh_rate;
- vg_info( "CreateWindow\n" );
+ if( !vg.window_x )
+ vg.window_x = mode.w;
+
+ if( !vg.window_y )
+ vg.window_y = mode.h;
+
+ vg_info( "CreateWindow( %d %d )\n", vg.window_x, vg.window_y );
/* TODO: Allow selecting closest video mode from launch opts */
if((vg.window = SDL_CreateWindow( window_name,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
- mode.w, mode.h,
+ vg.window_x, vg.window_y,
SDL_WINDOW_FULLSCREEN_DESKTOP |
SDL_WINDOW_OPENGL |
}
else
vg_success( "Using adaptive Vsync\n" );
+
+ SDL_DisplayMode dispmode;
+ if( !SDL_GetWindowDisplayMode( vg.window, &dispmode ) )
+ {
+ if( dispmode.refresh_rate )
+ {
+ vg.refresh_rate = dispmode.refresh_rate;
+ vg_info( "Refresh rate: %d\n", dispmode.refresh_rate );
+ }
+ }
}
VG_STATIC void vg_enter( int argc, char *argv[], const char *window_name )
}
if( !vg_console.enabled ) return;
-
+
struct console_mapping
{
u16 mod;
void (*handler)(void);
}
- mapping[] =
+ mappings[] =
{
{ 0, SDLK_LEFT, _console_left },
{ KMOD_SHIFT, SDLK_LEFT, _console_left_select },
{ 0, SDLK_RETURN, _console_enter }
};
- for( int i=0; i<vg_list_size( mapping ); i++ )
+ SDL_Keymod mod = ev.mod & (KMOD_SHIFT|KMOD_CTRL|KMOD_ALT);
+
+ for( int i=0; i<vg_list_size( mappings ); i++ )
{
- struct console_mapping *mk = &mapping[i];
+ struct console_mapping *mapping = &mappings[i];
- if( mk->key == ev.sym )
+ if( mapping->key == ev.sym )
{
- if( mk->mod == 0 )
+ if( mapping->mod == 0 )
{
- if( ev.mod == 0 )
+ if( mod == 0 )
{
- mk->handler();
+ mapping->handler();
return;
}
}
- else if( (ev.mod & mk->mod) == mk->mod )
+ else if( (mod & mapping->mod) == mapping->mod )
{
- mk->handler();
+ mapping->handler();
return;
}
}