added splash screens
This commit is contained in:
parent
9fa8051b06
commit
280fc0e0b8
5
Makefile
5
Makefile
|
@ -226,8 +226,9 @@ cakefoot_coolmath.js : CXX = $(EMSCRIPTENHOME)/em++
|
|||
cakefoot_coolmath.js : CFLAGS = $(EMSCRIPTEN_CFLAGS) -D__COOLMATH__
|
||||
cakefoot_coolmath.js : CXXFLAGS = $(CFLAGS) --std=c++17
|
||||
cakefoot_coolmath.js : EMSCRIPTEN_GAME_CONFIGS += src/config_coolmath.json
|
||||
cakefoot_coolmath.js : $(addprefix $(WASM_COOLMATH_BUILD_DIR)/, SDL2_rotozoom.o SDL2_gfxPrimitives.o $(SB_O_FILES) $(SRC_O_FILES)) $(EMSCRIPTEN_GAME_CONFIGS)
|
||||
$(CXX) $(filter-out $(EMSCRIPTEN_GAME_CONFIGS), $^) $(CXXFLAGS) $(EMSCRIPTEN_LFLAGS) -D__COOLMATH__ $(EMSCRIPTEN_PRELOADS) \
|
||||
cakefoot_coolmath.js : $(addprefix $(WASM_COOLMATH_BUILD_DIR)/, SDL2_rotozoom.o SDL2_gfxPrimitives.o $(SB_O_FILES) $(SRC_O_FILES)) $(EMSCRIPTEN_GAME_CONFIGS) \
|
||||
src/index_coolmath.html
|
||||
$(CXX) $(filter-out $(EMSCRIPTEN_GAME_CONFIGS) src/index_coolmath.html, $^) $(CXXFLAGS) $(EMSCRIPTEN_LFLAGS) -D__COOLMATH__ $(EMSCRIPTEN_PRELOADS) \
|
||||
--preload-file "src/config_coolmath.json" -o $(WASM_COOLMATH_BUILD_DIR)/$@
|
||||
cp src/index_coolmath.html $(WASM_COOLMATH_BUILD_DIR)/index.html
|
||||
cd $(WASM_COOLMATH_BUILD_DIR) && \
|
||||
|
|
|
@ -74,7 +74,10 @@
|
|||
"flash length": 1.1,
|
||||
"flash darken factor": 2.0,
|
||||
"fullscreen enabled": true,
|
||||
"blink frequency": 0.35
|
||||
"blink frequency": 0.35,
|
||||
"splash": [
|
||||
["resource/splash_spacebox.png", [110.0, 161.0, 201.0, 255.0], 2.0]
|
||||
]
|
||||
},
|
||||
|
||||
"configuration":
|
||||
|
|
2
lib/sb
2
lib/sb
|
@ -1 +1 @@
|
|||
Subproject commit 1fff973b46684277e34c2a78ab857fa4766ca5e5
|
||||
Subproject commit 923c805fe5d9283497747e2ccfc581abb6cca177
|
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
After Width: | Height: | Size: 356 KiB |
894
src/Cakefoot.cpp
894
src/Cakefoot.cpp
File diff suppressed because it is too large
Load Diff
|
@ -161,6 +161,16 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
* Image to display at game start up, includes a background color and length in seconds to display.
|
||||
*/
|
||||
struct Splash
|
||||
{
|
||||
sb::Sprite sprite;
|
||||
sb::Color background;
|
||||
float length;
|
||||
};
|
||||
|
||||
/*!
|
||||
* The main game object. There is currently only support for one of these to exist at a time.
|
||||
*
|
||||
|
@ -192,7 +202,7 @@ private:
|
|||
/* Member vars */
|
||||
std::shared_ptr<SDL_Cursor> poke, grab;
|
||||
int previous_frames_per_second = 0, curve_index = 0, curve_byte_count = 0, level_index = 0, level_select_index = 1, profile_index = 0,
|
||||
challenge_index = 0, view_index = 0, name_entry_index = 0;
|
||||
challenge_index = 0, view_index = 0, name_entry_index = 0, splash_index = 0;
|
||||
std::map<std::string, GLuint> uniform;
|
||||
GLuint shader_program;
|
||||
glm::mat4 view {1.0f}, projection {1.0f};
|
||||
|
@ -265,6 +275,7 @@ private:
|
|||
std::optional<std::string> selected;
|
||||
std::shared_ptr<SDL_GameController> controller = nullptr;
|
||||
std::optional<float> pre_ad_volume = std::nullopt;
|
||||
std::vector<Splash> splash;
|
||||
|
||||
/*!
|
||||
* Load sound effects and music into objects that can be used by the SDL mixer library. Use chunk objects for background music instead of
|
||||
|
@ -456,6 +467,14 @@ private:
|
|||
/* Count a cooldown period for gamepad axes */
|
||||
Animation cooldown_animation;
|
||||
|
||||
/*!
|
||||
* Display next splash image.
|
||||
*/
|
||||
void next_splash();
|
||||
|
||||
/* Display splash images in succession until all splash images have been displayed. */
|
||||
Animation splash_animation {std::bind(&Cakefoot::next_splash, this)};
|
||||
|
||||
/*!
|
||||
* Get the arcade time as the amount of time remaining before the limit is reached.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
{
|
||||
"dimensions": [800, 450],
|
||||
"title": "cakefoot🍰👣 – Play it now at CoolmathGames.com",
|
||||
"fullscreen enabled": false
|
||||
"fullscreen enabled": false,
|
||||
"splash": [
|
||||
["resource/splash_coolmath.png", [36.0, 36.0, 36.0, 255.0], 2.0]
|
||||
]
|
||||
},
|
||||
|
||||
"keys":
|
||||
|
|
|
@ -9,12 +9,15 @@
|
|||
body
|
||||
{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
canvas
|
||||
{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
|
@ -45,8 +48,8 @@
|
|||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://www.coolmathgames.com/sites/default/files/cmg-ads.js"></script>
|
||||
|
||||
<!-- Coolmath API custom events. Pause/unpause the game for ads -->
|
||||
<script>
|
||||
/* Coolmath API custom events. Pause/unpause the game for ads */
|
||||
document.addEventListener("adBreakStart", () => {
|
||||
console.log("AdBreak Started")
|
||||
_pause_for_ads();
|
||||
|
@ -54,7 +57,10 @@
|
|||
document.addEventListener("adBreakComplete", () => {
|
||||
console.log("adBreak Complete")
|
||||
_unpause_for_ads();
|
||||
});
|
||||
});
|
||||
|
||||
/* Fix keyboard input inside an iframe (see https://github.com/emscripten-core/emscripten/issues/5796) */
|
||||
setInterval(() => window.focus(), 500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue