change sfw to sb, use Makefile skeleton from demos
This commit is contained in:
parent
b8baf6802b
commit
081681bfe7
|
@ -1,3 +1,3 @@
|
|||
[submodule "lib/sfw"]
|
||||
path = lib/sfw
|
||||
path = lib/sb
|
||||
url = frank@shampoo.ooo:/var/www/git/sfw
|
||||
|
|
183
Makefile
183
Makefile
|
@ -1,13 +1,112 @@
|
|||
# _______________
|
||||
# //`````````````\\
|
||||
# //~~~~~~~~~~~~~~~\\ + a game by @ohsqueezy (ohsqueezy.itch.io) & @sleepin (instagram.com/sleepin)
|
||||
# //=================\\ + code is licensed for copy, modification and redistribution (git.nugget.fun/pudding)
|
||||
# // \\
|
||||
# //-G--U--N--K--I--S--S-\\ 😀 Thank you for choosing Puddendo for your business 😀
|
||||
# //_______________________\\
|
||||
# ```````````````````````````
|
||||
#
|
||||
# This Makefile should build a Linux binary from `make linux`. Other platform targets have not been tested yet.
|
||||
|
||||
#######################
|
||||
# Location parameters #
|
||||
#######################
|
||||
|
||||
# Location of project specific source files
|
||||
SRC_DIR := src/
|
||||
SFW_DIR := lib/sfw/
|
||||
SFW_SRC_DIR := $(SFW_DIR)src/
|
||||
SFW_LIB_DIR := $(SFW_DIR)lib/
|
||||
SDLGFX2_DIR := $(SFW_LIB_DIR)sdl2-gfx/
|
||||
GLEW_DIR := $(SFW_LIB_DIR)glew/
|
||||
CC_LINUX := clang
|
||||
CPPC_LINUX := clang++
|
||||
SDLCONFIG := /home/frank/local/sdl/bin/sdl2-config
|
||||
SDL_FLAGS := $(shell $(SDLCONFIG) --cflags)
|
||||
|
||||
# Locations of [SPACE BOX] source and dependencies required to be compiled from source. These
|
||||
# locations are configured to match the structure of the [SPACE BOX] repository but can be
|
||||
# modified as necessary.
|
||||
SB_DIR := lib/sb/
|
||||
SB_SRC_DIR := $(SB_DIR)src/
|
||||
SB_LIB_DIR := $(SB_DIR)lib/
|
||||
SDLGFX2_DIR := $(SB_LIB_DIR)sdl2-gfx/
|
||||
GLEW_DIR := $(SB_LIB_DIR)glew/
|
||||
|
||||
# C and C++ compiler commands
|
||||
CC := clang
|
||||
CPPC := clang++
|
||||
|
||||
# Location of SDL config program
|
||||
SDLCONFIG := $(HOME)/local/sdl/bin/sdl2-config
|
||||
|
||||
# Edit to point to the location of BPmono.ttf
|
||||
CREATE_FONT_SYMLINK := ln -nsf $(SB_DIR)"BPmono.ttf" .
|
||||
|
||||
#############################
|
||||
# Based on above parameters #
|
||||
#############################
|
||||
|
||||
SDL_CFLAGS = $(shell $(SDLCONFIG) --cflags)
|
||||
SDL_LFLAGS := $(shell $(SDLCONFIG) --libs)
|
||||
SB_H_FILES := $(wildcard $(addprefix $(SB_SRC_DIR),*.hpp))
|
||||
SB_O_FILES := $(filter-out $(addprefix $(SB_SRC_DIR),filesystem.o),$(SB_H_FILES:.hpp=.o))
|
||||
SRC_H_FILES := $(wildcard $(addprefix $(SRC_DIR),*.hpp))
|
||||
SRC_O_FILES := $(SRC_H_FILES:.hpp=.o)
|
||||
|
||||
#####################################################################
|
||||
# Targets for building [SPACE BOX], dependencies and project source #
|
||||
#####################################################################
|
||||
|
||||
$(SDLGFX2_DIR)%.o: $(SDLGFX2_DIR)%.c $(SDLGFX2_DIR)%.h
|
||||
$(GLEW_DIR)%.o: $(GLEW_DIR)%.c $(GLEW_DIR)%.h
|
||||
$(CC) $(CFLAGS) $< -c -o $@
|
||||
|
||||
$(SB_SRC_DIR)extension.o : $(addprefix $(SB_SRC_DIR),Box.hpp Segment.hpp Color.hpp filesystem.hpp Pixels.hpp)
|
||||
$(SB_SRC_DIR)Node.o : $(addprefix $(SB_SRC_DIR),Game.hpp Configuration.hpp Delegate.hpp Display.hpp Input.hpp Box.hpp Audio.hpp)
|
||||
$(SB_SRC_DIR)Sprite.o : $(addprefix $(SB_SRC_DIR),Node.hpp Game.hpp Box.hpp Animation.hpp Color.hpp extension.hpp Pixels.hpp)
|
||||
$(SB_SRC_DIR)Game.o : $(addprefix $(SB_SRC_DIR),extension.hpp Node.hpp Sprite.hpp Recorder.hpp Input.hpp Configuration.hpp \
|
||||
Delegate.hpp Audio.hpp)
|
||||
$(SB_SRC_DIR)Animation.o : $(addprefix $(SB_SRC_DIR),Node.hpp Timer.hpp)
|
||||
$(SB_SRC_DIR)Recorder.o : $(addprefix $(SB_SRC_DIR),Node.hpp Game.hpp Configuration.hpp Delegate.hpp Animation.hpp extension.hpp)
|
||||
$(SB_SRC_DIR)Input.o : $(addprefix $(SB_SRC_DIR),Node.hpp Animation.hpp Configuration.hpp Delegate.hpp)
|
||||
$(SB_SRC_DIR)Configuration.o : $(addprefix $(SB_SRC_DIR),Node.hpp Animation.hpp)
|
||||
$(SB_SRC_DIR)Delegate.o : $(addprefix $(SB_SRC_DIR),Node.hpp Game.hpp Input.hpp)
|
||||
$(SB_SRC_DIR)Display.o : $(addprefix $(SB_SRC_DIR),Node.hpp Game.hpp Box.hpp Configuration.hpp Delegate.hpp)
|
||||
$(SB_SRC_DIR)Box.o : $(addprefix $(SB_SRC_DIR),extension.hpp Segment.hpp)
|
||||
$(SB_SRC_DIR)Segment.o : $(addprefix $(SB_SRC_DIR),extension.hpp Box.hpp)
|
||||
$(SB_SRC_DIR)Pixels.o : $(addprefix $(SB_SRC_DIR),Box.hpp extension.hpp)
|
||||
$(SB_SRC_DIR)Audio.o : $(addprefix $(SB_SRC_DIR),Node.hpp Display.hpp Configuration.hpp Box.hpp filesystem.hpp extension.hpp)
|
||||
$(SRC_DIR)Pudding.o : $(SRC_H_FILES) $(SB_H_FILES)
|
||||
%.o : %.cpp %.hpp
|
||||
$(CPPC) $(CPP_FLAGS) $< -c -o $@
|
||||
|
||||
###############
|
||||
# Linux build #
|
||||
###############
|
||||
|
||||
linux : CC = clang
|
||||
linux : CPPC = clang++
|
||||
linux : CFLAGS = -g -Wall -Wextra -Og -c -I$(SB_LIB_DIR) -I$(SB_SRC_DIR) $(SDL_CFLAGS) -I$(HOME)/local/zbar/include \
|
||||
-I$(HOME)/local/opencv/include/opencv4
|
||||
linux : CPP_FLAGS = $(CFLAGS) --std=c++17
|
||||
linux : LFLAGS = $(SDL_LFLAGS) -lpthread -lGL -lGLESv2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lcurl -lstdc++fs \
|
||||
-L/home/frank/local/opencv/lib -Wl,-rpath,/home/frank/local/opencv/lib -Wl,--enable-new-dtags -lopencv_videoio -lopencv_core \
|
||||
-lopencv_highgui -lopencv_imgproc -L/home/frank/local/zbar/lib -Wl,-rpath,/home/frank/local/zbar/lib -Wl,--enable-new-dtags -lzbar
|
||||
linux : $(GLEW_DIR)glew.o $(addprefix $(SDLGFX2_DIR),SDL2_rotozoom.o SDL2_gfxPrimitives.o) \
|
||||
$(SB_O_FILES) $(SRC_O_FILES)
|
||||
$(CREATE_FONT_SYMLINK)
|
||||
$(CPPC) $(LFLAGS) -D__LINUX__ $^ -o pudding
|
||||
|
||||
#########################
|
||||
# Clean up object files #
|
||||
#########################
|
||||
|
||||
.PHONY : clean
|
||||
clean :
|
||||
-rm $(SRC_DIR)*.o
|
||||
|
||||
.PHONY : clean-all
|
||||
clean-all :
|
||||
-find . -iname "*.o" -exec rm {} \;
|
||||
|
||||
#
|
||||
# Below assignments and targets are necessary for cross-compiling to Android, web (via emscripten), Windows (via mingw),
|
||||
# and OS/X. Cross-compilation targets have not been tested in a while and won't compile without significant changes.
|
||||
#
|
||||
|
||||
BUILDDIR := build
|
||||
EXT_SRC_ROOT := /home/frank/ext/software
|
||||
SDLHOME := $(EXT_SRC_ROOT)/SDL2-2.0.14
|
||||
|
@ -22,53 +121,12 @@ SDL_IMG_MINGW_HOME = $(SDL_IMG_HOME)/i686-w64-mingw32
|
|||
SDL_TTF_MINGW_HOME = $(SDL_TTF_HOME)/i686-w64-mingw32
|
||||
APPDIR = Main.app/Contents
|
||||
SYSFWPATH = /Library/Frameworks
|
||||
SFW_H_FILES := $(wildcard $(addprefix $(SFW_SRC_DIR),*.hpp))
|
||||
SFW_O_FILES := $(filter-out $(addprefix $(SFW_SRC_DIR),filesystem.o),$(SFW_H_FILES:.hpp=.o))
|
||||
GAME_H_FILES := $(wildcard $(addprefix $(SRC_DIR),*.hpp))
|
||||
GAME_O_FILES := $(GAME_H_FILES:.hpp=.o)
|
||||
CREATE_FONT_SYMLINK = ln -nsf $(SFW_DIR)"BPmono.ttf" .
|
||||
EMSCRIPTEN_CFLAGS = -O3 -Wall -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS="['png']" \
|
||||
-s USE_SDL_TTF=2 -s USE_SDL_MIXER=2 -s MAX_WEBGL_VERSION=1 -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall']" \
|
||||
-s EXPORTED_FUNCTIONS="['_main', '_reset_game']" -s ALLOW_MEMORY_GROWTH=1 -s GL_PREINITIALIZED_CONTEXT=1 \
|
||||
-s ENVIRONMENT=web --shell-file shell_minimal.html --no-heap-copy -I$(SFW_LIB_DIR) -I$(SFW_SRC_DIR)
|
||||
EMSCRIPTEN_PRELOADS = --preload-file "BPmono.ttf"@/ --preload-file "config.json" --preload-file "resource"
|
||||
|
||||
$(SDLGFX2_DIR)%.o: $(SDLGFX2_DIR)%.c $(SDLGFX2_DIR)%.h
|
||||
$(GLEW_DIR)%.o: $(GLEW_DIR)%.c $(GLEW_DIR)%.h
|
||||
$(CC) $(CFLAGS) $< -c -o $@
|
||||
|
||||
$(SFW_SRC_DIR)extension.o : $(addprefix $(SFW_SRC_DIR),Box.hpp Segment.hpp Color.hpp filesystem.hpp Pixels.hpp)
|
||||
$(SFW_SRC_DIR)Node.o : $(addprefix $(SFW_SRC_DIR),Game.hpp Configuration.hpp Delegate.hpp Display.hpp Input.hpp Box.hpp Audio.hpp)
|
||||
$(SFW_SRC_DIR)Sprite.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Game.hpp Box.hpp Animation.hpp Color.hpp extension.hpp Pixels.hpp)
|
||||
$(SFW_SRC_DIR)Game.o : $(addprefix $(SFW_SRC_DIR),extension.hpp Node.hpp Sprite.hpp Recorder.hpp Input.hpp Configuration.hpp \
|
||||
Delegate.hpp Audio.hpp)
|
||||
$(SFW_SRC_DIR)Animation.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Timer.hpp)
|
||||
$(SFW_SRC_DIR)Recorder.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Game.hpp Configuration.hpp Delegate.hpp Animation.hpp extension.hpp)
|
||||
$(SFW_SRC_DIR)Input.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Animation.hpp Configuration.hpp Delegate.hpp)
|
||||
$(SFW_SRC_DIR)Configuration.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Animation.hpp)
|
||||
$(SFW_SRC_DIR)Delegate.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Game.hpp Input.hpp)
|
||||
$(SFW_SRC_DIR)Display.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Game.hpp Box.hpp Configuration.hpp Delegate.hpp)
|
||||
$(SFW_SRC_DIR)Box.o : $(addprefix $(SFW_SRC_DIR),extension.hpp Segment.hpp)
|
||||
$(SFW_SRC_DIR)Segment.o : $(addprefix $(SFW_SRC_DIR),extension.hpp Box.hpp)
|
||||
$(SFW_SRC_DIR)Pixels.o : $(addprefix $(SFW_SRC_DIR),Box.hpp extension.hpp)
|
||||
$(SFW_SRC_DIR)Audio.o : $(addprefix $(SFW_SRC_DIR),Node.hpp Display.hpp Configuration.hpp Box.hpp filesystem.hpp extension.hpp)
|
||||
$(SRC_DIR)Pudding.o : $(addprefix $(SRC_DIR), Item.hpp) $(SFW_H_FILES)
|
||||
%.o : %.cpp %.hpp
|
||||
$(CPPC) $(CPP_FLAGS) $< -c -o $@
|
||||
|
||||
linux : CC = clang
|
||||
linux : CPPC = clang++
|
||||
linux : CFLAGS = -g3 -Wall -Wextra -Og -c -I$(SFW_LIB_DIR) -I$(SFW_SRC_DIR) $(SDL_FLAGS) -I$(HOME)/local/zbar/include \
|
||||
-I$(HOME)/local/opencv/include/opencv4
|
||||
linux : CPP_FLAGS = $(CFLAGS) --std=c++17
|
||||
linux : LFLAGS = $(shell $(SDLCONFIG) --libs) -lpthread -lGL -lGLESv2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lcurl -lstdc++fs \
|
||||
-L/home/frank/local/opencv/lib -Wl,-rpath,/home/frank/local/opencv/lib -Wl,--enable-new-dtags -lopencv_videoio -lopencv_core \
|
||||
-lopencv_highgui -lopencv_imgproc -L/home/frank/local/zbar/lib -Wl,-rpath,/home/frank/local/zbar/lib -Wl,--enable-new-dtags -lzbar
|
||||
linux : $(GLEW_DIR)glew.o $(addprefix $(SDLGFX2_DIR),SDL2_rotozoom.o SDL2_gfxPrimitives.o) \
|
||||
$(SFW_O_FILES) $(GAME_O_FILES)
|
||||
$(CREATE_FONT_SYMLINK)
|
||||
$(CPPC) $(LFLAGS) -D__LINUX__ $^ -o pudding
|
||||
|
||||
emscripten : CC = $(EMSCRIPTENHOME)/emcc
|
||||
emscripten : CPPC = $(EMSCRIPTENHOME)/em++
|
||||
emscripten : CFLAGS = $(EMSCRIPTEN_CFLAGS)
|
||||
|
@ -77,31 +135,6 @@ emscripten : $(addprefix $(SDLGFX2_DIR),SDL2_rotozoom.o SDL2_gfxPrimitives.o) $(
|
|||
$(CREATE_FONT_SYMLINK)
|
||||
$(CPPC) $(CPP_FLAGS) $(EMSCRIPTEN_PRELOADS) $^ -o "index.html"
|
||||
|
||||
collide_test : CC = clang
|
||||
collide_test : CPPC = clang++
|
||||
collide_test : CFLAGS = -Wall -Wextra -O3 -g -c -I$(SFW_LIB_DIR) -I$(SFW_SRC_DIR) $(SDL_FLAGS)
|
||||
collide_test : CPP_FLAGS = $(CFLAGS) --std=c++17
|
||||
collide_test : LFLAGS = $(shell $(SDLCONFIG) --libs) -lpthread
|
||||
collide_test : $(GLEW_DIR)glew.o $(addprefix $(SDLGFX2_DIR),SDL2_rotozoom.o SDL2_gfxPrimitives.o) \
|
||||
$(SFW_O_FILES) CollisionTest.o
|
||||
$(CPPC) $(LFLAGS) -D__LINUX__ -lGL -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lstdc++fs $^ -o collide-test
|
||||
|
||||
collide_test_emscripten : CC = $(EMSCRIPTENHOME)/emcc
|
||||
collide_test_emscripten : CPPC = $(EMSCRIPTENHOME)/em++
|
||||
collide_test_emscripten : CFLAGS = $(EMSCRIPTEN_CFLAGS)
|
||||
collide_test_emscripten : CPP_FLAGS = $(CFLAGS) --std=c++17
|
||||
collide_test_emscripten : $(addprefix $(SDLGFX2_DIR),SDL2_rotozoom.o SDL2_gfxPrimitives.o) $(SFW_O_FILES) CollisionTest.o
|
||||
$(CREATE_FONT_SYMLINK)
|
||||
$(CPPC) $(CPP_FLAGS) $(EMSCRIPTEN_PRELOADS) --emrun $^ -o "collision_test.html"
|
||||
|
||||
.PHONY : clean
|
||||
clean :
|
||||
-rm $(SRC_DIR)*.o
|
||||
|
||||
.PHONY : clean-all
|
||||
clean-all :
|
||||
-find . -iname "*.o" -exec rm {} \;
|
||||
|
||||
android :
|
||||
if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi;
|
||||
cd $(SDLHOME)/build-scripts/ && \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"display":
|
||||
{
|
||||
"dimensions": [960, 540],
|
||||
"dimensions": [460, 768],
|
||||
"framerate": 60,
|
||||
"title": "Pudding",
|
||||
"debug": false,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ada139c26fa88bbf15763dcfc269973924201b0a
|
1
lib/sfw
1
lib/sfw
|
@ -1 +0,0 @@
|
|||
Subproject commit c8bc86cab729a26cc7563c7177c42f919b47df07
|
|
@ -80,5 +80,5 @@ std::string Item::get_full_name() const
|
|||
|
||||
void Item::increment_image_index(int increment)
|
||||
{
|
||||
current_image_index = sfw::mod(current_image_index + increment, static_cast<int>(get_image_textures().size()));
|
||||
current_image_index = sb::mod(current_image_index + increment, static_cast<int>(get_image_textures().size()));
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
______________
|
||||
//````````````\\ + a game by @ohsqueezy [http://ohsqueezy.itch.io] & @sleepin [http://instagram.com/sleepin]
|
||||
//~~~~~~~~~~~~~~\\ + custom pudding code provided by Nuggets Select [http://nugget.fun]
|
||||
//================\\ + available for copy, modification and redistribution [http://git.nugget.fun/pudding]
|
||||
_______________
|
||||
//`````````````\\ + a game by @ohsqueezy (ohsqueezy.itch.io) & @sleepin (instagram.com/sleepin)
|
||||
//~~~~~~~~~~~~~~~\\ + code is licensed for copy, modification and redistribution (git.nugget.fun/pudding)
|
||||
//=================\\
|
||||
// \\
|
||||
// ''CUSTOM PUDDING'' \\ 😀 Thank you for choosing Pudding Customs for your business 😀
|
||||
//______________________\\
|
||||
``````````````````````````
|
||||
//-G--U--N--K--I--S--S-\\ 😀 Thank you for choosing Puddendo for your business 😀
|
||||
//_______________________\\
|
||||
```````````````````````````
|
||||
|
||||
Generate a custom pudding from food product UPC codes and help a pair of rats take over the video game industry, using
|
||||
their extraterrestrial ability to turn trash into performance enhancing drug puddings that enable business professionals
|
||||
|
@ -51,7 +51,7 @@ void Pudding::set_pudding_model(
|
|||
layer_top_ring.reserve(ring_vertex_count);
|
||||
layer_base_ring.reserve(ring_vertex_count);
|
||||
/* y coordinates of each ring of vertices in the pudding */
|
||||
const std::map<float, float> y_coords = sfw::range_percent_count(max_y, min_y, layer_count + 1);
|
||||
const std::map<float, float> y_coords = sb::range_percent_count(max_y, min_y, layer_count + 1);
|
||||
/* loop through layers by looking at each layer's top and bottom rings simultaneously */
|
||||
for (
|
||||
auto layer_top_entry = y_coords.begin(), layer_base_entry = ++y_coords.begin();
|
||||
|
@ -65,8 +65,8 @@ void Pudding::set_pudding_model(
|
|||
layer_base_percent = layer_base_entry->first;
|
||||
layer_top_ring.clear();
|
||||
layer_base_ring.clear();
|
||||
sfw::points_on_circle(layer_top_ring, ring_vertex_count, layer_top_percent * (base_radius - top_radius) + top_radius);
|
||||
sfw::points_on_circle(layer_base_ring, ring_vertex_count, layer_base_percent * (base_radius - top_radius) + top_radius);
|
||||
sb::points_on_circle(layer_top_ring, ring_vertex_count, layer_top_percent * (base_radius - top_radius) + top_radius);
|
||||
sb::points_on_circle(layer_base_ring, ring_vertex_count, layer_base_percent * (base_radius - top_radius) + top_radius);
|
||||
/* layers above gradient position are brown, layers below are yellow, and the layer that contains gradient positon
|
||||
* is a gradient from brown to yellow */
|
||||
if (layer_top_percent <= gradient_position && layer_base_percent > gradient_position)
|
||||
|
@ -121,7 +121,7 @@ void Pudding::set_pudding_model(
|
|||
Box texture_box = Box({0, 0}, {1, 1});
|
||||
for (float radius : {top_radius, base_radius})
|
||||
{
|
||||
sfw::points_on_circle(layer_top_ring, ring_vertex_count, radius);
|
||||
sb::points_on_circle(layer_top_ring, ring_vertex_count, radius);
|
||||
/* loop through points on the face */
|
||||
for (ii = 0; ii < layer_top_ring.size(); ii++)
|
||||
{
|
||||
|
@ -609,7 +609,7 @@ void Pudding::destroy_texture(GLuint* texture_id)
|
|||
/* Change the currently selected item */
|
||||
void Pudding::increment_item_index(int increment)
|
||||
{
|
||||
current_item_index = sfw::mod(current_item_index + increment, static_cast<int>(items.size()));
|
||||
current_item_index = sb::mod(current_item_index + increment, static_cast<int>(items.size()));
|
||||
}
|
||||
|
||||
Item& Pudding::get_current_item()
|
||||
|
|
Loading…
Reference in New Issue