Skip to content

Commit

Permalink
Made native resolution in fullscreen optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rdanbrook committed Nov 26, 2012
1 parent bba89ee commit dc20c01
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion source/linux/main.cpp
Expand Up @@ -1475,8 +1475,9 @@ void SetupVideo()
GdkScreen *gdkscreen = gdk_screen_get_default();

int fullscreen = sSettings->GetFullscreen();
int fsnativeres = sSettings->GetFsNativeRes();

if (fullscreen == 1 && using_opengl) { // Force native resolution in fullscreen mode
if (fullscreen && fsnativeres && using_opengl) { // Force native resolution in fullscreen mode
cur_Rwidth = gdk_screen_get_width(gdkscreen);
cur_Rheight = gdk_screen_get_height(gdkscreen);
}
Expand Down
3 changes: 3 additions & 0 deletions source/linux/settings.cpp
Expand Up @@ -47,6 +47,7 @@ Settings::Settings()
litesurr = 0;
surmult = 40;
sndapi = 1;
fsnativeres = 1;

// try the recommended place for settings
home = getenv("HOME");
Expand Down Expand Up @@ -86,6 +87,7 @@ Settings::Settings()
READ_SETTING(exciter);
READ_SETTING(litesurr);
READ_SETTING(surmult);
READ_SETTING(fsnativeres);

fclose(f);
}
Expand Down Expand Up @@ -129,6 +131,7 @@ Settings::~Settings()
WRITE_SETTING(exciter);
WRITE_SETTING(litesurr);
WRITE_SETTING(surmult);
WRITE_SETTING(fsnativeres);

fclose(f);
}
Expand Down
4 changes: 3 additions & 1 deletion source/linux/settings.h
Expand Up @@ -11,13 +11,15 @@ namespace LinuxNst

// video accessors
int GetFullscreen(void) { return fullscreen; }
int GetFsNativeRes(void) { return fsnativeres; }
int GetScale(void) { return scaler; }
int GetSprlimit(void) { return sprlimit; }
int GetVideoMode(void) { return videomode; }
int GetNtscMode(void) { return ntscmode; }
int GetRenderType(void) { return rendertype; }
int GetScaleAmt(void) { return scaleamt; }
void SetFullscreen(int fs) { fullscreen = fs; }
void SetFsNativeRes(int fsnr) { fsnativeres = fsnr; }
void SetScale(int scl) { scaler = scl; }
void SetSprlimit(int limit) { sprlimit = limit; }
void SetVideoMode(int mode) { videomode = mode; }
Expand Down Expand Up @@ -57,7 +59,7 @@ namespace LinuxNst
private:
// video settings
int fullscreen, scaler, sprlimit, videomode, ntscmode;
int rendertype, scaleamt;
int fsnativeres, rendertype, scaleamt;
// input settings
int controls, configitem;
// sound settings
Expand Down
11 changes: 11 additions & 0 deletions source/linux/uihelp.cpp
Expand Up @@ -219,6 +219,10 @@ on_check_fullscreen_toggled (GtkToggleButton *togglebutton,
sSettings->SetFullscreen(gtk_toggle_button_get_active(togglebutton));
}

void on_check_fsnativeres_toggled(GtkToggleButton *togglebutton, gpointer user_data) {
sSettings->SetFsNativeRes(gtk_toggle_button_get_active(togglebutton));
}

void
on_unlimitsprcheck_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
Expand Down Expand Up @@ -666,6 +670,9 @@ GtkWidget* create_config(void) {

GtkWidget *check_fullscreen = gtk_widget_new(GTK_TYPE_CHECK_BUTTON, "label", "Fullscreen", "halign", GTK_ALIGN_START, "margin-left", 10, NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_fullscreen), sSettings->GetFullscreen());

GtkWidget *check_fsnativeres = gtk_widget_new(GTK_TYPE_CHECK_BUTTON, "label", "Native Resolution (Fullscreen)", "halign", GTK_ALIGN_START, "margin-left", 10, NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_fsnativeres), sSettings->GetFsNativeRes());

GtkWidget *unlimitsprcheck = gtk_widget_new(GTK_TYPE_CHECK_BUTTON, "label", "Unlimited Sprites", "halign", GTK_ALIGN_START, "margin-left", 10, NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(unlimitsprcheck), sSettings->GetSprlimit());
Expand All @@ -677,6 +684,7 @@ GtkWidget* create_config(void) {
gtk_box_pack_start(GTK_BOX(videobox), scaleamtbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(videobox), ntscbox, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(videobox), check_fullscreen, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(videobox), check_fsnativeres, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(videobox), unlimitsprcheck, FALSE, FALSE, 0);
//End of the Video stuff

Expand Down Expand Up @@ -855,6 +863,9 @@ GtkWidget* create_config(void) {

g_signal_connect(G_OBJECT(check_fullscreen), "toggled",
G_CALLBACK(on_check_fullscreen_toggled), NULL);

g_signal_connect(G_OBJECT(check_fsnativeres), "toggled",
G_CALLBACK(on_check_fsnativeres_toggled), NULL);

g_signal_connect(G_OBJECT(unlimitsprcheck), "toggled",
G_CALLBACK(on_unlimitsprcheck_toggled), NULL);
Expand Down

0 comments on commit dc20c01

Please sign in to comment.