-
Notifications
You must be signed in to change notification settings - Fork 0
Example Code
Grisgram edited this page May 9, 2025
·
4 revisions
Here are some examples, what you could do at startup of your game:
Command line given: yourgame.exe --fullscreen or yourgame.exe --windowed
// CASE 1: allow fullscreen switch if windowed is default
if (ARGS.has_option("fullscreen"))
window_set_fullscreen(true);
// or CASE 2: allow windowed mode, if fullscreen is default
if (ARGS.has_option("windowed"))
window_set_fullscreen(false);Command line given: yourgame.exe -w=1280 -h=720
if (ARGS.has_command("w") && ARGS.has_command("h")) {
window_set_fullscreen(false);
window_set_size(
ARGS.get_command("w").value,
ARGS.get_command("h").value
);
}Command line given: yourgame.exe --offline
if (!ARGS.has_option("offline")) room_goto(rmLogin); else room_goto(rmMain);Command line given: yourgame.exe +verbose
global.verbose_log = ARGS.is_switch_enabled("verbose");Command line given: yourgame.exe -software
if (has_switch("software")) global.shader_details = false; Sometimes you might want to receive "just a file name" or other things, that are not in the pattern of a command, a switch or an option.
You can always analyze the commandline by yourself. Just loop through the args array:
for (var i = 0; i < ARGS.count; i++) {
var arg = ARGS.args[@i];
// ... do whatever you want
}
© 2024-