From 7d9a85dbbd43f7dd26ef5ce07b2772bbd1e59a3a Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Mon, 11 Dec 2017 00:48:35 +0100 Subject: [PATCH] Config: Add entry to override the game window title --- mkxp.conf.sample | 6 ++++++ src/config.cpp | 1 + src/config.h | 1 + src/main.cpp | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mkxp.conf.sample b/mkxp.conf.sample index 500dcc6..2d9ad45 100644 --- a/mkxp.conf.sample +++ b/mkxp.conf.sample @@ -77,6 +77,12 @@ # defScreenW=640 +# Override the game window title +# (default: none) +# +# windowTitle=Custom Title + + # Specify the window height on startup. If set to 0, # it will default to the default resolution height # specific to the RGSS version (480 in RGSS1, 416 diff --git a/src/config.cpp b/src/config.cpp index 33d8160..4d47152 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -161,6 +161,7 @@ void Config::read(int argc, char *argv[]) PO_DESC(vsync, bool, false) \ PO_DESC(defScreenW, int, 0) \ PO_DESC(defScreenH, int, 0) \ + PO_DESC(windowTitle, std::string, "") \ PO_DESC(fixedFramerate, int, 0) \ PO_DESC(frameSkip, bool, true) \ PO_DESC(syncToRefreshrate, bool, false) \ diff --git a/src/config.h b/src/config.h index d2d4650..5cc8bb7 100644 --- a/src/config.h +++ b/src/config.h @@ -41,6 +41,7 @@ struct Config int defScreenW; int defScreenH; + std::string windowTitle; int fixedFramerate; bool frameSkip; diff --git a/src/main.cpp b/src/main.cpp index 1a3fc4e..40ae391 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -233,6 +233,9 @@ int main(int argc, char *argv[]) conf.readGameINI(); + if (conf.windowTitle.empty()) + conf.windowTitle = conf.game.title; + assert(conf.rgssVersion >= 1 && conf.rgssVersion <= 3); printRgssVersion(conf.rgssVersion); @@ -272,7 +275,7 @@ int main(int argc, char *argv[]) if (conf.fullscreen) winFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; - win = SDL_CreateWindow(conf.game.title.c_str(), + win = SDL_CreateWindow(conf.windowTitle.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, conf.defScreenW, conf.defScreenH, winFlags);