diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 44 | ||||
-rw-r--r-- | Pong.make | 160 | ||||
-rw-r--r-- | README.txt | 43 | ||||
-rw-r--r-- | premake5.lua | 131 |
5 files changed, 13 insertions, 366 deletions
diff --git a/.gitignore b/.gitignore index 507befb..dfda973 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ app/ +.tup/ build/ .cache/ *.o diff --git a/Makefile b/Makefile deleted file mode 100644 index 5a0147d..0000000 --- a/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# Alternative GNU Make workspace makefile autogenerated by Premake - -ifndef config - config=release -endif - -ifndef verbose - SILENT = @ -endif - -ifeq ($(config),release) - Pong_config = release - -else - $(error "invalid configuration $(config)") -endif - -PROJECTS := Pong - -.PHONY: all clean help $(PROJECTS) - -all: $(PROJECTS) - -Pong: -ifneq (,$(Pong_config)) - @echo "==== Building Pong ($(Pong_config)) ====" - @${MAKE} --no-print-directory -C . -f Pong.make config=$(Pong_config) -endif - -clean: - @${MAKE} --no-print-directory -C . -f Pong.make clean - -help: - @echo "Usage: make [config=name] [target]" - @echo "" - @echo "CONFIGURATIONS:" - @echo " release" - @echo "" - @echo "TARGETS:" - @echo " all (default)" - @echo " clean" - @echo " Pong" - @echo "" - @echo "For more information, see https://github.com/premake/premake-core/wiki" \ No newline at end of file diff --git a/Pong.make b/Pong.make deleted file mode 100644 index ffc4c0e..0000000 --- a/Pong.make +++ /dev/null @@ -1,160 +0,0 @@ -# Alternative GNU Make project makefile autogenerated by Premake - -ifndef config - config=release -endif - -ifndef verbose - SILENT = @ -endif - -.PHONY: clean prebuild - -SHELLTYPE := posix -ifeq (.exe,$(findstring .exe,$(ComSpec))) - SHELLTYPE := msdos -endif - -# Configurations -# ############################################# - -RESCOMP = windres -TARGETDIR = bin/Release -TARGET = $(TARGETDIR)/Pong -OBJDIR = obj -DEFINES += -INCLUDES += -FORCE_INCLUDE += -ALL_CPPFLAGS += $(CPPFLAGS) -MMD -MP $(DEFINES) $(INCLUDES) -ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Og -std=c99 -g -ggdb `pkg-config --cflags raylib` `pkg-config --cflags glfw3` `pkg-config --cflags gl` `pkg-config --cflags sdl2` `pkg-config --cflags SDL2_mixer` `pkg-config --cflags glu` -ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Og -g -ggdb `pkg-config --cflags raylib` `pkg-config --cflags glfw3` `pkg-config --cflags gl` `pkg-config --cflags sdl2` `pkg-config --cflags SDL2_mixer` `pkg-config --cflags glu` -ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) -LIBS += -LDDEPS += -ALL_LDFLAGS += $(LDFLAGS) -s -g -ggdb `pkg-config --libs raylib` `pkg-config --libs glfw3` `pkg-config --libs gl` `pkg-config --libs sdl2` `pkg-config --libs SDL2_mixer` `pkg-config --libs glu` -LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) -define PREBUILDCMDS -endef -define PRELINKCMDS -endef -define POSTBUILDCMDS -endef - -# Per File Configurations -# ############################################# - - -# File sets -# ############################################# - -GENERATED := -OBJECTS := - -GENERATED += $(OBJDIR)/ball.o -GENERATED += $(OBJDIR)/controls.o -GENERATED += $(OBJDIR)/enemy.o -GENERATED += $(OBJDIR)/main.o -GENERATED += $(OBJDIR)/marathon.o -GENERATED += $(OBJDIR)/pause.o -GENERATED += $(OBJDIR)/title.o -GENERATED += $(OBJDIR)/versus.o -OBJECTS += $(OBJDIR)/ball.o -OBJECTS += $(OBJDIR)/controls.o -OBJECTS += $(OBJDIR)/enemy.o -OBJECTS += $(OBJDIR)/main.o -OBJECTS += $(OBJDIR)/marathon.o -OBJECTS += $(OBJDIR)/pause.o -OBJECTS += $(OBJDIR)/title.o -OBJECTS += $(OBJDIR)/versus.o - -# Rules -# ############################################# - -all: $(TARGET) - @: - -$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR) - $(PRELINKCMDS) - @echo Linking Pong - $(SILENT) $(LINKCMD) - $(POSTBUILDCMDS) - -$(TARGETDIR): - @echo Creating $(TARGETDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(TARGETDIR) -else - $(SILENT) mkdir $(subst /,\\,$(TARGETDIR)) -endif - -$(OBJDIR): - @echo Creating $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) mkdir -p $(OBJDIR) -else - $(SILENT) mkdir $(subst /,\\,$(OBJDIR)) -endif - -clean: - @echo Cleaning Pong -ifeq (posix,$(SHELLTYPE)) - $(SILENT) rm -f $(TARGET) - $(SILENT) rm -rf $(GENERATED) - $(SILENT) rm -rf $(OBJDIR) -else - $(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET)) - $(SILENT) if exist $(subst /,\\,$(GENERATED)) rmdir /s /q $(subst /,\\,$(GENERATED)) - $(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR)) -endif - -prebuild: | $(OBJDIR) - $(PREBUILDCMDS) - -ifneq (,$(PCH)) -$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER) -$(GCH): $(PCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" -$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) -ifeq (posix,$(SHELLTYPE)) - $(SILENT) touch "$@" -else - $(SILENT) echo $null >> "$@" -endif -else -$(OBJECTS): | prebuild -endif - - -# File Rules -# ############################################# - -$(OBJDIR)/ball.o: src/ball.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/controls.o: src/controls.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/enemy.o: src/enemy.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/main.o: src/main.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/marathon.o: src/marathon.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/pause.o: src/pause.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/title.o: src/title.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" -$(OBJDIR)/versus.o: src/versus.c - @echo $(notdir $<) - $(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<" - --include $(OBJECTS:%.o=%.d) -ifneq (,$(PCH)) - -include $(PCH_PLACEHOLDER).d -endif \ No newline at end of file diff --git a/README.txt b/README.txt index b6823d8..6791bae 100644 --- a/README.txt +++ b/README.txt @@ -5,6 +5,11 @@ ██║ ╚██████╔╝██║ ╚████║╚██████╔╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ =============================================================================== +ABANDON ALL HOPE YE WHO ENTERS: +This project was create as a fun side-project to see if I could make a 2D +game. As it turns out, I can! Unfortunately the code in this is super +spaghetti, so be warned! +=============================================================================== Description: This is a pong clone made in C using raylib as the main back bone of the code. My goal with this project is: @@ -14,10 +19,10 @@ My goal with this project is: - FreeBSD - Windows - OpenBSD - - Mac OSX (File loading issue???) + - Mac OSX + - Haiku + - DragonflyBSD The following platforms are not support, with the reasons why they aren't yet: - - DragonflyBSD (Haven't gotten around to it yet.) - - Haiku (SDL2_Threads not working properly.) - Hurd (I'll fuckin do it for the memes, mark my words...) - OpenIndiana (Premake5 doesn't link properly.) 2. Make a fun, simple game. @@ -26,33 +31,9 @@ My goal with this project is: is the only way I can learn. =============================================================================== Build: - Unix/POSIX: - 1. Install the following dependencies: - - Raylib - For Graphics Drawing - - GLFW3 - Raylib dependency - - SDL2 - SDL2_mixer dependency - - SDL2_mixer - For sound - - premake5 - To generate build files - - pkg-config - - Mesa - 2. Run `premake5 check_deps` to make sure you have all dependencies. - 3. Run `premake5 gmake2` - 4. Run `make` or `gmake` - 5. Run `premake5 install` to install it to the prefix. - Flatpak: - 1. Run `premake5 gmake2` - 2. Run `flatpak-builder --user --force-clean --install --repo=flatpak_repo build-dir net.iotib.Pong.yml` - 3. Generate a distributable file using: `flatpak build-bundle flatpak_repo net.iotib.Pong.flatpak net.iotib.Pong <version>` - 4. Once installed, you can run it using `flatpak run net.iotib.Pong` - Windows: - 1. Install msys2 (https://www.msys2.org/) - 2. Follow the instructions from the unix section. - NOTES: - - GL and GLU not being found is perfectly fine. - - Run MSYS2 in either mingw64 or ucrt64. 32-bit builds are NOT supported. - Mac OSX: - NOTE: There's a potential file loading issue. - 1. Install homebrew (https://brew.sh/) - 2. Follow the instructions from the unix section. + 1. Modify tup.config to your needs. + 2. Run `tup` + 3. Run ./install.sh + 4. Done =============================================================================== If you like my work and want to support me, consider donating to me on https://liberapay.com/Charadon/ diff --git a/premake5.lua b/premake5.lua deleted file mode 100644 index a309bdd..0000000 --- a/premake5.lua +++ /dev/null @@ -1,131 +0,0 @@ -workspace("Pong") - configurations {"Release"} - -project("Pong") - newaction { - trigger = "install", - description = "Install the game to prefix.", - execute = function() - os.mkdir(string.format("%s/Pong/resources", prefix)) - os.mkdir(string.format("%s/Pong/docs", prefix)) - os.executef("cp -r resources/* %s/Pong/resources/", prefix) - os.executef("cp -r docs/* %s/Pong/docs", prefix) - os.executef("install -m755 bin/*/Pong* %s/Pong/", prefix) - os.exit(0) - end - } - - - newaction { - trigger = "clean", - description = "Clean the work environment.", - execute = function() - os.executef("rm -rvf %s/obj", _MAIN_SCRIPT_DIR) - os.executef("rm -rvf %s/bin", _MAIN_SCRIPT_DIR) - os.executef("rm -rvf %s/app", _MAIN_SCRIPT_DIR) - os.executef("rm -vf %s/Makefile", _MAIN_SCRIPT_DIR) - os.executef("rm -vf %s/Pong.make", _MAIN_SCRIPT_DIR) - os.executef("rm -rvf %s/flatpak_repo", _MAIN_SCRIPT_DIR) - os.executef("rm -rvf %s/.flatpak-builder", _MAIN_SCRIPT_DIR) - os.executef("rm -rvf %s/build-dir", _MAIN_SCRIPT_DIR) - os.executef("rm -vf %s/*.flatpak", _MAIN_SCRIPT_DIR) - os.executef("rm -rf %s/flatpak", _MAIN_SCRIPT_DIR) - os.exit(0) - end - } - - newaction { - trigger = "check_deps", - description = "Check if you have all the dependencies installed.", - execute = function() - io.write("pkg-config: ") - io.flush() - Pkgconf_Result = os.executef("which pkg-config") - AllGood = true - if(Pkgconf_Result == nil) - then - print("You do not have pkg-config installed. Aborting.") - os.exit(1) - end - io.write("Raylib: ") - io.flush() - if(os.executef("pkg-config --modversion raylib") == nil) - then - print("Can't find raylib.") - AllGood = false - end - io.write("SDL2: ") - io.flush() - if(os.executef("pkg-config --modversion sdl2") == nil) - then - print("Can't find SDL2.") - AllGood = false - end - io.write("SDL2_mixer: ") - io.flush() - if (os.executef("pkg-config --modversion SDL2_mixer") == nil) - then - print("Can't find SDL2_mixer.") - AllGood = false - end - io.write("GLFW3: ") - io.flush() - if (os.executef("pkg-config --modversion glfw3") == nil) - then - print("Can't find GLFW.") - AllGood = false - end - io.write("GL: ") - io.flush() - if (os.executef("pkg-config --modversion gl") == nil) - then - print("Can't find OpenGL") - AllGood = false - end - io.write("GLU: ") - io.flush() - if (os.executef("pkg-config --modversion glu") == nil) - then - print("Can't find GLU") - AllGood = false - end - if(AllGood == true) - then - print("Found all dependencies!") - os.exit(0) - end - print("Failed to find all needed dependencies.") - os.exit(1) - end - } - - kind("WindowedApp") - optimize("Debug") - language("C") - cdialect("C99") - files {"src/*.c", "src/*.h", } - --libdirs {"/usr/local/lib", "/usr/pkg/lib", "/usr/X11R7/include"} - - -- Prefix Option - newoption { - trigger = "prefix", - value = "path", - description = "Prefix for where the game is to be installed." - } - prefix = _OPTIONS["prefix"] or "app" - - -- Flatpak - newoption { - trigger = "flatpak", - value = "bool", - description = "Build a flatpak." - } - flatpak = _OPTIONS["flatpak"] or "false" - - if (flatpak == true) - then - else - buildoptions {"-g", "-ggdb", "`pkg-config --cflags raylib`", "`pkg-config --cflags glfw3`", "`pkg-config --cflags gl`", "`pkg-config --cflags sdl2`", "`pkg-config --cflags SDL2_mixer`", "`pkg-config --cflags glu`"} - linkoptions {"-g", "-ggdb", "`pkg-config --libs raylib`", "`pkg-config --libs glfw3`", "`pkg-config --libs gl`", "`pkg-config --libs sdl2`", "`pkg-config --libs SDL2_mixer`", "`pkg-config --libs glu`"} - end - |