Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow choice of foreground and background colors for Medley X11/SDL display #511

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ 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\
-fg/-foreground <color> Screen foreground color, default Black. X color name or #RRBBGG hex\n\
-bg/-background <color> Screen background color, default White. X color name or #RRBBGG hex\n\
-sc[reen] <w>x<h>] The Medley screen geometry\n\
-t <title> The window title\n\
-title <title> The window title\n";
Expand Down Expand Up @@ -316,6 +318,12 @@ const char *nethubHelpstring = "";
extern int insnsCountdownForTimerAsyncEmulation;
#endif

#if defined(XWINDOW) || defined(SDL)
char foregroundColorName[64] = {0};
extern char foregroundColorName[64];
char backgroundColorName[64] = {0};
extern char backgroundColorName[64];
#endif
/************************************************************************/
/* */
/* M A I N E N T R Y P O I N T */
Expand Down Expand Up @@ -488,8 +496,21 @@ int main(int argc, char *argv[])
(void)fprintf(stderr, "Missing argument after -title\n");
exit(1);
}
} else if (strcmp(argv[i], "-fg") == 0 || strcmp(argv[i], "-foreground") == 0) {
if (argc > ++i) {
strncpy(foregroundColorName, argv[i], sizeof(foregroundColorName) - 1);
} else {
(void)fprintf(stderr, "Missing argument after -fg/-foreground\n");
exit(1);
}
} else if (strcmp(argv[i], "-bg") == 0 || strcmp(argv[i], "-background") == 0) {
if (argc > ++i) {
strncpy(backgroundColorName, argv[i], sizeof(backgroundColorName) - 1);
} else {
(void)fprintf(stderr, "Missing argument after -bg/-background\n");
exit(1);
}
}

#endif /* SDL */
/* Can only do this under SUNOs, for now */
else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/
Expand Down
Loading