char *getWindowTitleString()
{
+#if 1
+ static char *window_title_string = NULL;
+
+ checked_free(window_title_string);
+
+#ifdef DEBUG
+ window_title_string = checked_malloc(strlen(getProgramInitString()) + 20 +
+ strlen(getCompileDateString()) + 2 + 1);
+
+ sprintf(window_title_string, "%s (%d %%) [%s]",
+ getProgramInitString(), setup.window_scaling_percent,
+ getCompileDateString());
+#else
+ window_title_string = checked_malloc(strlen(getProgramInitString()) + 20);
+
+ sprintf(window_title_string, "%s (%d %%)",
+ getProgramInitString(), setup.window_scaling_percent);
+#endif
+
+ return window_title_string;
+
+#else
+
#ifdef DEBUG
static char *window_title_string = NULL;
#else
return getProgramInitString();
#endif
+
+#endif
}
-#define COMPILE_DATE_STRING "2014-03-07 21:52"
+#define COMPILE_DATE_STRING "2014-03-11 22:29"
int new_xpercent = (100 * new_window_width / video.width);
int new_ypercent = (100 * new_window_height / video.height);
+#if 0
printf("::: RESIZED from %d, %d to %d, %d\n",
video.window_width, video.window_height,
new_window_width, new_window_height);
+#endif
setup.window_scaling_percent = video.window_scaling_percent =
MIN(MAX(MIN_WINDOW_SCALING_PERCENT, MIN(new_xpercent, new_ypercent)),
video.window_width = new_window_width;
video.window_height = new_window_height;
+#if 0
printf("::: setup.window_scaling_percent set to %d\n",
setup.window_scaling_percent);
+#endif
if (game_status == GAME_MODE_SETUP)
RedrawSetupScreenAfterFullscreenToggle();
+
+ SetWindowTitle();
}
#else
// prevent slightly wrong scaling factor due to rounding differences
font_height = getFontHeight(FC_RED);
-#if 1
+#if 0
DrawInitTextAlways(getWindowTitleString(), 20, FC_YELLOW);
#else
DrawInitTextAlways(getProgramInitString(), 20, FC_YELLOW);
#endif
SDL_Surface *new_surface = NULL;
+ SetWindowTitle();
+
if (*backbuffer == NULL)
*backbuffer = CreateBitmapStruct();
}
#if defined(TARGET_SDL2)
+void SDLSetWindowTitle()
+{
+ SDL_SetWindowTitle(sdl_window, program.window_title);
+}
+
void SDLSetWindowScaling(int window_scaling_percent)
{
if (sdl_window == NULL)
video.window_scaling_percent = window_scaling_percent;
video.window_width = new_window_width;
video.window_height = new_window_height;
+
+ SetWindowTitle();
}
void SDLSetWindowScalingQuality(char *window_scaling_quality)
#if defined(TARGET_SDL2)
SDL_Surface *SDL_DisplayFormat(SDL_Surface *);
+void SDLSetWindowTitle(void);
void SDLSetWindowScaling(int);
void SDLSetWindowScalingQuality(char *);
void SDLSetWindowFullscreen(boolean);
void InitProgramInfo(char *argv0,
char *userdata_subdir, char *userdata_subdir_unix,
- char *program_title, char *window_title, char *icon_title,
+ char *program_title,
+#if 0
+ char *window_title,
+#endif
+ char *icon_title,
char *x11_icon_filename, char *x11_iconmask_filename,
char *sdl_icon_filename, char *msdos_cursor_filename,
char *cookie_prefix, char *filename_prefix,
program.userdata_path = getUserGameDataDir();
program.program_title = program_title;
+#if 1
+ program.window_title = "(undefined)";
+#else
program.window_title = window_title;
+#endif
program.icon_title = icon_title;
program.x11_icon_filename = x11_icon_filename;
program.error_file = stderr;
}
+void SetWindowTitle()
+{
+ program.window_title = program.window_title_function();
+
+#if defined(TARGET_SDL)
+ SDLSetWindowTitle();
+#endif
+}
+
+void InitWindowTitleFunction(char *(*window_title_function)(void))
+{
+ program.window_title_function = window_title_function;
+}
+
void InitExitMessageFunction(void (*exit_message_function)(char *, va_list))
{
program.exit_message_function = exit_message_function;
int version_minor;
int version_patch;
+ char *(*window_title_function)(void);
void (*exit_message_function)(char *, va_list);
void (*exit_function)(int);
};
/* function definitions */
+#if 1
+void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
+ char *, char *, char *, char *, int);
+#else
void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
char *, char *, char *, char *, char *, int);
+#endif
+
+void SetWindowTitle();
+void InitWindowTitleFunction(char *(*window_title_function)(void));
void InitExitMessageFunction(void (*exit_message_function)(char *, va_list));
void InitExitFunction(void (*exit_function)(int));
void InitPlatformDependentStuff(void);
int main(int argc, char *argv[])
{
- char * window_title_string = getWindowTitleString();
+#if 1
+ InitProgramInfo(argv[0], USERDATA_DIRECTORY, USERDATA_DIRECTORY_UNIX,
+ PROGRAM_TITLE_STRING, ICON_TITLE_STRING,
+ X11_ICON_FILENAME, X11_ICONMASK_FILENAME, SDL_ICON_FILENAME,
+ MSDOS_POINTER_FILENAME,
+ COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
+#else
+ char *window_title_string = getWindowTitleString();
InitProgramInfo(argv[0], USERDATA_DIRECTORY, USERDATA_DIRECTORY_UNIX,
PROGRAM_TITLE_STRING, window_title_string, ICON_TITLE_STRING,
X11_ICON_FILENAME, X11_ICONMASK_FILENAME, SDL_ICON_FILENAME,
MSDOS_POINTER_FILENAME,
COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
+#endif
+ InitWindowTitleFunction(getWindowTitleString);
InitExitMessageFunction(DisplayExitMessage);
InitExitFunction(CloseAllAndExit);
InitPlatformDependentStuff();
{
game_status = GAME_MODE_LEVELNR;
+#if 1
+ ChangeViewportPropertiesIfNeeded();
+#endif
+
DrawChooseLevelNr();
}
else if (pos >= MAIN_CONTROL_NAME && pos <= MAIN_CONTROL_QUIT)
gotoTopLevelDir();
#endif
+#if 1
+ ChangeViewportPropertiesIfNeeded();
+#endif
+
DrawChooseLevelSet();
}
}
{
game_status = GAME_MODE_SCORES;
+#if 1
+ ChangeViewportPropertiesIfNeeded();
+#endif
+
DrawHallOfFame(-1);
}
else if (pos == MAIN_CONTROL_EDITOR)
game_status = GAME_MODE_INFO;
info_mode = INFO_MODE_MAIN;
+#if 1
+ ChangeViewportPropertiesIfNeeded();
+#endif
+
DrawInfoScreen();
}
else if (pos == MAIN_CONTROL_GAME)