add arcade-only build

This commit is contained in:
ohsqueezy 2023-12-26 22:32:40 -05:00
parent 0fd33ee924
commit 690601808c
5 changed files with 52 additions and 15 deletions

View File

@ -52,7 +52,9 @@ WASM_BUILD_DIR := $(BUILD_ROOT)/wasm
WASM_DEBUG_BUILD_DIR := $(BUILD_ROOT)/wasm_debug
WASM_COOLMATH_BUILD_DIR := $(BUILD_ROOT)/wasm_coolmath
WINDOWS_BUILD_DIR := $(BUILD_ROOT)/win32
BUILD_DIRS := $(X86_64_BUILD_DIR) $(X86_64_DEBUG_BUILD_DIR) $(WASM_BUILD_DIR) $(WASM_DEBUG_BUILD_DIR) $(WASM_COOLMATH_BUILD_DIR) $(WINDOWS_BUILD_DIR)
ARCADE_BUILD_DIR := $(BUILD_ROOT)/win32_arcade
BUILD_DIRS := $(X86_64_BUILD_DIR) $(X86_64_DEBUG_BUILD_DIR) $(WASM_BUILD_DIR) $(WASM_DEBUG_BUILD_DIR) $(WASM_COOLMATH_BUILD_DIR) $(WINDOWS_BUILD_DIR) \
$(ARCADE_BUILD_DIR)
$(BUILD_DIRS):
mkdir -p $@
@ -297,20 +299,19 @@ SDL_MINGW := $(SDL_MINGW_ROOT)/SDL2-2.24.2/i686-w64-mingw32
SDL_IMG_MINGW := $(SDL_MINGW_ROOT)/SDL2_image-2.5.2/i686-w64-mingw32
SDL_TTF_MINGW := $(SDL_MINGW_ROOT)/SDL2_ttf-2.0.15/i686-w64-mingw32
SDL_MIXER_MINGW := $(SDL_MINGW_ROOT)/SDL2_mixer-2.5.2/i686-w64-mingw32
WINDOWS_OBJ := $(addprefix $(WINDOWS_BUILD_DIR)/, glew.o SDL2_rotozoom.o SDL2_gfxPrimitives.o $(SB_O_FILES) $(SRC_O_FILES))
WINDOWS_CFLAGS := -Wall -Wextra -O3 -c -I$(SB_LIB_DIR) -I$(SB_SRC_DIR) -DGLEW_STATIC -I$(SDL_MINGW)/include/SDL2 -I$(SDL_IMG_MINGW)/include/SDL2 \
-I$(SDL_TTF_MINGW)/include/SDL2 -I$(SDL_MIXER_MINGW)/include/SDL2
WINDOWS_LFLAGS := -lpthread -lstdc++fs -L$(SDL_MINGW)/lib -L$(SDL_IMG_MINGW)/lib -L$(SDL_TTF_MINGW)/lib -L$(SDL_MIXER_MINGW)/lib -lmingw32 -lSDL2_image \
-lSDL2_ttf -lSDL2_mixer -lSDL2main -lSDL2 -lopengl32 -static-libstdc++ -static-libgcc
# Set the compiler to the MinGW compilers
Cakefoot-win32.exe: CC = i686-w64-mingw32-gcc-posix
Cakefoot-win32.exe: CXX = i686-w64-mingw32-g++-posix
Cakefoot-win32.exe: CFLAGS = -Wall -Wextra -O3 -c -I$(SB_LIB_DIR) -I$(SB_SRC_DIR) -DGLEW_STATIC \
-I$(SDL_MINGW)/include/SDL2 -I$(SDL_IMG_MINGW)/include/SDL2 -I$(SDL_TTF_MINGW)/include/SDL2 -I$(SDL_MIXER_MINGW)/include/SDL2
Cakefoot-win32.exe: CFLAGS = $(WINDOWS_CFLAGS)
Cakefoot-win32.exe: CXXFLAGS = $(CFLAGS) --std=c++17
Cakefoot-win32.exe: LFLAGS = -lpthread -lstdc++fs \
-L$(SDL_MINGW)/lib -L$(SDL_IMG_MINGW)/lib -L$(SDL_TTF_MINGW)/lib -L$(SDL_MIXER_MINGW)/lib -lmingw32 -lSDL2_image \
-lSDL2_ttf -lSDL2_mixer -lSDL2main -lSDL2 -lopengl32 -static-libstdc++ -static-libgcc
Cakefoot-win32.exe: $(WINDOWS_OBJ) config.json
Cakefoot-win32.exe: LFLAGS = $(WINDOWS_LFLAGS)
Cakefoot-win32.exe: $(addprefix $(WINDOWS_BUILD_DIR)/, glew.o SDL2_rotozoom.o SDL2_gfxPrimitives.o $(SB_O_FILES) $(SRC_O_FILES)) config.json
$(CXX) $(filter-out config.json, $^) $(LFLAGS) -o $(WINDOWS_BUILD_DIR)/$@
mkdir ${basename $@}
cp $(SDL_MINGW)/bin/*.dll $(SDL_IMG_MINGW)/bin/*.dll $(SDL_TTF_MINGW)/bin/*.dll $(SDL_MIXER_MINGW)/bin/*.dll ${basename $@}
@ -322,11 +323,29 @@ Cakefoot-win32.exe: $(WINDOWS_OBJ) config.json
rm -rf /tmp/${basename $@}
mv ${@:exe=zip} $(WINDOWS_BUILD_DIR)
Cakefoot-win32-ARCADE_ONLY.exe: CC = i686-w64-mingw32-gcc-posix
Cakefoot-win32-ARCADE_ONLY.exe: CXX = i686-w64-mingw32-g++-posix
Cakefoot-win32-ARCADE_ONLY.exe: CFLAGS = $(WINDOWS_CFLAGS) -D__ARCADE_ONLY__
Cakefoot-win32-ARCADE_ONLY.exe: CXXFLAGS = $(CFLAGS) --std=c++17
Cakefoot-win32-ARCADE_ONLY.exe: LFLAGS = $(WINDOWS_LFLAGS) -D__ARCADE_ONLY__
Cakefoot-win32-ARCADE_ONLY.exe: $(addprefix $(ARCADE_BUILD_DIR)/, glew.o SDL2_rotozoom.o SDL2_gfxPrimitives.o $(SB_O_FILES) $(SRC_O_FILES)) config.json \
src/config_arcade.json
$(CXX) $(filter-out config.json src/config_arcade.json, $^) $(LFLAGS) -o $(ARCADE_BUILD_DIR)/$@
mkdir ${basename $@}
cp $(SDL_MINGW)/bin/*.dll $(SDL_IMG_MINGW)/bin/*.dll $(SDL_TTF_MINGW)/bin/*.dll $(SDL_MIXER_MINGW)/bin/*.dll ${basename $@}
cp /usr/i686-w64-mingw32/lib/libwinpthread-1.dll ${basename $@}
rsync -arRL resource/ src/shaders/ src/config_arcade.json config.json ${basename $@}
mv $(ARCADE_BUILD_DIR)/$@ ${basename $@}
zip -r ${@:exe=zip} ${basename $@}
mv ${basename $@} /tmp
rm -rf /tmp/${basename $@}
mv ${@:exe=zip} $(ARCADE_BUILD_DIR)
###################
# Make all builds #
###################
all : Cakefoot-linux.x86_64 Cakefoot-linux_debug.x86_64 cakefoot.js cakefoot_debug.html cakefoot_coolmath.js Cakefoot-win32.exe
all : Cakefoot-linux.x86_64 Cakefoot-linux_debug.x86_64 cakefoot.js cakefoot_debug.html cakefoot_coolmath.js Cakefoot-win32.exe Cakefoot-win32-ARCADE_ONLY.exe
#########################
# Clean up object files #

2
lib/sb

@ -1 +1 @@
Subproject commit 5d950387a872e6043ea40387bc31b80559084bc6
Subproject commit 11c8abcc5441db15dbdcbb9cce8c42fc37803607

View File

@ -10,9 +10,9 @@
#include "Cakefoot.hpp"
Cakefoot::Cakefoot()
Cakefoot::Cakefoot(std::initializer_list<std::string> configuration_merge) : Game(configuration_merge)
{
#ifdef __ANDROID__
#if defined(__ANDROID__)
SDL_SetHint(SDL_HINT_ORIENTATIONS, "Landscape");
#endif
@ -2804,7 +2804,12 @@ EM_BOOL respond_to_gamepad_connected(int event_type, const EmscriptenGamepadEven
int main()
{
#if defined(__ARCADE_ONLY__)
/* Merge the arcade-only configuration */
Cakefoot game = Cakefoot({"src/config_arcade.json"});
#else
Cakefoot game = Cakefoot();
#endif
game.run();
game.quit();
return 0;

View File

@ -479,9 +479,11 @@ private:
public:
/*!
* Initialize a Cakefoot instance
* Initialize a Cakefoot instance, optionally with extra configuration to merge in after the engine and user configs are loaded.
*
* @param configuration_merge list of file paths with configuration JSON to merge in before the game and engine begins to load
*/
Cakefoot();
Cakefoot(std::initializer_list<std::string> configuration_merge = {});
/*!
* Log detected joysticks and open the first one that is usable as a game controller

11
src/config_arcade.json Normal file
View File

@ -0,0 +1,11 @@
{
"display":
{
"dimensions": [1920, 1080],
"show-cursor": false,
"fullscreen": true,
"arcade only": true,
"use arcade prompt": true,
"qr display": true
}
}