disable windowing option on platforms that don't need it (e.g. raspberry pi, android)

This commit is contained in:
itsmattkc committed 2025-12-28 20:07:31 -08:00
1 parent 2388c419be
commit a27ba0e646
5 files changed
+31 -9

No files matched your search

+3
View File
@@ -6,5 +6,8 @@ project(GAME)
# include(AndroidNdkModules)
# android_ndk_import_module_cpufeatures()
# Android has no need for a "windowed" option
set(VANILLA_GUI_ENABLE_WINDOWED OFF)
# Your game and its CMakeLists.txt are in a subfolder named "src"
add_subdirectory(../../.. "${CMAKE_SOURCE_DIR}/build")
+1 -1
View File
@@ -14,7 +14,7 @@ endif
VANILLA_LICENSE = GPL-2.0
VANILLA_LICENSE_FILES = LICENSE
VANILLA_CONF_OPTS = -DVANILLA_BUILD_USE_LIBNM=OFF -DVANILLA_BUILD_USE_POLKIT=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DVANILLA_BUILD_USE_VAAPI=OFF
VANILLA_CONF_OPTS = -DVANILLA_BUILD_USE_LIBNM=OFF -DVANILLA_BUILD_USE_POLKIT=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DVANILLA_BUILD_USE_VAAPI=OFF -DVANILLA_GUI_ENABLE_WINDOWED=OFF
VANILLA_SUPPORTS_IN_SOURCE_BUILD = NO
$(eval $(cmake-package))
+5
View File
@@ -356,6 +356,11 @@ if (VANILLA_BUILD_PIPE)
target_compile_definitions(vanilla PRIVATE VANILLA_PIPE_AVAILABLE)
endif()
OPTION(VANILLA_GUI_ENABLE_WINDOWED "Enable windowed mode in Vanilla GUI" ON)
if (VANILLA_GUI_ENABLE_WINDOWED)
target_compile_definitions(vanilla PRIVATE VANILLA_GUI_ENABLE_WINDOWED)
endif()
if (VANILLA_BUILD_USE_POLKIT)
# Find Polkit and GLIB libraries
find_package(PkgConfig REQUIRED)
+8 -3
View File
@@ -47,6 +47,11 @@ int SDL_main(int argc, const char **argv)
// Load config
vpi_config_init();
#ifndef VANILLA_GUI_ENABLE_WINDOWED
// Window mode is disabled, so we'll just enable fullscreen
override_fs = 1;
#endif
// Check if override fullscreen, if so set it in the config, but don't save
if (override_fs != -1) {
vpi_config.fullscreen = override_fs;
@@ -85,7 +90,7 @@ exit:
void display_cli_help(const char **argv) {
vpilog("Usage: %s [options]\n\n", argv[0]);
vpilog("Options:\n");
vpilog(" -w, --window Run Vanilla in a window (overrides config)\n");
vpilog(" -f, --fullscreen Run Vanilla full screen (overrides config)\n");
vpilog(" -h, --help Show this help message\n");
vpilog(" -w, --window Run Vanilla in a window (overrides config)\n");
vpilog(" -f, --fullscreen Run Vanilla full screen (overrides config)\n");
vpilog(" -h, --help Show this help message\n");
}
+14 -5
View File
@@ -119,7 +119,7 @@ void vpi_menu_settings(vui_context_t *vui, void *v)
VPI_LANG_CONNECTION,
VPI_LANG_GAMEPAD,
VPI_LANG_REGION,
VPI_LANG_FULLSCREEN,
-1,
-1,
};
@@ -128,11 +128,17 @@ void vpi_menu_settings(vui_context_t *vui, void *v)
transition_to_connection,
transition_to_gamepad,
transition_to_region,
toggle_fullscreen,
0,
0,
};
int buttons[sizeof(SETTINGS_NAMES) / sizeof(int)];
static const int button_count = sizeof(SETTINGS_NAMES) / sizeof(int);
int buttons[button_count];
#ifdef VANILLA_GUI_ENABLE_WINDOWED
SETTINGS_NAMES[FS_SETTING] = VPI_LANG_FULLSCREEN;
SETTINGS_ACTION[FS_SETTING] = toggle_fullscreen;
#endif
#ifdef VANILLA_POLKIT_AVAILABLE
int pw_skip_str;
@@ -149,15 +155,18 @@ void vpi_menu_settings(vui_context_t *vui, void *v)
int btnw = scrw*3/4;
int btnx = scrw/2 - btnw/2;
int btny = scrh/10;
for (int index = 0; index < sizeof(SETTINGS_NAMES)/sizeof(int); index++) {
for (int index = 0; index < button_count; index++) {
if (SETTINGS_ACTION[index]) {
buttons[index] = vui_button_create(vui, btnx, btny + BTN_SZ * index, btnw, BTN_SZ, lang(SETTINGS_NAMES[index]), 0, VUI_BUTTON_STYLE_BUTTON, fglayer, SETTINGS_ACTION[index], (void *) (intptr_t) fglayer);
buttons[index] = vui_button_create(vui, btnx, btny, btnw, BTN_SZ, lang(SETTINGS_NAMES[index]), 0, VUI_BUTTON_STYLE_BUTTON, fglayer, SETTINGS_ACTION[index], (void *) (intptr_t) fglayer);
btny += BTN_SZ;
}
}
#ifdef VANILLA_GUI_ENABLE_WINDOWED
// Make full screen button checkable
vui_button_update_checkable(vui, buttons[FS_SETTING], 1);
vui_button_update_checked(vui, buttons[FS_SETTING], vpi_config.fullscreen);
#endif
// Back button
vpi_menu_create_back_button(vui, fglayer, return_to_main, (void *) (intptr_t) fglayer);