mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Refactor ags_setWindowTitle()
This commit is contained in:
@@ -89,7 +89,9 @@ static void SetWindowTitle(void) { /* 6 */
|
||||
int strno = getCaliValue();
|
||||
int p2 = getCaliValue(); /* ISys3xSystem */
|
||||
|
||||
ags_setWindowTitle(svar_get(strno));
|
||||
char *title_utf8 = toUTF8(svar_get(strno));
|
||||
ags_setWindowTitle(title_utf8);
|
||||
free(title_utf8);
|
||||
|
||||
DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:", strno, p2);
|
||||
}
|
||||
|
||||
@@ -162,19 +162,10 @@ void ags_setViewArea(int x, int y, int width, int height) {
|
||||
sdl_setWindowSize(width, height);
|
||||
}
|
||||
|
||||
void ags_setWindowTitle(const char *src) {
|
||||
#define TITLEHEAD "XSystem35 Version "VERSION":"
|
||||
uint8_t *utf, *d;
|
||||
|
||||
utf = toUTF8(src);
|
||||
if (NULL == (d = malloc(strlen(utf) + strlen(TITLEHEAD) + 1))) {
|
||||
NOMEMERR();
|
||||
}
|
||||
strcpy(d, TITLEHEAD);
|
||||
strcat(d, utf);
|
||||
sdl_setWindowTitle(d);
|
||||
free(utf);
|
||||
free(d);
|
||||
void ags_setWindowTitle(const char *title_utf8) {
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "XSystem35 Version %s: %s", VERSION, title_utf8);
|
||||
sdl_setWindowTitle(buf);
|
||||
}
|
||||
|
||||
void ags_getDIBInfo(DispInfo *info) {
|
||||
|
||||
@@ -133,7 +133,7 @@ void ags_reset(void);
|
||||
/* ウィンド関係 */
|
||||
extern void ags_setWorldSize(int width, int height, int depth);
|
||||
extern void ags_setViewArea(int x, int y, int width, int height);
|
||||
extern void ags_setWindowTitle(const char *str);
|
||||
extern void ags_setWindowTitle(const char *title_utf8);
|
||||
extern void ags_getDIBInfo(DispInfo *info);
|
||||
extern void ags_getWindowInfo(DispInfo *info);
|
||||
extern void ags_getViewAreaInfo(DispInfo *info);
|
||||
|
||||
+1
-1
@@ -419,7 +419,7 @@ void commands2F28() {
|
||||
free(nact->game_title_utf8);
|
||||
nact->game_title_utf8 = toUTF8(title);
|
||||
|
||||
ags_setWindowTitle(title);
|
||||
ags_setWindowTitle(nact->game_title_utf8);
|
||||
|
||||
enable_hack_by_title(nact->game_title_utf8);
|
||||
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ void commandMT() {
|
||||
if (nact->game_title_utf8)
|
||||
free(nact->game_title_utf8);
|
||||
nact->game_title_utf8 = toUTF8(str);
|
||||
ags_setWindowTitle(str);
|
||||
ags_setWindowTitle(nact->game_title_utf8);
|
||||
|
||||
enable_hack_by_title(nact->game_title_utf8);
|
||||
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ static void window_init(const char *render_driver) {
|
||||
#else
|
||||
Uint32 flags = SDL_WINDOW_RESIZABLE;
|
||||
#endif
|
||||
sdl_window = SDL_CreateWindow("XSystem3.5 Version "VERSION,
|
||||
sdl_window = SDL_CreateWindow("XSystem35 Version "VERSION,
|
||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||
SYS35_DEFAULT_WIDTH, SYS35_DEFAULT_HEIGHT,
|
||||
flags);
|
||||
|
||||
Reference in New Issue
Block a user