separate shaders for GLES and GL, add MacOS build

This commit is contained in:
ohsqueezy 2024-04-24 15:04:11 -04:00
parent 8b2125f606
commit 279c7c83b8
17 changed files with 210 additions and 48 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ storage/
Play_History.json
press.html
feed
test.html

View File

@ -29,8 +29,8 @@ SDLGFX2_DIR := $(SB_LIB_DIR)/sdl2-gfx
GLEW_DIR := $(SB_LIB_DIR)/glew
# C and C++ compiler commands
CC := gcc-12
CXX := g++-12
CC := clang
CXX := clang++
# Location of SDL config program. See README.md for how to compile the SDL library and this utility. Define SDL_BIN_DIR when invoking
# make to use an alternate SDL installation location.
@ -67,8 +67,9 @@ ARCADE_BUILD_DIR := $(BUILD_ROOT)/win32_arcade
DEMO_BUILD_DIR := $(BUILD_ROOT)/win32_demo
WIN64_BUILD_DIR := $(BUILD_ROOT)/win64
UBUNTU18_BUILD_DIR := $(BUILD_ROOT)/ubuntu18
MACOS_BUILD_DIR := $(BUILD_ROOT)/macos
BUILD_DIRS := $(X64_BUILD_DIR) $(X64_DEBUG_BUILD_DIR) $(WASM_BUILD_DIR) $(WASM_DEBUG_BUILD_DIR) $(WASM_COOLMATH_BUILD_DIR) \
$(WINDOWS_BUILD_DIR) $(ARCADE_BUILD_DIR) $(DEMO_BUILD_DIR) $(WIN64_BUILD_DIR) $(UBUNTU_BUILD_DIR)
$(WINDOWS_BUILD_DIR) $(ARCADE_BUILD_DIR) $(DEMO_BUILD_DIR) $(WIN64_BUILD_DIR) $(UBUNTU_BUILD_DIR) $(MACOS_BUILD_DIR)
$(BUILD_DIRS):
mkdir -p $@
@ -289,6 +290,52 @@ cakefoot_coolmath.js : $(addprefix $(WASM_COOLMATH_BUILD_DIR)/, SDL2_rotozoom.o
zip -r Cakefoot_coolmath.zip cakefoot_coolmath.data cakefoot_coolmath.js cakefoot_coolmath.wasm index.html && \
rm cakefoot_coolmath.data cakefoot_coolmath.js cakefoot_coolmath.wasm index.html && cd -
###############
# MacOS build #
###############
# This is intended to build a signed MacOS universal (x86_64 and arm64 in one) application bundle on Linux using the cross-compiler
# project osxcross (https://github.com/tpoechtrager/osxcross). It could probably be edited to work with any MacOS compiler, though.
# The program rcodesign (https://gregoryszorc.com/docs/apple-codesign/0.27.0/apple_codesign_getting_started.html) is required for
# signing the application bundle along with a certificate generated through Apple's developer tools portal.
MACOS_CROSS_ROOT = /media/gdrive/osxcross
MACOS_CROSS_FW = $(MACOS_CROSS_ROOT)/local/Frameworks
MACOS_CFLAGS = -Wall -Wextra -O3 -c -I$(SB_LIB_DIR) -I$(SB_SRC_DIR) -DGLEW_STATIC -F$(MACOS_CROSS_FW) \
-I$(MACOS_CROSS_FW)/SDL2.framework/Headers -I$(MACOS_CROSS_FW)/SDL2_image.framework/Headers \
-I$(MACOS_CROSS_FW)/SDL2_ttf.framework/Headers -I$(MACOS_CROSS_FW)/SDL2_mixer.framework/Headers -D__MACOS__ -D__APPLE__
MACOS_CXXFLAGS = $(CFLAGS) --std=c++17
MACOS_LFLAGS = -Wl,-rpath,@executable_path/../Frameworks -pthread -F$(MACOS_CROSS_FW) -framework SDL2 \
-framework SDL2_image -framework SDL2_ttf -framework SDL2_mixer -framework OpenGL
MACOS_OBJ = $(addprefix $(MACOS_BUILD_DIR)/, glew.o SDL2_rotozoom.o SDL2_gfxPrimitives.o $(SB_O_FILES) $(SRC_O_FILES))
MACOS_BUNDLE = $(MACOS_BUILD_DIR)/dmg/$@
MACOS_BUNDLE_CONTENTS = $(MACOS_BUILD_DIR)/dmg/$@/Contents
MACOS_CROSS_BIN = $(MACOS_CROSS_ROOT)/target/bin
MACOS_CERTIFICATE = local/Cakefoot_MacOS_DeveloperID_Application.pem
MACOS_RCODESIGN = ~/ext/software/apple-codesign-0.27.0/rcodesign
Cakefoot.app : CC = MACOSX_DEPLOYMENT_TARGET=11.3 PATH=$(PATH):$(MACOS_CROSS_BIN) o64-clang -arch arm64 -arch x86_64
Cakefoot.app : CXX = MACOSX_DEPLOYMENT_TARGET=11.3 PATH=$(PATH):$(MACOS_CROSS_BIN) o64-clang++ -arch arm64 -arch x86_64
Cakefoot.app : CFLAGS = $(MACOS_CFLAGS)
Cakefoot.app : CXXFLAGS = $(MACOS_CXXFLAGS)
Cakefoot.app : LFLAGS = $(MACOS_LFLAGS)
Cakefoot.app : $(MACOS_OBJ)
mkdir -p $(MACOS_BUNDLE_CONTENTS)/MacOS $(MACOS_BUNDLE_CONTENTS)/Frameworks $(MACOS_BUNDLE_CONTENTS)/Resources
cp src/Info.plist $(MACOS_BUNDLE_CONTENTS)
cp -r $(MACOS_CROSS_FW)/SDL2*.framework $(MACOS_BUNDLE_CONTENTS)/Frameworks
$(CXX) $^ $(LFLAGS) -o $(MACOS_BUNDLE_CONTENTS)/MacOS/$(basename $@)
rsync -arRL resource/ src/shaders/ config.json $(MACOS_BUNDLE_CONTENTS)/Resources
$(MACOS_RCODESIGN) sign --for-notarization --code-signature-flags runtime --pem-file $(MACOS_CERTIFICATE) $(MACOS_BUNDLE)
notarize :
$(MACOS_RCODESIGN) notary-submit --api-key-file local/Cakefoot_App_Store_Connect_API_key.json --staple \
$(MACOS_BUILD_DIR)/dmg/Cakefoot.app
cd $(MACOS_BUILD_DIR) && genisoimage -V Cakefoot -D -R -apple -no-pad -hide-rr-moved -o Cakefoot.dmg dmg && cd -
# Use this to transfer the app folder with symbolic links to the emulator running at port 50922
#
# rsync -Wav -e 'ssh -p 50922' --progress build/macos/dmg/Cakefoot.app frank@localhost:/Users/frank/
#################
# Android build #
#################

View File

@ -14,8 +14,9 @@
| | [Cakefoot on IGDB](https://www.igdb.com/games/cakefoot) |
| Genre | Action, Arcade, Rage, Minimalist, Single-button, Masocore |
| Platforms | Web, PC, Mac, Linux, [Coolmathgames](https://coolmathgames.com) |
| Release | 📅 January 1st, 2024 (Early Access) |
| | 📅 May 10th, 2024 (Web, PC, Mac, Linux) |
| Release | 📅 1/1/2024 (Early Access) |
| | 📅 5/10/2024 (Web, PC, Mac, Linux) |
| | 📅 TBA (Android) |
| Price | Free-to-play, Ad-supported (Web) |
| | $2.99 (Downloadable) |
| E-mail | 📧 cocktail.frank at dank.game |
@ -104,6 +105,18 @@ Gameplay video
News
====
### Cakefoot was reviewed in ###
* [Fusion R Gamer](https://fusionrgamer.com/2024/04/17/cakefoot-ultrahard-avoid-em-up-heading-to-steam/)
* [Hardcore Gamers Unified](https://www.hgunified.com/home/preview-cakefoot-pc.html)
### Steam curators have recommended Cakefoot ###
* [INDIEstructible](https://store.steampowered.com/curator/41972991-INDIEstructible/)
* [linuxgamer](https://store.steampowered.com/curator/7014924-linuxgamer/)
* [Cue Review](https://store.steampowered.com/curator/6857352-Cue-Review/)
* [CSH Picone](https://store.steampowered.com/curator/27440015-CSH-Picone/)
### Cake day ###
Cakefoot will be playable at the [cake day event](https://www.instagram.com/p/C40yS-cOp4e/) for Boshi's Place in Brooklyn, NY on Saturday, April 6th, starting at 7pm!
@ -147,7 +160,7 @@ A custom game engine called [SPACE🪐BOX](https://open.shampoo.ooo/shampoo/spac
Review Builds
=============
Download keys are available for the Steam version, send me a message at cocktail.frank at dank.game
Free keys are available for the Steam version, and free downloads are available for PC, MacOS, and Linux. Send me a message at cocktail.frank at dank.game!
Logo
====

View File

@ -28,7 +28,7 @@
"hitbox": false,
"use play button": false,
"arcade only": false,
"use arcade prompt": false,
"use arcade prompt": true,
"game over text": "GAME OVER",
"game over display time": 2.5,
"game over foreground": [255.0, 255.0, 255.0, 255.0],
@ -54,7 +54,7 @@
"scoreboard translation": [-0.4, 0.835],
"scoreboard scale": [1.35, 0.14],
"scoreboard wrap": 3000,
"qr display": false,
"qr display": true,
"qr background display": true,
"qr background texture": "resource/qr_background.png",
"qr texture": "resource/qr.png",
@ -98,6 +98,12 @@
"social media click": false
},
"shader":
{
"vertex": "src/shaders/gl/shader.vert",
"fragment": "src/shaders/gl/shader.frag"
},
"configuration":
{
"auto refresh": true,
@ -450,9 +456,9 @@
"demo":
{
"active": false,
"idle timeout": 25.0,
"countdown display timeout": 5.0,
"active": true,
"idle timeout": 30.0,
"countdown display timeout": 10.0,
"countdown message": "IDLE RESET IN ",
"message translation": [0.0, 0.83],
"message scale": [1.05, 0.14]

2
lib/sb

@ -1 +1 @@
Subproject commit 87a946a61eb1e126131c3d24fd87f28af2cbcb6e
Subproject commit 8498dfa00472431a6dd8a2ec588f0792a9e435dc

BIN
resource/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -355,8 +355,8 @@ void Cakefoot::initialize_gl()
sb::Log::gl_errors("after binding VAO");
/* Load shader program */
GLuint vertex_shader = load_shader("src/shaders/shader.vert", GL_VERTEX_SHADER);
GLuint fragment_shader = load_shader("src/shaders/shader.frag", GL_FRAGMENT_SHADER);
GLuint vertex_shader = load_shader(configuration()("shader", "vertex"), GL_VERTEX_SHADER);
GLuint fragment_shader = load_shader(configuration()("shader", "fragment"), GL_FRAGMENT_SHADER);
shader_program = glCreateProgram();
glAttachShader(shader_program, vertex_shader);
sb::Log::gl_errors("after loading vertex shader");
@ -2218,7 +2218,8 @@ void Cakefoot::respond(SDL_Event& event)
}
/* Start character acceleration */
bool acceleration_pressed = ((event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT) || sb::Delegate::compare(event, "any"));
bool acceleration_pressed = (
(event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_LEFT) || sb::Delegate::compare(event, "any"));
if (!shift_pressed && !button_pressed && acceleration_pressed)
{
character.accelerating = true;
@ -2375,7 +2376,7 @@ void Cakefoot::respond(SDL_Event& event)
set_up_hud();
}
#if !defined(__MINGW32__)
#if !defined(__MINGW32__) && !defined(__MACOS__)
/* Taken from mallinfo man page, log a profile of the memory when the command is sent. */
else if (sb::Delegate::compare(event, "memory"))
{
@ -2592,12 +2593,15 @@ void Cakefoot::update(float timestamp)
unpaused_timer.update(timestamp);
idle_timer.update(timestamp);
/* In demo mode, reset if playing and idle timeout elapsed */
if (level_index > 0 && configuration()("demo", "active") &&
idle_timer.elapsed() > configuration()("demo", "idle timeout"))
/* In demo mode, reset game if idle timeout elapsed, or reset idle timer if character is accelerating */
if (level_index > 0 && configuration()("demo", "active") && idle_timer.elapsed() > configuration()("demo", "idle timeout"))
{
sb::Delegate::post("reset");
}
else if (character.accelerating)
{
idle_timer.reset();
}
/* Arcade scoring */
auto& maximum_distance = configuration()["progress"]["arcade max distance"].get_ref<nlohmann::json::number_integer_t&>();

View File

@ -17,7 +17,9 @@
#include <map>
#include <memory>
#include <functional>
#if !defined(__MACOS__)
#include <malloc.h>
#endif
#include <chrono>
#include <ctime>

View File

@ -41,9 +41,11 @@ private:
sb::Animation walk;
/*!
* A JSON object containing the fields: name, speed increment, speed decrement, max speed, increment mod, decrement mod, and animation frames.
* This will use the profile name set by Character::profile(const std::string&) to get the associated profile in Character::configuration at
* `character -> profile`.
* A JSON object containing the fields: name, speed increment, speed decrement, max speed, increment mod, decrement mod, and
* animation frames.
*
* This will use the profile name set by Character::profile(const std::string&) to get the associated profile in
* Character::configuration at `character -> profile`.
*
* @return JSON containing the currently selected profile name along with physics and texture values
*/
@ -67,15 +69,15 @@ public:
Character(const Configuration& configuration, std::map<std::string, sb::audio::Chunk>& audio);
/*!
* Change the character's physics and texture by specifying a profile name. The name refers to a JSON profile stored in an array of profiles
* in `Character::configuration` at `character -> profile`. The JSON for each profile is expected to contain the following fields: name, speed
* increment, speed decrement, max speed, increment mod, decrement mod, and animation frames.
* Change the character's physics and texture by specifying a profile name. The name refers to a JSON profile stored in an array of
* profiles in `Character::configuration` at `character -> profile`. The JSON for each profile is expected to contain the following
* fields: name, speed increment, speed decrement, max speed, increment mod, decrement mod, and animation frames.
*
* The character will refer to the given profile when accessing the profile in other calls. No physics values are directly modified by this
* function. This is done so external changes to the configuration can be registered automatically during runtime.
* The character will refer to the given profile when accessing the profile in other calls. No physics values are directly modified
* by this function. This is done so external changes to the configuration can be registered automatically during runtime.
*
* However, the texture will be directly modified because re-reading the texture every frame is too slow. To automate re-reading the texture,
* insert a hook into the game's update loop that runs this function every time a configuration modification is detected.
* However, the texture will be directly modified because re-reading the texture every frame is too slow. To automate re-reading the
* texture, insert a hook into the game's update loop that runs this function every time a configuration modification is detected.
*
* @param name String in the name field of the chosen profile in the list of profiles at `character -> profile`
*/
@ -162,5 +164,6 @@ public:
* @param projection projection transformation matrix
* @param texture_flag_uniform uniform location in the shader program of the boolean that turns texture drawing on or off
*/
void draw(const Curve& curve, GLuint transformation_uniform, const glm::mat4& view, const glm::mat4& projection, GLuint texture_flag_uniform);
void draw(const Curve& curve, GLuint transformation_uniform, const glm::mat4& view, const glm::mat4& projection,
GLuint texture_flag_uniform);
};

18
src/Info.plist Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Cakefoot</string>
<key>CFBundleExecutable</key>
<string>Cakefoot</string>
<key>CFBundleIdentifier</key>
<string>com.dank.Cakefoot</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleIconFile</key>
<string>resource/icon.png</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>

View File

@ -9,6 +9,12 @@
"title": "Cakefoot 🍰😈 | Rage game | Wishlist now on Steam!"
},
"shader":
{
"vertex": "src/shaders/gles/shader.vert",
"fragment": "src/shaders/gles/shader.frag"
},
"recording":
{
"enabled": false

View File

@ -0,0 +1,23 @@
#version 150
/* https://open.shampoo.ooo/shampoo/cakefoot */
/* The precision declaration is required by OpenGL ES */
precision mediump float;
in vec2 fragment_uv;
in vec4 ex_color;
uniform sampler2D model_texture;
uniform int uv_transformation;
uniform float coordinate_bound;
uniform bool texture_enabled;
uniform vec4 color_addition;
out vec4 output_color;
void main()
{
output_color = float(texture_enabled) * (texture(model_texture, fragment_uv) + color_addition);
output_color += (1.0 - float(texture_enabled)) * (ex_color + color_addition);
}

View File

@ -0,0 +1,26 @@
#version 150
/* https://open.shampoo.ooo/shampoo/cakefoot */
/* The precision declaration is required by OpenGL ES */
precision mediump float;
in vec3 vertex_position;
in vec4 vertex_color;
in vec2 vertex_uv;
uniform mat4 mvp;
uniform float time;
out vec4 ex_color;
out vec2 fragment_uv;
void main()
{
gl_Position = vec4(vertex_position, 1);
gl_Position = mvp * gl_Position;
/* passing to fragment program */
ex_color = vertex_color;
fragment_uv = vertex_uv;
}

View File

@ -1,6 +1,6 @@
#version 300 es
/* https://foam.ooo/cakefoot */
/* https://open.shampoo.ooo/shampoo/cakefoot */
/* The precision declaration is required by OpenGL ES */
precision mediump float;

View File

@ -1,6 +1,6 @@
#version 300 es
/* https://foam.ooo/cakefoot */
/* https://open.shampoo.ooo/shampoo/cakefoot */
/* The precision declaration is required by OpenGL ES */
precision mediump float;

View File

@ -1,40 +1,50 @@
"AppBuild"
{
"AppID" "2869020" // your AppID
"Desc" "Cakefoot on Windows, MacOS, and Linux for Steam" // internal description for this build
"AppID" "2869020" // AppID
"Desc" "Cakefoot on Windows, MacOS, and Linux for Steam" // internal description for this build
"ContentRoot" "../dist/protected/" // root content folder, relative to location of this file
"BuildOutput" "../local/steam-sdk-output/" // build output folder for build logs and build cache files
"ContentRoot" "../dist/protected/" // root content folder, relative to location of this file
"BuildOutput" "../local/steam-sdk-output/" // build output folder for build logs and build cache files
"Depots"
{
"2869022" // your DepotID
"2869022" // DepotID
{
"FileMapping"
{
"LocalPath" "Cakefoot-linux/*" // all files from contentroot folder
"DepotPath" "." // mapped into the root of the depot
"recursive" "1" // include all subfolders
"LocalPath" "Cakefoot-linux/*" // all files from contentroot folder
"DepotPath" "." // mapped into the root of the depot
"recursive" "1" // include all subfolders
}
}
"2869023" // your DepotID
"2869023" // DepotID
{
"FileMapping"
{
"LocalPath" "Cakefoot-win64/*" // all files from contentroot folder
"DepotPath" "." // mapped into the root of the depot
"recursive" "1" // include all subfolders
"LocalPath" "Cakefoot-win64/*" // all files from contentroot folder
"DepotPath" "." // mapped into the root of the depot
"recursive" "1" // include all subfolders
}
}
"2869024" // your DepotID
"2869024" // DepotID
{
"FileMapping"
{
"LocalPath" "Cakefoot-win32/*" // all files from contentroot folder
"DepotPath" "." // mapped into the root of the depot
"recursive" "1" // include all subfolders
"LocalPath" "Cakefoot-win32/*" // all files from contentroot folder
"DepotPath" "." // mapped into the root of the depot
"recursive" "1" // include all subfolders
}
}
"2869025" // DepotID
{
"FileMapping"
{
"LocalPath" "dmg/*" // all files from contentroot folder
"DepotPath" "." // mapped into the root of the depot
"recursive" "1" // include all subfolders
}
}
}

View File

@ -3,8 +3,11 @@
unzip -d dist/protected/ dist/protected/Cakefoot-linux.zip
unzip -d dist/protected/ dist/protected/Cakefoot-win32.zip
unzip -d dist/protected/ dist/protected/Cakefoot-win64.zip
mkdir -p dist/protected/dmg
7z x -odist/protected/dmg/ dist/protected/Cakefoot.dmg
bash $HOME/ext/software/steamworks/sdk/tools/ContentBuilder/builder_linux/steamcmd.sh +login tarecontrol +run_app_build \
$(pwd)/src/steam_app_build.vdf +quit
mv dist/protected/Cakefoot-linux /tmp && rm -rf /tmp/Cakefoot-linux
mv dist/protected/Cakefoot-win32 /tmp && rm -rf /tmp/Cakefoot-win32
mv dist/protected/Cakefoot-win64 /tmp && rm -rf /tmp/Cakefoot-win64
mv dist/protected/dmg /tmp && rm -rf /tmp/dmg