mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-22 18:31:44 +00:00
Add support for -t / -title.
This commit is contained in:
parent
0187073ae0
commit
6604b3dd06
22
src/main.c
22
src/main.c
@ -239,7 +239,7 @@ int flushing = FALSE; /* see dbprint.h if set, all debug/trace printing will cal
|
||||
extern DspInterface currentdsp;
|
||||
#endif /* DOS || XWINDOW */
|
||||
#ifdef SDL
|
||||
extern int init_SDL(int, int, int);
|
||||
extern int init_SDL(char*, int, int, int);
|
||||
#endif
|
||||
extern const time_t MDate;
|
||||
extern int nokbdflag;
|
||||
@ -284,7 +284,9 @@ const char *helpstring =
|
||||
-info Print general info about the system\n\
|
||||
-help Print this message\n\
|
||||
-pixelscale <n> The amount of pixels to show for one Medley screen pixel.\n\
|
||||
-sc[reen] <w>x<h>] The Medley screen geometry\n";
|
||||
-sc[reen] <w>x<h>] The Medley screen geometry\n\
|
||||
-t <title> The window title\n\
|
||||
-title <title> The window title\n";
|
||||
#else /* not DOS, not XWINDOW, not SDL */
|
||||
const char *helpstring =
|
||||
"\n\
|
||||
@ -326,6 +328,7 @@ int main(int argc, char *argv[])
|
||||
long tmpint;
|
||||
int width = 1024, height = 768;
|
||||
int pixelscale = 1;
|
||||
char *windowtitle = "Medley";
|
||||
|
||||
#ifdef MAIKO_ENABLE_FOREIGN_FUNCTION_INTERFACE
|
||||
if (dld_find_executable(argv[0]) == 0) {
|
||||
@ -463,7 +466,7 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Missing argument after -m\n");
|
||||
fprintf(stderr, "Missing argument after -sc\n");
|
||||
exit(1);
|
||||
}
|
||||
} else if ((strcmp(argv[i], "-pixelscale") == 0) || (strcmp(argv[i], "-PIXELSCALE") == 0)) {
|
||||
@ -474,10 +477,19 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Missing argument after -m\n");
|
||||
fprintf(stderr, "Missing argument after -pixelscale\n");
|
||||
exit(1);
|
||||
}
|
||||
} else if ((strcmp(argv[i], "-t") == 0) || (strcmp(argv[i], "-T") == 0)
|
||||
|| (strcmp(argv[i], "-title") == 0) || (strcmp(argv[i], "-TITLE") == 0)) {
|
||||
if (argc > ++i) {
|
||||
windowtitle = argv[i];
|
||||
} else {
|
||||
fprintf(stderr, "Missing argument after -title\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SDL */
|
||||
/* Can only do this under SUNOs, for now */
|
||||
else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/
|
||||
@ -637,7 +649,7 @@ int main(int argc, char *argv[])
|
||||
make_dsp_instance(currentdsp, 0, 0, 0, 1); /* All defaults the first time */
|
||||
#endif /* DOS || XWINDOW */
|
||||
#if defined(SDL)
|
||||
init_SDL(width, height, pixelscale);
|
||||
init_SDL(windowtitle, width, height, pixelscale);
|
||||
#endif /* SDL */
|
||||
/* Load sysout to VM space and returns real sysout_size(not 0) */
|
||||
sysout_size = sysout_loader(sysout_name, sysout_size);
|
||||
|
||||
@ -445,7 +445,7 @@ void process_SDLevents() {
|
||||
// printf("rendering took %dms\n", after - before);
|
||||
}
|
||||
}
|
||||
int init_SDL(int w, int h, int s) {
|
||||
int init_SDL(char *windowtitle, int w, int h, int s) {
|
||||
sdl_pixelscale = s;
|
||||
// must be multiples of 32
|
||||
w = w / 32 * 32;
|
||||
@ -462,7 +462,7 @@ int init_SDL(int w, int h, int s) {
|
||||
return 1;
|
||||
}
|
||||
printf("initialised\n");
|
||||
sdl_window = SDL_CreateWindow("Maiko", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, sdl_windowwidth, sdl_windowheight, 0);
|
||||
sdl_window = SDL_CreateWindow(windowtitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, sdl_windowwidth, sdl_windowheight, 0);
|
||||
printf("Window created\n");
|
||||
if(sdl_window == NULL) {
|
||||
printf("Window could not be created. SDL_Error: %s\n", SDL_GetError());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user