From fd5d1dfcb6d740728f21cdd08ba8387b0ee2f899 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 13 Apr 2020 13:31:45 +0200 Subject: WARNING: REMOVED raylib/games - Moved to raysan5/raylib-games Move raylib games to another repo. It will reduce repo size for new clones. I considered also removing the related history with [`git filter-repo`](https://github.com/newren/git-filter-repo) (the current sane alternative to the deprecated `filter-branch`) but it has some implications: It would had made a new repository with distinct history and checksums. If the repo was previously published, the history of the new one won't have been compatible with the history others have pulled. --- games/wave_collector/CMakeLists.txt | 16 - games/wave_collector/LICENSE.txt | 20 - games/wave_collector/Makefile | 406 ----------------- games/wave_collector/Makefile.Android | 300 ------------- games/wave_collector/resources/audio/pause.wav | Bin 25906 -> 0 bytes .../wave_collector/resources/audio/sample_off.wav | Bin 9291 -> 0 bytes games/wave_collector/resources/audio/sample_on.wav | Bin 2335 -> 0 bytes games/wave_collector/resources/audio/start.wav | Bin 14079 -> 0 bytes games/wave_collector/resources/audio/wave.ogg | Bin 1364969 -> 0 bytes games/wave_collector/resources/font.fnt | 100 ----- games/wave_collector/resources/font.png | Bin 140998 -> 0 bytes .../resources/textures/background.png | Bin 1430678 -> 0 bytes .../resources/textures/background_gameplay.png | Bin 977059 -> 0 bytes .../resources/textures/background_title.png | Bin 1028393 -> 0 bytes .../resources/textures/icon_synchro.png | Bin 12392 -> 0 bytes .../resources/textures/icon_warp.png | Bin 14178 -> 0 bytes .../resources/textures/logo_raylib.png | Bin 1868 -> 0 bytes games/wave_collector/resources/textures/lose.png | Bin 104725 -> 0 bytes games/wave_collector/resources/textures/player.png | Bin 11231 -> 0 bytes .../resources/textures/sample_big.png | Bin 2841 -> 0 bytes .../resources/textures/sample_mid.png | Bin 1720 -> 0 bytes .../resources/textures/sample_small.png | Bin 1243 -> 0 bytes games/wave_collector/resources/textures/title.png | Bin 125004 -> 0 bytes games/wave_collector/resources/textures/win.png | Bin 35613 -> 0 bytes games/wave_collector/screens/screen_ending.c | 111 ----- games/wave_collector/screens/screen_gameplay.c | 496 --------------------- games/wave_collector/screens/screen_logo.c | 181 -------- games/wave_collector/screens/screen_title.c | 112 ----- games/wave_collector/screens/screens.h | 88 ---- games/wave_collector/wave_collector.c | 308 ------------- 30 files changed, 2138 deletions(-) delete mode 100644 games/wave_collector/CMakeLists.txt delete mode 100644 games/wave_collector/LICENSE.txt delete mode 100644 games/wave_collector/Makefile delete mode 100644 games/wave_collector/Makefile.Android delete mode 100644 games/wave_collector/resources/audio/pause.wav delete mode 100644 games/wave_collector/resources/audio/sample_off.wav delete mode 100644 games/wave_collector/resources/audio/sample_on.wav delete mode 100644 games/wave_collector/resources/audio/start.wav delete mode 100644 games/wave_collector/resources/audio/wave.ogg delete mode 100644 games/wave_collector/resources/font.fnt delete mode 100644 games/wave_collector/resources/font.png delete mode 100644 games/wave_collector/resources/textures/background.png delete mode 100644 games/wave_collector/resources/textures/background_gameplay.png delete mode 100644 games/wave_collector/resources/textures/background_title.png delete mode 100644 games/wave_collector/resources/textures/icon_synchro.png delete mode 100644 games/wave_collector/resources/textures/icon_warp.png delete mode 100644 games/wave_collector/resources/textures/logo_raylib.png delete mode 100644 games/wave_collector/resources/textures/lose.png delete mode 100644 games/wave_collector/resources/textures/player.png delete mode 100644 games/wave_collector/resources/textures/sample_big.png delete mode 100644 games/wave_collector/resources/textures/sample_mid.png delete mode 100644 games/wave_collector/resources/textures/sample_small.png delete mode 100644 games/wave_collector/resources/textures/title.png delete mode 100644 games/wave_collector/resources/textures/win.png delete mode 100644 games/wave_collector/screens/screen_ending.c delete mode 100644 games/wave_collector/screens/screen_gameplay.c delete mode 100644 games/wave_collector/screens/screen_logo.c delete mode 100644 games/wave_collector/screens/screen_title.c delete mode 100644 games/wave_collector/screens/screens.h delete mode 100644 games/wave_collector/wave_collector.c (limited to 'games/wave_collector') diff --git a/games/wave_collector/CMakeLists.txt b/games/wave_collector/CMakeLists.txt deleted file mode 100644 index a87dbeda..00000000 --- a/games/wave_collector/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(wave_collector) - -# Grab the screens -file(GLOB screen_sources "screens/*.c") - -# Executable & linking -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c ${screen_sources}) -if (NOT TARGET raylib) - find_package(raylib 2.0 REQUIRED) -endif() -target_link_libraries(${PROJECT_NAME} raylib) - -# Resources -# Copy all of the resource files to the destination -file(COPY "resources/" DESTINATION "resources/") diff --git a/games/wave_collector/LICENSE.txt b/games/wave_collector/LICENSE.txt deleted file mode 100644 index 510604da..00000000 --- a/games/wave_collector/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ - -This game sources are licensed under an unmodified zlib/libpng license, -which is an OSI-certified, BSD-like license: - -Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) - -This software is provided "as-is", without any express or implied warranty. In no event -will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial -applications, and to alter it and redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not claim that you - wrote the original software. If you use this software in a product, an acknowledgment - in the product documentation would be appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be misrepresented - as being the original software. - - 3. This notice may not be removed or altered from any source distribution. \ No newline at end of file diff --git a/games/wave_collector/Makefile b/games/wave_collector/Makefile deleted file mode 100644 index 092d37d9..00000000 --- a/games/wave_collector/Makefile +++ /dev/null @@ -1,406 +0,0 @@ -#************************************************************************************************** -# -# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 -# -# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5) -# -# This software is provided "as-is", without any express or implied warranty. In no event -# will the authors be held liable for any damages arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, including commercial -# applications, and to alter it and redistribute it freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not claim that you -# wrote the original software. If you use this software in a product, an acknowledgment -# in the product documentation would be appreciated but is not required. -# -# 2. Altered source versions must be plainly marked as such, and must not be misrepresented -# as being the original software. -# -# 3. This notice may not be removed or altered from any source distribution. -# -#************************************************************************************************** - -.PHONY: all clean - -# Define required raylib variables -PROJECT_NAME ?= wave_collector -RAYLIB_VERSION ?= 3.0.0 -RAYLIB_API_VERSION ?= 3 -RAYLIB_PATH ?= C:\GitHub\raylib - -# Define default options - -# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB -PLATFORM ?= PLATFORM_DESKTOP - -# Locations of your newly installed library and associated headers. See ../src/Makefile -# On Linux, if you have installed raylib but cannot compile the examples, check that -# the *_INSTALL_PATH values here are the same as those in src/Makefile or point to known locations. -# To enable system-wide compile-time and runtime linking to libraylib.so, run ../src/$ sudo make install RAYLIB_LIBTYPE_SHARED. -# To enable compile-time linking to a special version of libraylib.so, change these variables here. -# To enable runtime linking to a special version of libraylib.so, see EXAMPLE_RUNTIME_PATH below. -# If there is a libraylib in both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, at runtime, -# the library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over the one at RAYLIB_INSTALL_PATH. -# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths. -DESTDIR ?= /usr/local -RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib -# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files. -RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include - -# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC - -# Build mode for project: DEBUG or RELEASE -BUILD_MODE ?= RELEASE - -# Use external GLFW library instead of rglfw module -# TODO: Review usage on Linux. Target version of choice. Switch on -lglfw or -lglfw3 -USE_EXTERNAL_GLFW ?= FALSE - -# Use Wayland display server protocol on Linux desktop -# by default it uses X11 windowing system -USE_WAYLAND_DISPLAY ?= FALSE - -# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - # No uname.exe on MinGW!, but OS=Windows_NT on Windows! - # ifeq ($(UNAME),Msys) -> Windows - ifeq ($(OS),Windows_NT) - PLATFORM_OS=WINDOWS - else - UNAMEOS=$(shell uname) - ifeq ($(UNAMEOS),Linux) - PLATFORM_OS=LINUX - endif - ifeq ($(UNAMEOS),FreeBSD) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),OpenBSD) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),NetBSD) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),DragonFly) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),Darwin) - PLATFORM_OS=OSX - endif - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - UNAMEOS=$(shell uname) - ifeq ($(UNAMEOS),Linux) - PLATFORM_OS=LINUX - endif -endif - -# RAYLIB_PATH adjustment for different platforms. -# If using GNU make, we can get the full path to the top of the tree. Windows? BSD? -# Required for ldconfig or other tools that do not perform path expansion. -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),LINUX) - RAYLIB_PREFIX ?= .. - RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX)) - endif -endif -# Default path for raylib on Raspberry Pi, if installed in different path, update it! -# This is not currently used by src/Makefile. Not sure of its origin or usage. Refer to wiki. -# TODO: update install: target in src/Makefile for RPI, consider relation to LINUX. -ifeq ($(PLATFORM),PLATFORM_RPI) - RAYLIB_PATH ?= /home/pi/raylib -endif - -ifeq ($(PLATFORM),PLATFORM_WEB) - # Emscripten required variables - EMSDK_PATH ?= C:/emsdk - EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten - CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin - PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64 - NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin - export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH) -endif - -# Define raylib release directory for compiled library. -# RAYLIB_RELEASE_PATH points to provided binaries or your freshly built version -RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src - -# EXAMPLE_RUNTIME_PATH embeds a custom runtime location of libraylib.so or other desired libraries -# into each example binary compiled with RAYLIB_LIBTYPE=SHARED. It defaults to RAYLIB_RELEASE_PATH -# so that these examples link at runtime with your version of libraylib.so in ../release/libs/linux -# without formal installation from ../src/Makefile. It aids portability and is useful if you have -# multiple versions of raylib, have raylib installed to a non-standard location, or want to -# bundle libraylib.so with your game. Change it to your liking. -# NOTE: If, at runtime, there is a libraylib.so at both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, -# The library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over RAYLIB_INSTALL_PATH, -# Implemented for LINUX below with CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH) -# To see the result, run readelf -d core/core_basic_window; looking at the RPATH or RUNPATH attribute. -# To see which libraries a built example is linking to, ldd core/core_basic_window; -# Look for libraylib.so.1 => $(RAYLIB_INSTALL_PATH)/libraylib.so.1 or similar listing. -EXAMPLE_RUNTIME_PATH ?= $(RAYLIB_RELEASE_PATH) - -# Define default C compiler: gcc -# NOTE: define g++ compiler if using C++ -CC = gcc - -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),OSX) - # OSX default compiler - CC = clang - endif - ifeq ($(PLATFORM_OS),BSD) - # FreeBSD, OpenBSD, NetBSD, DragonFly default compiler - CC = clang - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) - # Define RPI cross-compiler - #CC = armv6j-hardfloat-linux-gnueabi-gcc - CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc - endif -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - # HTML5 emscripten compiler - # WARNING: To compile to HTML5, code must be redesigned - # to use emscripten.h and emscripten_set_main_loop() - CC = emcc -endif - -# Define default make program: Mingw32-make -MAKE = mingw32-make - -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),LINUX) - MAKE = make - endif -endif - -# Define compiler flags: -# -O1 defines optimization level -# -g include debug information on compilation -# -s strip unnecessary data from build -# -Wall turns on most, but not all, compiler warnings -# -std=c99 defines C language mode (standard C from 1999 revision) -# -std=gnu99 defines C language mode (GNU C from 1999 revision) -# -Wno-missing-braces ignore invalid warning (GCC bug 53119) -# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec -CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces - -ifeq ($(BUILD_MODE),DEBUG) - CFLAGS += -g - ifeq ($(PLATFORM),PLATFORM_WEB) - CFLAGS += -s ASSERTIONS=1 --profiling - endif -else - ifeq ($(PLATFORM),PLATFORM_WEB) - CFLAGS += -Os - else - CFLAGS += -s -O1 - endif -endif - -# Additional flags for compiler (if desired) -#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),LINUX) - ifeq ($(RAYLIB_LIBTYPE),STATIC) - CFLAGS += -D_DEFAULT_SOURCE - endif - ifeq ($(RAYLIB_LIBTYPE),SHARED) - # Explicitly enable runtime link to libraylib.so - CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH) - endif - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - CFLAGS += -std=gnu99 -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - # -Os # size optimization - # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # -s USE_GLFW=3 # Use glfw3 library (context/input management) - # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! - # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) - # -s USE_PTHREADS=1 # multithreading support - # -s WASM=0 # disable Web Assembly, emitted by default - # -s EMTERPRETIFY=1 # enable emscripten code interpreter (very slow) - # -s EMTERPRETIFY_ASYNC=1 # support synchronous loops by emterpreter - # -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data - # -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) - # --profiling # include information for code profiling - # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) - # --preload-file resources # specify a resources folder for data compilation - CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources - - # Define a custom shell .html and output extension - CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html - EXT = .html -endif - -# Define include paths for required headers -# NOTE: Several external required libraries (stb and others) -INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external - -# Define additional directories containing required header files -ifeq ($(PLATFORM),PLATFORM_RPI) - # RPI required libraries - INCLUDE_PATHS += -I/opt/vc/include - INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux - INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads -endif -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),BSD) - # Consider -L$(RAYLIB_H_INSTALL_PATH) - INCLUDE_PATHS += -I/usr/local/include - endif - ifeq ($(PLATFORM_OS),LINUX) - # Reset everything. - # Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include - INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external - endif -endif - -# Define library paths containing required libs. -LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src - -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - # resource file contains windows executable icon and properties - LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data - # -Wl,--subsystem,windows hides the console window - ifeq ($(BUILD_MODE), RELEASE) - LDFLAGS += -Wl,--subsystem,windows - endif - endif - ifeq ($(PLATFORM_OS),BSD) - # Consider -L$(RAYLIB_INSTALL_PATH) - LDFLAGS += -L. -Lsrc -L/usr/local/lib - endif - ifeq ($(PLATFORM_OS),LINUX) - # Reset everything. - # Precedence: immediately local, installed version, raysan5 provided libs - LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) - endif -endif - -ifeq ($(PLATFORM),PLATFORM_RPI) - LDFLAGS += -L/opt/vc/lib -endif - -# Define any libraries required on linking -# if you want to link libraries (libname.so or libname.a), use the -lname -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - # Libraries for Windows desktop compilation - # NOTE: WinMM library required to set high-res timer resolution - LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm - # Required for physac examples - LDLIBS += -static -lpthread - endif - ifeq ($(PLATFORM_OS),LINUX) - # Libraries for Debian GNU/Linux desktop compiling - # NOTE: Required packages: libegl1-mesa-dev - LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt - - # On X11 requires also below libraries - LDLIBS += -lX11 - # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them - #LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor - - # On Wayland windowing system, additional libraries requires - ifeq ($(USE_WAYLAND_DISPLAY),TRUE) - LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon - endif - # Explicit link to libc - ifeq ($(RAYLIB_LIBTYPE),SHARED) - LDLIBS += -lc - endif - endif - ifeq ($(PLATFORM_OS),OSX) - # Libraries for OSX 10.9 desktop compiling - # NOTE: Required packages: libopenal-dev libegl1-mesa-dev - LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo - endif - ifeq ($(PLATFORM_OS),BSD) - # Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling - # NOTE: Required packages: mesa-libs - LDLIBS = -lraylib -lGL -lpthread -lm - - # On XWindow requires also below libraries - LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor - endif - ifeq ($(USE_EXTERNAL_GLFW),TRUE) - # NOTE: It could require additional packages installed: libglfw3-dev - LDLIBS += -lglfw - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - # Libraries for Raspberry Pi compiling - # NOTE: Required packages: libasound2-dev (ALSA) - LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - # Libraries for web (HTML5) compiling - LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc -endif - -# Define all source files required -PROJECT_SOURCE_FILES ?= \ - wave_collector.c \ - screens/screen_logo.c \ - screens/screen_title.c \ - screens/screen_gameplay.c \ - screens/screen_ending.c - -# Define all object files from source files -OBJS = $(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES)) - -# For Android platform we call a custom Makefile.Android -ifeq ($(PLATFORM),PLATFORM_ANDROID) - MAKEFILE_PARAMS = -f Makefile.Android - export PROJECT_NAME - export PROJECT_SOURCE_FILES -else - MAKEFILE_PARAMS = $(PROJECT_NAME) -endif - -# Default target entry -# NOTE: We call this Makefile target or Makefile.Android target -all: - $(MAKE) $(MAKEFILE_PARAMS) - -# Project target defined by PROJECT_NAME -$(PROJECT_NAME): $(OBJS) - $(CC) -o $(PROJECT_NAME)$(EXT) $(OBJS) $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) - -# Compile source files -# NOTE: This pattern will compile every module defined on $(OBJS) -%.o: %.c - $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) - -# Clean everything -clean: -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - del *.o *.exe /s - endif - ifeq ($(PLATFORM_OS),LINUX) - find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv - endif - ifeq ($(PLATFORM_OS),OSX) - find . -type f -perm +ugo+x -delete - rm -f *.o - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - find . -type f -executable -delete - rm -fv *.o -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - del *.o *.html *.js -endif - @echo Cleaning done - diff --git a/games/wave_collector/Makefile.Android b/games/wave_collector/Makefile.Android deleted file mode 100644 index 29d437b1..00000000 --- a/games/wave_collector/Makefile.Android +++ /dev/null @@ -1,300 +0,0 @@ -#************************************************************************************************** -# -# raylib makefile for Android project (APK building) -# -# Copyright (c) 2017 Ramon Santamaria (@raysan5) -# -# This software is provided "as-is", without any express or implied warranty. In no event -# will the authors be held liable for any damages arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, including commercial -# applications, and to alter it and redistribute it freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not claim that you -# wrote the original software. If you use this software in a product, an acknowledgment -# in the product documentation would be appreciated but is not required. -# -# 2. Altered source versions must be plainly marked as such, and must not be misrepresented -# as being the original software. -# -# 3. This notice may not be removed or altered from any source distribution. -# -#************************************************************************************************** - -# Define required raylib variables -PLATFORM ?= PLATFORM_ANDROID -RAYLIB_PATH ?= ..\.. - -# Define Android architecture (armeabi-v7a, arm64-v8a, x86, x86-64) and API version -ANDROID_ARCH ?= ARM -ANDROID_API_VERSION = 21 -ifeq ($(ANDROID_ARCH),ARM) - ANDROID_ARCH_NAME = armeabi-v7a -endif -ifeq ($(ANDROID_ARCH),ARM64) - ANDROID_ARCH_NAME = arm64-v8a -endif - -# Required path variables -# NOTE: JAVA_HOME must be set to JDK -JAVA_HOME ?= C:/JavaJDK -ANDROID_HOME = C:/android-sdk -ANDROID_TOOLCHAIN = C:/android_toolchain_$(ANDROID_ARCH)_API$(ANDROID_API_VERSION) -ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/28.0.1 -ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools - -# Android project configuration variables -PROJECT_NAME ?= raylib_game -PROJECT_LIBRARY_NAME ?= main -PROJECT_BUILD_PATH ?= android.$(PROJECT_NAME) -PROJECT_RESOURCES_PATH ?= resources -PROJECT_SOURCE_FILES ?= raylib_game.c - -# Some source files are placed in directories, when compiling to some -# output directory other than source, that directory must pre-exist. -# Here we get a list of required folders that need to be created on -# code output folder $(PROJECT_BUILD_PATH)\obj to avoid GCC errors. -PROJECT_SOURCE_DIRS = $(sort $(dir $(PROJECT_SOURCE_FILES))) - -# Android app configuration variables -APP_LABEL_NAME ?= rGame -APP_COMPANY_NAME ?= raylib -APP_PRODUCT_NAME ?= rgame -APP_VERSION_CODE ?= 1 -APP_VERSION_NAME ?= 1.0 -APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png -APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png -APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png -APP_SCREEN_ORIENTATION ?= landscape -APP_KEYSTORE_PASS ?= raylib - -# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC - -# Library path for libraylib.a/libraylib.so -RAYLIB_LIB_PATH = $(RAYLIB_PATH)\src - -# Shared libs must be added to APK if required -# NOTE: Generated NativeLoader.java automatically load those libraries -ifeq ($(RAYLIB_LIBTYPE),SHARED) - PROJECT_SHARED_LIBS = lib/$(ANDROID_ARCH_NAME)/libraylib.so -endif - -# Compiler and archiver -# NOTE: GCC is being deprecated in Android NDK r16 -ifeq ($(ANDROID_ARCH),ARM) - CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang - AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar -endif -ifeq ($(ANDROID_ARCH),ARM64) - CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-clang - AR = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-ar -endif - -# Compiler flags for arquitecture -ifeq ($(ANDROID_ARCH),ARM) - CFLAGS = -std=c99 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -endif -ifeq ($(ANDROID_ARCH),ARM64) - CFLAGS = -std=c99 -target aarch64 -mfix-cortex-a53-835769 -endif -# Compilation functions attributes options -CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC -# Compiler options for the linker -CFLAGS += -Wall -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes -# Preprocessor macro definitions -CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION) - -# Paths containing required header files -INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external/android/native_app_glue - -# Linker options -LDFLAGS = -Wl,-soname,lib$(PROJECT_LIBRARY_NAME).so -Wl,--exclude-libs,libatomic.a -LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -# Force linking of library module to define symbol -LDFLAGS += -u ANativeActivity_onCreate -# Library paths containing required libs -LDFLAGS += -L. -L$(PROJECT_BUILD_PATH)/obj -L$(PROJECT_BUILD_PATH)/lib/$(ANDROID_ARCH_NAME) -L$(ANDROID_TOOLCHAIN)\sysroot\usr\lib - -# Define any libraries to link into executable -# if you want to link libraries (libname.so or libname.a), use the -lname -LDLIBS = -lm -lc -lraylib -llog -landroid -lEGL -lGLESv2 -lOpenSLES -ldl - -# Generate target objects list from PROJECT_SOURCE_FILES -OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES)) - -# Android APK building process... some steps required... -# NOTE: typing 'make' will invoke the default target entry called 'all', -all: create_temp_project_dirs \ - copy_project_required_libs \ - copy_project_resources \ - generate_loader_script \ - generate_android_manifest \ - generate_apk_keystore \ - config_project_package \ - compile_project_code \ - compile_project_class \ - compile_project_class_dex \ - create_project_apk_package \ - sign_project_apk_package \ - zipalign_project_apk_package - -# Create required temp directories for APK building -create_temp_project_dirs: - if not exist $(PROJECT_BUILD_PATH) mkdir $(PROJECT_BUILD_PATH) - if not exist $(PROJECT_BUILD_PATH)\obj mkdir $(PROJECT_BUILD_PATH)\obj - if not exist $(PROJECT_BUILD_PATH)\src mkdir $(PROJECT_BUILD_PATH)\src - if not exist $(PROJECT_BUILD_PATH)\src\com mkdir $(PROJECT_BUILD_PATH)\src\com - if not exist $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME) mkdir $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME) - if not exist $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)\$(APP_PRODUCT_NAME) mkdir $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)\$(APP_PRODUCT_NAME) - if not exist $(PROJECT_BUILD_PATH)\lib mkdir $(PROJECT_BUILD_PATH)\lib - if not exist $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME) mkdir $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME) - if not exist $(PROJECT_BUILD_PATH)\bin mkdir $(PROJECT_BUILD_PATH)\bin - if not exist $(PROJECT_BUILD_PATH)\res mkdir $(PROJECT_BUILD_PATH)\res - if not exist $(PROJECT_BUILD_PATH)\res\drawable-ldpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-ldpi - if not exist $(PROJECT_BUILD_PATH)\res\drawable-mdpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-mdpi - if not exist $(PROJECT_BUILD_PATH)\res\drawable-hdpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-hdpi - if not exist $(PROJECT_BUILD_PATH)\res\values mkdir $(PROJECT_BUILD_PATH)\res\values - if not exist $(PROJECT_BUILD_PATH)\assets mkdir $(PROJECT_BUILD_PATH)\assets - if not exist $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) mkdir $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) - if not exist $(PROJECT_BUILD_PATH)\obj\screens mkdir $(PROJECT_BUILD_PATH)\obj\screens - $(foreach dir, $(PROJECT_SOURCE_DIRS), $(call create_dir, $(dir))) - -define create_dir - if not exist $(PROJECT_BUILD_PATH)\obj\$(1) mkdir $(PROJECT_BUILD_PATH)\obj\$(1) -endef - -# Copy required shared libs for integration into APK -# NOTE: If using shared libs they are loaded by generated NativeLoader.java -copy_project_required_libs: -ifeq ($(RAYLIB_LIBTYPE),SHARED) - copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME)\libraylib.so -endif -ifeq ($(RAYLIB_LIBTYPE),STATIC) - copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME)\libraylib.a -endif - -# Copy project required resources: strings.xml, icon.png, assets -# NOTE: Required strings.xml is generated and game resources are copied to assets folder -# TODO: Review xcopy usage, it can not be found in some systems! -copy_project_resources: - copy $(APP_ICON_LDPI) $(PROJECT_BUILD_PATH)\res\drawable-ldpi\icon.png /Y - copy $(APP_ICON_MDPI) $(PROJECT_BUILD_PATH)\res\drawable-mdpi\icon.png /Y - copy $(APP_ICON_HDPI) $(PROJECT_BUILD_PATH)\res\drawable-hdpi\icon.png /Y - @echo ^ > $(PROJECT_BUILD_PATH)/res/values/strings.xml - @echo ^^$(APP_LABEL_NAME)^^ >> $(PROJECT_BUILD_PATH)/res/values/strings.xml - if exist $(PROJECT_RESOURCES_PATH) C:\Windows\System32\xcopy $(PROJECT_RESOURCES_PATH) $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) /Y /E /F - -# Generate NativeLoader.java to load required shared libraries -# NOTE: Probably not the bet way to generate this file... but it works. -generate_loader_script: - @echo package com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME); > $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java - @echo. >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java - @echo public class NativeLoader extends android.app.NativeActivity { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java - @echo static { >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java -ifeq ($(RAYLIB_LIBTYPE),SHARED) - @echo System.loadLibrary("raylib"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java -endif - @echo System.loadLibrary("$(PROJECT_LIBRARY_NAME)"); >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java - @echo } >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java - @echo } >> $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java - -# Generate AndroidManifest.xml with all the required options -# NOTE: Probably not the bet way to generate this file... but it works. -generate_android_manifest: - @echo ^ > $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo package="com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME)" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo android:versionCode="$(APP_VERSION_CODE)" android:versionName="$(APP_VERSION_NAME)" ^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo android:configChanges="orientation|keyboardHidden|screenSize" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo android:screenOrientation="$(APP_SCREEN_ORIENTATION)" android:launchMode="singleTask" >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo android:clearTaskOnLaunch="true"^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - @echo ^ >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml - -# Generate storekey for APK signing: $(PROJECT_NAME).keystore -# NOTE: Configure here your Distinguished Names (-dname) if required! -generate_apk_keystore: - if not exist $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore $(JAVA_HOME)/bin/keytool -genkeypair -validity 1000 -dname "CN=$(APP_COMPANY_NAME),O=Android,C=ES" -keystore $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore -storepass $(APP_KEYSTORE_PASS) -keypass $(APP_KEYSTORE_PASS) -alias $(PROJECT_NAME)Key -keyalg RSA - -# Config project package and resource using AndroidManifest.xml and res/values/strings.xml -# NOTE: Generates resources file: src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/R.java -config_project_package: - $(ANDROID_BUILD_TOOLS)/aapt package -f -m -S $(PROJECT_BUILD_PATH)/res -J $(PROJECT_BUILD_PATH)/src -M $(PROJECT_BUILD_PATH)/AndroidManifest.xml -I $(ANDROID_HOME)/platforms/android-$(ANDROID_API_VERSION)/android.jar - -# Compile native_app_glue code as static library: obj/libnative_app_glue.a -compile_native_app_glue: - $(CC) -c $(RAYLIB_PATH)/src/external/android/native_app_glue/android_native_app_glue.c -o $(PROJECT_BUILD_PATH)/obj/native_app_glue.o $(CFLAGS) - $(AR) rcs $(PROJECT_BUILD_PATH)/obj/libnative_app_glue.a $(PROJECT_BUILD_PATH)/obj/native_app_glue.o - -# Compile project code into a shared library: lib/lib$(PROJECT_LIBRARY_NAME).so -compile_project_code: $(OBJS) - $(CC) -o $(PROJECT_BUILD_PATH)/lib/$(ANDROID_ARCH_NAME)/lib$(PROJECT_LIBRARY_NAME).so $(OBJS) -shared $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) - -# Compile all .c files required into object (.o) files -# NOTE: Those files will be linked into a shared library -$(PROJECT_BUILD_PATH)/obj/%.o:%.c - $(CC) -c $^ -o $@ $(INCLUDE_PATHS) $(CFLAGS) --sysroot=$(ANDROID_TOOLCHAIN)/sysroot - -# Compile project .java code into .class (Java bytecode) -compile_project_class: - $(JAVA_HOME)/bin/javac -verbose -source 1.7 -target 1.7 -d $(PROJECT_BUILD_PATH)/obj -bootclasspath $(JAVA_HOME)/jre/lib/rt.jar -classpath $(ANDROID_HOME)/platforms/android-$(ANDROID_API_VERSION)/android.jar;$(PROJECT_BUILD_PATH)/obj -sourcepath $(PROJECT_BUILD_PATH)/src $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/R.java $(PROJECT_BUILD_PATH)/src/com/$(APP_COMPANY_NAME)/$(APP_PRODUCT_NAME)/NativeLoader.java - -# Compile .class files into Dalvik executable bytecode (.dex) -# NOTE: Since Android 5.0, Dalvik interpreter (JIT) has been replaced by ART (AOT) -compile_project_class_dex: - $(ANDROID_BUILD_TOOLS)/dx --verbose --dex --output=$(PROJECT_BUILD_PATH)/bin/classes.dex $(PROJECT_BUILD_PATH)/obj - -# Create Android APK package: bin/$(PROJECT_NAME).unsigned.apk -# NOTE: Requires compiled classes.dex and lib$(PROJECT_LIBRARY_NAME).so -# NOTE: Use -A resources to define additional directory in which to find raw asset files -create_project_apk_package: - $(ANDROID_BUILD_TOOLS)/aapt package -f -M $(PROJECT_BUILD_PATH)/AndroidManifest.xml -S $(PROJECT_BUILD_PATH)/res -A $(PROJECT_BUILD_PATH)/assets -I $(ANDROID_HOME)/platforms/android-$(ANDROID_API_VERSION)/android.jar -F $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).unsigned.apk $(PROJECT_BUILD_PATH)/bin - cd $(PROJECT_BUILD_PATH) && $(ANDROID_BUILD_TOOLS)/aapt add bin/$(PROJECT_NAME).unsigned.apk lib/$(ANDROID_ARCH_NAME)/lib$(PROJECT_LIBRARY_NAME).so $(PROJECT_SHARED_LIBS) - -# Create signed APK package using generated Key: bin/$(PROJECT_NAME).signed.apk -sign_project_apk_package: - $(JAVA_HOME)/bin/jarsigner -keystore $(PROJECT_BUILD_PATH)/$(PROJECT_NAME).keystore -storepass $(APP_KEYSTORE_PASS) -keypass $(APP_KEYSTORE_PASS) -signedjar $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).signed.apk $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).unsigned.apk $(PROJECT_NAME)Key - -# Create zip-aligned APK package: $(PROJECT_NAME).apk -zipalign_project_apk_package: - $(ANDROID_BUILD_TOOLS)/zipalign -f 4 $(PROJECT_BUILD_PATH)/bin/$(PROJECT_NAME).signed.apk $(PROJECT_NAME).apk - -# Install $(PROJECT_NAME).apk to default emulator/device -# NOTE: Use -e (emulator) or -d (device) parameters if required -install: - $(ANDROID_PLATFORM_TOOLS)/adb install --abi $(ANDROID_ARCH_NAME) -rds $(PROJECT_NAME).apk - -# Check supported ABI for the device (armeabi-v7a, arm64-v8a, x86, x86_64) -check_device_abi: - $(ANDROID_PLATFORM_TOOLS)/adb shell getprop ro.product.cpu.abi - -# Monitorize output log coming from device, only raylib tag -logcat: - $(ANDROID_PLATFORM_TOOLS)/adb logcat -c - $(ANDROID_PLATFORM_TOOLS)/adb logcat raylib:V *:S - -# Install and monitorize $(PROJECT_NAME).apk to default emulator/device -deploy: - $(ANDROID_PLATFORM_TOOLS)/adb install -r $(PROJECT_NAME).apk - $(ANDROID_PLATFORM_TOOLS)/adb logcat -c - $(ANDROID_PLATFORM_TOOLS)/adb logcat raylib:V *:S - -#$(ANDROID_PLATFORM_TOOLS)/adb logcat *:W - -# Clean everything -clean: - del $(PROJECT_BUILD_PATH)\* /f /s /q - rmdir $(PROJECT_BUILD_PATH) /s /q - @echo Cleaning done diff --git a/games/wave_collector/resources/audio/pause.wav b/games/wave_collector/resources/audio/pause.wav deleted file mode 100644 index f35301ee..00000000 Binary files a/games/wave_collector/resources/audio/pause.wav and /dev/null differ diff --git a/games/wave_collector/resources/audio/sample_off.wav b/games/wave_collector/resources/audio/sample_off.wav deleted file mode 100644 index d2203e72..00000000 Binary files a/games/wave_collector/resources/audio/sample_off.wav and /dev/null differ diff --git a/games/wave_collector/resources/audio/sample_on.wav b/games/wave_collector/resources/audio/sample_on.wav deleted file mode 100644 index 38b7ca58..00000000 Binary files a/games/wave_collector/resources/audio/sample_on.wav and /dev/null differ diff --git a/games/wave_collector/resources/audio/start.wav b/games/wave_collector/resources/audio/start.wav deleted file mode 100644 index 66ce7ac1..00000000 Binary files a/games/wave_collector/resources/audio/start.wav and /dev/null differ diff --git a/games/wave_collector/resources/audio/wave.ogg b/games/wave_collector/resources/audio/wave.ogg deleted file mode 100644 index a5b0dea4..00000000 Binary files a/games/wave_collector/resources/audio/wave.ogg and /dev/null differ diff --git a/games/wave_collector/resources/font.fnt b/games/wave_collector/resources/font.fnt deleted file mode 100644 index 607e5a4d..00000000 --- a/games/wave_collector/resources/font.fnt +++ /dev/null @@ -1,100 +0,0 @@ -info face=font size=57 bold=0 italic=0 charset= unicode= stretchH=100 smooth=1 aa=1 padding=2,2,2,2 spacing=0,0 outline=0 -common lineHeight=68 base=55 scaleW=512 scaleH=1024 pages=1 packed=0 -page id=0 file="font.png" -chars count=95 -char id=32 x=2 y=57 width=0 height=0 xoffset=0 yoffset=55 xadvance=29 page=0 chnl=15 -char id=33 x=4 y=5 width=16 height=61 xoffset=2 yoffset=4 xadvance=16 page=0 chnl=15 -char id=34 x=22 y=10 width=25 height=27 xoffset=0 yoffset=8 xadvance=23 page=0 chnl=15 -char id=35 x=49 y=26 width=41 height=27 xoffset=-3 yoffset=24 xadvance=34 page=0 chnl=15 -char id=36 x=92 y=26 width=41 height=27 xoffset=-3 yoffset=24 xadvance=34 page=0 chnl=15 -char id=37 x=135 y=13 width=34 height=49 xoffset=-1 yoffset=12 xadvance=30 page=0 chnl=15 -char id=38 x=171 y=16 width=51 height=46 xoffset=-1 yoffset=14 xadvance=47 page=0 chnl=15 -char id=39 x=224 y=10 width=16 height=27 xoffset=0 yoffset=9 xadvance=13 page=0 chnl=15 -char id=40 x=242 y=8 width=18 height=60 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=15 -char id=41 x=262 y=8 width=18 height=60 xoffset=-1 yoffset=6 xadvance=15 page=0 chnl=15 -char id=42 x=282 y=11 width=29 height=32 xoffset=-1 yoffset=10 xadvance=25 page=0 chnl=15 -char id=43 x=313 y=25 width=29 height=29 xoffset=-2 yoffset=24 xadvance=24 page=0 chnl=15 -char id=44 x=344 y=45 width=16 height=29 xoffset=0 yoffset=44 xadvance=13 page=0 chnl=15 -char id=45 x=362 y=33 width=29 height=15 xoffset=1 yoffset=31 xadvance=28 page=0 chnl=15 -char id=46 x=393 y=45 width=16 height=17 xoffset=-1 yoffset=44 xadvance=13 page=0 chnl=15 -char id=47 x=411 y=6 width=37 height=61 xoffset=-3 yoffset=4 xadvance=30 page=0 chnl=15 -char id=48 x=450 y=14 width=43 height=49 xoffset=-1 yoffset=12 xadvance=39 page=0 chnl=15 -char id=49 x=2 y=91 width=22 height=49 xoffset=-1 yoffset=12 xadvance=19 page=0 chnl=15 -char id=50 x=26 y=91 width=42 height=49 xoffset=-1 yoffset=12 xadvance=39 page=0 chnl=15 -char id=51 x=70 y=91 width=41 height=48 xoffset=-2 yoffset=12 xadvance=35 page=0 chnl=15 -char id=52 x=113 y=91 width=40 height=48 xoffset=-2 yoffset=12 xadvance=35 page=0 chnl=15 -char id=53 x=155 y=91 width=35 height=49 xoffset=-1 yoffset=12 xadvance=31 page=0 chnl=15 -char id=54 x=192 y=91 width=48 height=48 xoffset=-2 yoffset=13 xadvance=43 page=0 chnl=15 -char id=55 x=242 y=91 width=38 height=49 xoffset=-2 yoffset=12 xadvance=33 page=0 chnl=15 -char id=56 x=282 y=91 width=49 height=49 xoffset=-2 yoffset=12 xadvance=43 page=0 chnl=15 -char id=57 x=333 y=91 width=46 height=49 xoffset=-2 yoffset=12 xadvance=41 page=0 chnl=15 -char id=58 x=381 y=102 width=16 height=37 xoffset=0 yoffset=24 xadvance=14 page=0 chnl=15 -char id=59 x=399 y=102 width=16 height=48 xoffset=0 yoffset=24 xadvance=15 page=0 chnl=15 -char id=60 x=417 y=98 width=41 height=42 xoffset=-2 yoffset=19 xadvance=37 page=0 chnl=15 -char id=61 x=460 y=104 width=29 height=30 xoffset=0 yoffset=25 xadvance=27 page=0 chnl=15 -char id=62 x=2 y=173 width=42 height=42 xoffset=-1 yoffset=19 xadvance=36 page=0 chnl=15 -char id=63 x=46 y=155 width=39 height=61 xoffset=0 yoffset=0 xadvance=35 page=0 chnl=15 -char id=64 x=87 y=167 width=58 height=53 xoffset=-1 yoffset=12 xadvance=54 page=0 chnl=15 -char id=65 x=147 y=169 width=47 height=47 xoffset=-2 yoffset=14 xadvance=41 page=0 chnl=15 -char id=66 x=196 y=169 width=47 height=46 xoffset=0 yoffset=14 xadvance=42 page=0 chnl=15 -char id=67 x=245 y=169 width=41 height=47 xoffset=-1 yoffset=14 xadvance=37 page=0 chnl=15 -char id=68 x=288 y=169 width=43 height=47 xoffset=0 yoffset=14 xadvance=39 page=0 chnl=15 -char id=69 x=333 y=169 width=43 height=46 xoffset=-2 yoffset=14 xadvance=39 page=0 chnl=15 -char id=70 x=378 y=169 width=40 height=46 xoffset=-2 yoffset=14 xadvance=35 page=0 chnl=15 -char id=71 x=420 y=169 width=41 height=46 xoffset=-2 yoffset=14 xadvance=37 page=0 chnl=15 -char id=72 x=463 y=167 width=43 height=48 xoffset=1 yoffset=12 xadvance=43 page=0 chnl=15 -char id=73 x=2 y=237 width=16 height=48 xoffset=1 yoffset=12 xadvance=15 page=0 chnl=15 -char id=74 x=20 y=239 width=25 height=46 xoffset=-2 yoffset=14 xadvance=21 page=0 chnl=15 -char id=75 x=47 y=238 width=45 height=49 xoffset=1 yoffset=14 xadvance=41 page=0 chnl=15 -char id=76 x=94 y=237 width=31 height=48 xoffset=1 yoffset=13 xadvance=28 page=0 chnl=15 -char id=77 x=127 y=239 width=51 height=46 xoffset=0 yoffset=14 xadvance=49 page=0 chnl=15 -char id=78 x=180 y=239 width=40 height=46 xoffset=0 yoffset=14 xadvance=39 page=0 chnl=15 -char id=79 x=222 y=239 width=51 height=46 xoffset=-2 yoffset=14 xadvance=45 page=0 chnl=15 -char id=80 x=275 y=239 width=44 height=46 xoffset=0 yoffset=14 xadvance=40 page=0 chnl=15 -char id=81 x=321 y=239 width=51 height=46 xoffset=-2 yoffset=14 xadvance=45 page=0 chnl=15 -char id=82 x=374 y=239 width=45 height=48 xoffset=0 yoffset=15 xadvance=41 page=0 chnl=15 -char id=83 x=421 y=238 width=34 height=48 xoffset=-2 yoffset=13 xadvance=28 page=0 chnl=15 -char id=84 x=457 y=239 width=41 height=47 xoffset=-2 yoffset=14 xadvance=36 page=0 chnl=15 -char id=85 x=2 y=306 width=46 height=46 xoffset=0 yoffset=15 xadvance=43 page=0 chnl=15 -char id=86 x=50 y=305 width=44 height=48 xoffset=-2 yoffset=13 xadvance=38 page=0 chnl=15 -char id=87 x=96 y=305 width=55 height=47 xoffset=-2 yoffset=13 xadvance=49 page=0 chnl=15 -char id=88 x=153 y=306 width=43 height=46 xoffset=-2 yoffset=14 xadvance=38 page=0 chnl=15 -char id=89 x=198 y=305 width=38 height=47 xoffset=-2 yoffset=13 xadvance=31 page=0 chnl=15 -char id=90 x=238 y=306 width=40 height=47 xoffset=-2 yoffset=14 xadvance=35 page=0 chnl=15 -char id=91 x=280 y=295 width=26 height=66 xoffset=1 yoffset=4 xadvance=24 page=0 chnl=15 -char id=92 x=308 y=293 width=37 height=61 xoffset=-4 yoffset=2 xadvance=29 page=0 chnl=15 -char id=93 x=347 y=295 width=26 height=66 xoffset=-2 yoffset=4 xadvance=22 page=0 chnl=15 -char id=94 x=375 y=294 width=28 height=17 xoffset=-1 yoffset=3 xadvance=24 page=0 chnl=15 -char id=95 x=405 y=346 width=49 height=15 xoffset=-1 yoffset=55 xadvance=45 page=0 chnl=15 -char id=96 x=456 y=295 width=20 height=17 xoffset=1 yoffset=3 xadvance=18 page=0 chnl=15 -char id=97 x=2 y=387 width=38 height=39 xoffset=-2 yoffset=22 xadvance=35 page=0 chnl=15 -char id=98 x=42 y=375 width=41 height=52 xoffset=1 yoffset=9 xadvance=38 page=0 chnl=15 -char id=99 x=85 y=387 width=38 height=39 xoffset=-2 yoffset=22 xadvance=34 page=0 chnl=15 -char id=100 x=125 y=375 width=41 height=52 xoffset=-2 yoffset=9 xadvance=38 page=0 chnl=15 -char id=101 x=168 y=387 width=38 height=39 xoffset=1 yoffset=22 xadvance=34 page=0 chnl=15 -char id=102 x=208 y=375 width=27 height=52 xoffset=1 yoffset=9 xadvance=23 page=0 chnl=15 -char id=103 x=237 y=387 width=41 height=52 xoffset=-2 yoffset=21 xadvance=38 page=0 chnl=15 -char id=104 x=280 y=375 width=37 height=51 xoffset=1 yoffset=9 xadvance=34 page=0 chnl=15 -char id=105 x=319 y=380 width=15 height=47 xoffset=2 yoffset=14 xadvance=16 page=0 chnl=15 -char id=106 x=336 y=378 width=25 height=60 xoffset=-6 yoffset=12 xadvance=18 page=0 chnl=15 -char id=107 x=363 y=375 width=40 height=51 xoffset=2 yoffset=9 xadvance=38 page=0 chnl=15 -char id=108 x=405 y=379 width=15 height=48 xoffset=1 yoffset=13 xadvance=16 page=0 chnl=15 -char id=109 x=422 y=387 width=47 height=39 xoffset=0 yoffset=22 xadvance=46 page=0 chnl=15 -char id=110 x=2 y=465 width=37 height=39 xoffset=0 yoffset=22 xadvance=34 page=0 chnl=15 -char id=111 x=41 y=465 width=41 height=40 xoffset=-1 yoffset=21 xadvance=37 page=0 chnl=15 -char id=112 x=84 y=465 width=41 height=52 xoffset=1 yoffset=22 xadvance=37 page=0 chnl=15 -char id=113 x=127 y=465 width=41 height=51 xoffset=-2 yoffset=22 xadvance=38 page=0 chnl=15 -char id=114 x=170 y=465 width=34 height=39 xoffset=1 yoffset=22 xadvance=30 page=0 chnl=15 -char id=115 x=206 y=462 width=37 height=42 xoffset=-2 yoffset=19 xadvance=31 page=0 chnl=15 -char id=116 x=245 y=453 width=36 height=52 xoffset=0 yoffset=9 xadvance=31 page=0 chnl=15 -char id=117 x=283 y=465 width=37 height=39 xoffset=0 yoffset=22 xadvance=35 page=0 chnl=15 -char id=118 x=322 y=463 width=35 height=41 xoffset=-2 yoffset=19 xadvance=28 page=0 chnl=15 -char id=119 x=359 y=463 width=51 height=41 xoffset=-2 yoffset=19 xadvance=44 page=0 chnl=15 -char id=120 x=412 y=465 width=35 height=40 xoffset=-2 yoffset=21 xadvance=29 page=0 chnl=15 -char id=121 x=449 y=465 width=37 height=52 xoffset=0 yoffset=22 xadvance=35 page=0 chnl=15 -char id=122 x=2 y=543 width=38 height=40 xoffset=-3 yoffset=21 xadvance=31 page=0 chnl=15 -char id=123 x=42 y=527 width=24 height=61 xoffset=-3 yoffset=5 xadvance=18 page=0 chnl=15 -char id=124 x=68 y=522 width=16 height=66 xoffset=1 yoffset=1 xadvance=15 page=0 chnl=15 -char id=125 x=86 y=527 width=24 height=61 xoffset=-1 yoffset=5 xadvance=18 page=0 chnl=15 -char id=126 x=112 y=526 width=32 height=16 xoffset=0 yoffset=4 xadvance=29 page=0 chnl=15 -char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=4 xadvance=29 page=0 chnl=15 \ No newline at end of file diff --git a/games/wave_collector/resources/font.png b/games/wave_collector/resources/font.png deleted file mode 100644 index 15287ccb..00000000 Binary files a/games/wave_collector/resources/font.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/background.png b/games/wave_collector/resources/textures/background.png deleted file mode 100644 index b4f767f7..00000000 Binary files a/games/wave_collector/resources/textures/background.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/background_gameplay.png b/games/wave_collector/resources/textures/background_gameplay.png deleted file mode 100644 index 9be7d17d..00000000 Binary files a/games/wave_collector/resources/textures/background_gameplay.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/background_title.png b/games/wave_collector/resources/textures/background_title.png deleted file mode 100644 index 19546d86..00000000 Binary files a/games/wave_collector/resources/textures/background_title.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/icon_synchro.png b/games/wave_collector/resources/textures/icon_synchro.png deleted file mode 100644 index 841f826b..00000000 Binary files a/games/wave_collector/resources/textures/icon_synchro.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/icon_warp.png b/games/wave_collector/resources/textures/icon_warp.png deleted file mode 100644 index e91f43d4..00000000 Binary files a/games/wave_collector/resources/textures/icon_warp.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/logo_raylib.png b/games/wave_collector/resources/textures/logo_raylib.png deleted file mode 100644 index 99ba5437..00000000 Binary files a/games/wave_collector/resources/textures/logo_raylib.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/lose.png b/games/wave_collector/resources/textures/lose.png deleted file mode 100644 index ba69a4c2..00000000 Binary files a/games/wave_collector/resources/textures/lose.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/player.png b/games/wave_collector/resources/textures/player.png deleted file mode 100644 index 86b843b2..00000000 Binary files a/games/wave_collector/resources/textures/player.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/sample_big.png b/games/wave_collector/resources/textures/sample_big.png deleted file mode 100644 index 6fb20b63..00000000 Binary files a/games/wave_collector/resources/textures/sample_big.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/sample_mid.png b/games/wave_collector/resources/textures/sample_mid.png deleted file mode 100644 index 20ec5868..00000000 Binary files a/games/wave_collector/resources/textures/sample_mid.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/sample_small.png b/games/wave_collector/resources/textures/sample_small.png deleted file mode 100644 index 5fa7d01b..00000000 Binary files a/games/wave_collector/resources/textures/sample_small.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/title.png b/games/wave_collector/resources/textures/title.png deleted file mode 100644 index 383dfdc3..00000000 Binary files a/games/wave_collector/resources/textures/title.png and /dev/null differ diff --git a/games/wave_collector/resources/textures/win.png b/games/wave_collector/resources/textures/win.png deleted file mode 100644 index 7d539f66..00000000 Binary files a/games/wave_collector/resources/textures/win.png and /dev/null differ diff --git a/games/wave_collector/screens/screen_ending.c b/games/wave_collector/screens/screen_ending.c deleted file mode 100644 index 7dc21965..00000000 --- a/games/wave_collector/screens/screen_ending.c +++ /dev/null @@ -1,111 +0,0 @@ -/********************************************************************************************** -* -* raylib - Advance Game template -* -* Ending Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Ending screen global variables -static int framesCounter; -static int finishScreen; - -static Texture2D texBackground; -static Texture2D texWin; -static Texture2D texLose; -static Texture2D texLogo; - -//---------------------------------------------------------------------------------- -// Ending Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Ending Screen Initialization logic -void InitEndingScreen(void) -{ - // TODO: Initialize ENDING screen variables here! - framesCounter = 0; - finishScreen = 0; - - texBackground = LoadTexture("resources/textures/background.png"); - texWin = LoadTexture("resources/textures/win.png"); - texLose = LoadTexture("resources/textures/lose.png"); - texLogo = LoadTexture("resources/textures/logo_raylib.png"); -} - -// Ending Screen Update logic -void UpdateEndingScreen(void) -{ - // TODO: Update ENDING screen variables here! - framesCounter++; - - // Press enter to return to TITLE screen - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - finishScreen = 1; - } -} - -// Ending Screen Draw logic -void DrawEndingScreen(void) -{ - DrawTexture(texBackground, 0, 0, WHITE); - - if (endingStatus == 1) // Win - { - DrawTexture(texWin, GetScreenWidth()/2 - texWin.width/2, 90, WHITE); - DrawTextEx(font, "congrats, you got the wave!", (Vector2){ 200, 335 }, font.baseSize, 0, WHITE); - } - else if (endingStatus == 2) // Lose - { - DrawTexture(texLose, GetScreenWidth()/2 - texWin.width/2, 90, WHITE); - DrawTextEx(font, "it seems you lose the wave...", (Vector2){ 205, 335 }, font.baseSize, 0, WHITE); - } - - DrawRectangle(0, GetScreenHeight() - 70, 560, 40, Fade(RAYWHITE, 0.8f)); - DrawText("(c) Developed by Ramon Santamaria (@raysan5)", 36, GetScreenHeight() - 60, 20, DARKBLUE); - - DrawText("powered by", GetScreenWidth() - 162, GetScreenHeight() - 190, 20, DARKGRAY); - DrawTexture(texLogo, GetScreenWidth() - 128 - 34, GetScreenHeight() - 128 - 36, WHITE); - - if ((framesCounter > 80) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to return", (Vector2){ 300, 464 }, font.baseSize, 0, SKYBLUE); -} - -// Ending Screen Unload logic -void UnloadEndingScreen(void) -{ - // TODO: Unload ENDING screen variables here! - UnloadTexture(texBackground); - UnloadTexture(texWin); - UnloadTexture(texLose); - UnloadTexture(texLogo); -} - -// Ending Screen should finish? -int FinishEndingScreen(void) -{ - return finishScreen; -} \ No newline at end of file diff --git a/games/wave_collector/screens/screen_gameplay.c b/games/wave_collector/screens/screen_gameplay.c deleted file mode 100644 index 1835c222..00000000 --- a/games/wave_collector/screens/screen_gameplay.c +++ /dev/null @@ -1,496 +0,0 @@ -/********************************************************************************************** -* -* raylib - Advance Game template -* -* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -#include - -#include // Required for: malloc(), free() -#include // Required for: sqrtf(), asinf() - -#define MAX_SAMPLES_SPEED 7 // Max speed for samples movement -#define MIN_SAMPLES_SPEED 3 // Min speed for samples movement -#define SAMPLES_SPACING 100 // Separation between samples in pixels -#define SAMPLES_MULTIPLIER 700 // Defines sample data scaling value (it would be adjusted to MAX_GAME_HEIGHT) -#define MAX_GAME_HEIGHT 400 // Defines max possible amplitude between samples (game area) - -//---------------------------------------------------------------------------------- -// Types and Structures Definition -//---------------------------------------------------------------------------------- -typedef struct Player { - Vector2 position; - Vector2 speed; - int width; - int height; - Color color; -} Player; - -typedef struct Sample { - Vector2 position; - float value; // Raw audio sample value (normalized) - int radius; - bool active; // Define if sample is active (can be collected) - bool collected; // Define if sample has been collected - bool renderable; // Define if sample should be rendered - Color color; -} Sample; - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Gameplay screen global variables -static int framesCounter; -static int finishScreen; -static bool pause; - -// Player variables -static Player player; -static Rectangle playerArea; // Define player movement area (and sample collection limits) - -static float warpCounter; // Time warp counter -static float synchro; // Calculates collected samples relation [0..1] - -static int combo; -static int maxCombo; - -static Rectangle waveRec; - -// Samples variables -static Sample *samples; // Game samples -static int totalSamples; // Total game samples (proportional to waveData num samples) -static int collectedSamples; // Samples collected by player -static int currentSample; // Last sample to go through player collect area -static float samplesSpeed; // All samples move at the same speed -static float waveTime; // Total sample time in ms - -// Resources variables -static Texture2D texBackground; -static Texture2D texPlayer; -static Texture2D texSampleSmall; -static Texture2D texSampleMid; -static Texture2D texSampleBig; - -static RenderTexture2D waveTarget; - -static Sound fxSampleOn; // Collected sample sound -static Sound fxSampleOff; // Miss sample sound -static Sound fxPause; // Pause sound -// Debug variables - -//------------------------------------------------------------------------------------ -// Module Functions Declaration (local) -//------------------------------------------------------------------------------------ -static void DrawSamplesMap(Sample *samples, int sampleCount, int playedSamples, Rectangle bounds, Color color); - -//---------------------------------------------------------------------------------- -// Gameplay Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Gameplay Screen Initialization logic -void InitGameplayScreen(void) -{ - framesCounter = 0; - finishScreen = 0; - pause = false; - endingStatus = 0; - - // Textures loading - texBackground = LoadTexture("resources/textures/background_gameplay.png"); - texPlayer = LoadTexture("resources/textures/player.png"); - texSampleSmall = LoadTexture("resources/textures/sample_small.png"); - texSampleMid = LoadTexture("resources/textures/sample_mid.png"); - texSampleBig = LoadTexture("resources/textures/sample_big.png"); - - waveRec = (Rectangle){ 32, 32, 1280 - 64, 105 }; - waveTarget = LoadRenderTexture(waveRec.width, waveRec.height); - - // Sound loading - fxSampleOn = LoadSound("resources/audio/sample_on.wav"); - fxSampleOff = LoadSound("resources/audio/sample_off.wav"); - fxPause = LoadSound("resources/audio/pause.wav"); - - SetSoundVolume(fxSampleOn, 0.6f); - SetSoundVolume(fxPause, 0.5f); - - // Initialize player data - playerArea = (Rectangle){ 200, 160, 80, 400 }; - - player.width = 20; - player.height = 60; - player.speed = (Vector2){ 15, 15 }; - player.color = GOLD; - player.position = (Vector2){ playerArea.x + playerArea.width/2 - texPlayer.width/2, - playerArea.y + playerArea.height/2 - texPlayer.height/2 }; - - warpCounter = 395; - synchro = 0.2f; - - combo = 0; - maxCombo = 0; - - // Initialize wave and samples data - Wave wave = LoadWave("resources/audio/wave.ogg"); - float *waveData = GetWaveData(wave); // TODO: Be careful with channels! - - // We calculate the required parameters to adjust audio time to gameplay time - // that way samples collected correspond to audio playing - // Synchonization is not perfect due to possible rounding issues (float to int) - waveTime = wave.sampleCount/wave.sampleRate; // Total sample time in seconds - float requiredSamples = (MAX_SAMPLES_SPEED*waveTime*60 - 1000)/SAMPLES_SPACING; - int samplesDivision = (int)(wave.sampleCount/requiredSamples); - - totalSamples = wave.sampleCount/samplesDivision; - - // We don't need wave any more (already got waveData) - UnloadWave(wave); - - collectedSamples = 0; - - // Init samples - samples = (Sample *)malloc(totalSamples*sizeof(Sample)); - - // Normalize wave data (min vs max values) to scale properly - float minSampleValue = 0.0f; - float maxSampleValue = 0.0f; - - for (int i = 0; i < totalSamples; i++) - { - if (waveData[i*samplesDivision] < minSampleValue) minSampleValue = waveData[i*samplesDivision]; - if (waveData[i*samplesDivision] > maxSampleValue) maxSampleValue = waveData[i*samplesDivision]; - } - - float sampleScaleFactor = 1.0f/(maxSampleValue - minSampleValue); // 400 pixels maximum size - - // Initialize samples - for (int i = 0; i < totalSamples; i++) - { - samples[i].value = waveData[i*samplesDivision]*sampleScaleFactor; // Normalized value [-1.0..1.0] - samples[i].position.x = player.position.x + 1000 + i*SAMPLES_SPACING; - - samples[i].position.y = GetScreenHeight()/2 + samples[i].value*SAMPLES_MULTIPLIER; - - if (samples[i].position.y > GetScreenHeight()/2 + MAX_GAME_HEIGHT/2) samples[i].position.y = GetScreenHeight()/2 - MAX_GAME_HEIGHT/2; - else if (samples[i].position.y < GetScreenHeight()/2 - MAX_GAME_HEIGHT/2) samples[i].position.y = GetScreenHeight()/2 + MAX_GAME_HEIGHT/2; - - samples[i].radius = 6; - samples[i].active = true; - samples[i].collected = false; - samples[i].color = RED; - samples[i].renderable = false; - } - - samplesSpeed = MAX_SAMPLES_SPEED; - currentSample = 0; - - //FILE *samplesFile = fopen("resources/samples.data", "wb"); - //fwrite(samples, totalSamples*sizeof(Sample), 1, samplesFile); - //fclose(samplesFile); - - // We already saved the samples we needed for the game, we can free waveData - free(waveData); - - // Load and start playing music - // NOTE: Music is loaded in main code base - StopMusicStream(music); - PlayMusicStream(music); -} - -// Gameplay Screen Update logic -void UpdateGameplayScreen(void) -{ - if (IsKeyPressed('P')) - { - PlaySound(fxPause); - pause = !pause; - - if (pause) PauseMusicStream(music); - else ResumeMusicStream(music); - } - - if (!pause) - { - framesCounter++; // Time starts counting to awake enemies - - // Player movement logic (mouse) - player.position.y = GetMousePosition().y; - - // Player movement logic (keyboard) - if (IsKeyDown(KEY_W)) player.position.y -= player.speed.y; - else if (IsKeyDown(KEY_S)) player.position.y += player.speed.y; - - // Player movement logic (gamepad) - /* - if (IsGamepadAvailable(GAMEPAD_PLAYER1)) - { - Vector2 movement = { 0.0f }; - - movement.x = GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X); - movement.y = GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y); - - player.position.x += movement.x*0.1f; // Scale gamepad movement value - player.position.y += movement.y*0.1f; // Scale gamepad movement value - } - */ - - // Player logic: check player area limits - if (player.position.x < playerArea.x) player.position.x = playerArea.x; - else if ((player.position.x + player.width) > (playerArea.x + playerArea.width)) player.position.x = playerArea.x + playerArea.width - player.width; - - if (player.position.y < playerArea.y) player.position.y = playerArea.y; - else if ((player.position.y + player.height) > (playerArea.y + playerArea.height)) player.position.y = playerArea.y + playerArea.height - player.height; - - // Samples logic - for (int i = 0; i < totalSamples; i++) - { - // Samples movement logic - samples[i].position.x -= samplesSpeed; - - if (((samples[i].position.x + samples[i].radius) > -SAMPLES_SPACING) && - ((samples[i].position.x - samples[i].radius) < GetScreenWidth())) samples[i].renderable = true; - else samples[i].renderable = false; - - // Samples catch logic - if (!samples[i].collected && CheckCollisionCircleRec(samples[i].position, samples[i].radius, (Rectangle){ (int)player.position.x, (int)player.position.y, player.width, player.height })) - { - samples[i].collected = true; - collectedSamples++; - synchro += 0.02; - - combo++; - if (combo > maxCombo) maxCombo = combo; - - if (synchro >= 1.0f) synchro = 1.0f; - - // Set sound pitch depending on sample position (base pitch: 1.0f) - // NOTE: waveData[i*WAVE_SAMPLES_DIV] is scaled to [0.3..1.7] - SetSoundPitch(fxSampleOn, samples[i].value*1.4f + 0.7f); - - PlaySound(fxSampleOn); - } - - if ((samples[i].position.x - samples[i].radius) < player.position.x) - { - currentSample = i; // Register last sample going out range - - if (samples[i].active) - { - samples[i].active = false; - - if (!samples[i].collected) - { - synchro -= 0.05f; - PlaySound(fxSampleOff); - combo = 0; - } - } - } - } - - if (IsKeyDown(KEY_SPACE) && (warpCounter > 0)) - { - warpCounter--; - if (warpCounter < 0) warpCounter = 0; - - samplesSpeed -= 0.1f; - if (samplesSpeed <= MIN_SAMPLES_SPEED) samplesSpeed = MIN_SAMPLES_SPEED; - - SetMusicPitch(music, samplesSpeed/MAX_SAMPLES_SPEED); - } - else - { - warpCounter++; - if (warpCounter > 395) warpCounter = 395; - - samplesSpeed += 0.1f; - if (samplesSpeed >= MAX_SAMPLES_SPEED) samplesSpeed = MAX_SAMPLES_SPEED; - - SetMusicPitch(music, samplesSpeed/MAX_SAMPLES_SPEED); - } - - // Check ending conditions - if (currentSample >= totalSamples - 1) - { - endingStatus = 1; // Win - finishScreen = 1; - } - - if (synchro <= 0.0f) - { - synchro = 0.0f; - endingStatus = 2; // Loose - finishScreen = 1; - } - } -} - -// Gameplay Screen Draw logic -void DrawGameplayScreen(void) -{ - // Draw background - DrawTexture(texBackground, 0, 0, WHITE); - - // Screen elements drawing - //DrawRectangleLines(playerArea.x, playerArea.y, playerArea.width, playerArea.height, BLUE); - DrawRectangle(0, GetScreenHeight()/2 - 1, GetScreenWidth(), 2, Fade(BLUE, 0.3f)); - //DrawRectangleLines(0, GetScreenHeight()/2 - MAX_GAME_HEIGHT/2, GetScreenWidth(), MAX_GAME_HEIGHT, GRAY); - - // Draw samples - for (int i = 0; i < totalSamples - 1; i++) - { - if (samples[i].renderable) - { - Color col = samples[i].color; - - if (i < (currentSample + 1)) col = Fade(DARKGRAY, 0.5f); - else col = WHITE; - - if (!samples[i].collected) - { - //DrawCircleV(samples[i].position, samples[i].radius, col); - - if (combo > 30) DrawTexture(texSampleSmall, samples[i].position.x - texSampleSmall.width/2, samples[i].position.y - texSampleSmall.height/2, col); - else if (combo > 15) DrawTexture(texSampleMid, samples[i].position.x - texSampleMid.width/2, samples[i].position.y - texSampleMid.height/2, col); - else DrawTexture(texSampleBig, samples[i].position.x - texSampleBig.width/2, samples[i].position.y - texSampleBig.height/2, col); - } - - if (i < (currentSample + 1)) col = Fade(GRAY, 0.3f); - else col = Fade(RED, 0.5f); - - // Draw line between samples - DrawLineEx(samples[i].position, samples[i + 1].position, 3.0f, col); - } - } - - // Draw player - //DrawRectangle((int)player.position.x, (int)player.position.y, player.width, player.height, player.color); - DrawTexture(texPlayer, player.position.x - 32, player.position.y - 24, WHITE); - - // Draw pause message - if (pause) DrawTextEx(font, "WAVE PAUSED", (Vector2){ 235, 400 }, font.baseSize*2, 0, WHITE); - - // Draw number of samples - //DrawText(FormatText("%05i", collectedSamples), 900, 200, 40, GRAY); - //DrawText(FormatText("%05i", totalSamples), 900, 250, 40, GRAY); - DrawTextEx(font, FormatText("%05i / %05i", collectedSamples, totalSamples), (Vector2){810, 170}, font.baseSize, -2, SKYBLUE); - - // Draw combo - DrawTextEx(font, FormatText("Combo: %02i [max: %02i]", combo, maxCombo), (Vector2){200, 170}, font.baseSize/2, -2, SKYBLUE); - - // Draw synchonicity level - DrawRectangle(99, 622, 395, 32, Fade(RAYWHITE, 0.8f)); - - if (synchro <= 0.3f) DrawRectangle(99, 622, synchro*395, 32, Fade(RED, 0.8f)); - else if (synchro <= 0.8f) DrawRectangle(99, 622, synchro*395, 32, Fade(ORANGE,0.8f)); - else if (synchro < 1.0f) DrawRectangle(99, 622, synchro*395, 32, Fade(LIME,0.8f)); - else DrawRectangle(99, 622, synchro*395, 32, Fade(GREEN, 0.9f)); - - DrawRectangleLines(99, 622, 395, 32, MAROON); - - if (synchro == 1.0f) DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.baseSize, -2, GREEN); - else DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.baseSize, -2, SKYBLUE); - - // Draw time warp coool-down bar - DrawRectangle(754, 622, 395, 32, Fade(RAYWHITE, 0.8f)); - DrawRectangle(754, 622, warpCounter, 32, Fade(SKYBLUE, 0.8f)); - DrawRectangleLines(754, 622, 395, 32, DARKGRAY); - //DrawText(FormatText("%02i%%", (int)(synchro*100)), 754 + 410, 628, 20, DARKGRAY); - DrawTextEx(font, FormatText("%02i%%", (int)((float)warpCounter/395.0f*100.0f)), (Vector2){754 + 390, 600}, font.baseSize, -2, SKYBLUE); - - // Draw wave - if (waveTarget.texture.id <= 0) // Render target could not be loaded (OpenGL 1.1) - { - // Draw wave directly on screen - DrawSamplesMap(samples, totalSamples, currentSample, waveRec, MAROON); - DrawRectangle(waveRec.x + (int)currentSample*1215/totalSamples, waveRec.y, 2, 99, DARKGRAY); - } - else - { - // Draw wave using render target - BeginTextureMode(waveTarget); - ClearBackground(BLANK); - DrawSamplesMap(samples, totalSamples, currentSample, (Rectangle){ 0, 0, waveTarget.texture.width, waveTarget.texture.height }, MAROON); - EndTextureMode(); - - // TODO: Apply antialiasing shader - - DrawTextureEx(waveTarget.texture, (Vector2){ waveRec.x, waveRec.y }, 0.0f, 1.0f, WHITE); - DrawRectangle(waveRec.x + (int)currentSample*1215/totalSamples, waveRec.y, 2, 99, DARKGRAY); - } -} - -// Gameplay Screen Unload logic -void UnloadGameplayScreen(void) -{ - StopMusicStream(music); - - // Unload textures - UnloadTexture(texBackground); - UnloadTexture(texPlayer); - UnloadTexture(texSampleSmall); - UnloadTexture(texSampleMid); - UnloadTexture(texSampleBig); - - UnloadRenderTexture(waveTarget); - - // Unload sounds - UnloadSound(fxSampleOn); - UnloadSound(fxSampleOff); - UnloadSound(fxPause); - - free(samples); // Unload game samples -} - -// Gameplay Screen should finish? -int FinishGameplayScreen(void) -{ - return finishScreen; -} - -//------------------------------------------------------------------------------------ -// Module Functions Definitions (local) -//------------------------------------------------------------------------------------ - -// Draw samples in wave form (including already played samples in a different color!) -// NOTE: For proper visualization, MSAA x4 is recommended, alternatively -// it should be rendered to a bigger texture and then scaled down with -// bilinear/trilinear texture filtering -static void DrawSamplesMap(Sample *samples, int sampleCount, int playedSamples, Rectangle bounds, Color color) -{ - // NOTE: We just pick a sample to draw every increment - float sampleIncrementX = (float)bounds.width/sampleCount; - - Color col = color; - - for (int i = 0; i < sampleCount - 1; i++) - { - if (i < playedSamples) col = GRAY; - else col = color; - - DrawLineV((Vector2){ (float)bounds.x + (float)i*sampleIncrementX, (float)(bounds.y + bounds.height/2) + samples[i].value*bounds.height }, - (Vector2){ (float)bounds.x + (float)(i + 1)*sampleIncrementX, (float)(bounds.y + bounds.height/2) + + samples[i + 1].value*bounds.height }, col); - } -} \ No newline at end of file diff --git a/games/wave_collector/screens/screen_logo.c b/games/wave_collector/screens/screen_logo.c deleted file mode 100644 index 5f18a321..00000000 --- a/games/wave_collector/screens/screen_logo.c +++ /dev/null @@ -1,181 +0,0 @@ -/********************************************************************************************** -* -* raylib - Advance Game template -* -* Logo Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -#define LOGO_RECS_SIDE 16 - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Logo screen global variables -static int framesCounter; -static int finishScreen; - -static int logoPositionX; -static int logoPositionY; - -static int lettersCount; - -static int topSideRecWidth; -static int leftSideRecHeight; - -static int bottomSideRecWidth; -static int rightSideRecHeight; - -static int state; // Tracking animation states (State Machine) -static float alpha = 1.0f; // Useful for fading - -//---------------------------------------------------------------------------------- -// Logo Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Logo Screen Initialization logic -void InitLogoScreen(void) -{ - // Initialize LOGO screen variables here! - finishScreen = 0; - framesCounter = 0; - lettersCount = 0; - - logoPositionX = GetScreenWidth()/2 - 128; - logoPositionY = GetScreenHeight()/2 - 128; - - topSideRecWidth = LOGO_RECS_SIDE; - leftSideRecHeight = LOGO_RECS_SIDE; - bottomSideRecWidth = LOGO_RECS_SIDE; - rightSideRecHeight = LOGO_RECS_SIDE; - - state = 0; - alpha = 1.0f; -} - -// Logo Screen Update logic -void UpdateLogoScreen(void) -{ - // Update LOGO screen variables here! - if (state == 0) // State 0: Small box blinking - { - framesCounter++; - - if (framesCounter == 80) - { - state = 1; - framesCounter = 0; // Reset counter... will be used later... - - PlayMusicStream(music); // Start playing music... ;) - } - } - else if (state == 1) // State 1: Top and left bars growing - { - topSideRecWidth += 8; - leftSideRecHeight += 8; - - if (topSideRecWidth == 256) state = 2; - } - else if (state == 2) // State 2: Bottom and right bars growing - { - bottomSideRecWidth += 8; - rightSideRecHeight += 8; - - if (bottomSideRecWidth == 256) state = 3; - } - else if (state == 3) // State 3: Letters appearing (one by one) - { - framesCounter++; - - if (lettersCount < 10) - { - if (framesCounter/15) // Every 12 frames, one more letter! - { - lettersCount++; - framesCounter = 0; - } - } - else // When all letters have appeared, just fade out everything - { - if (framesCounter > 200) - { - alpha -= 0.02f; - - if (alpha <= 0.0f) - { - alpha = 0.0f; - finishScreen = 1; - } - } - } - } -} - -// Logo Screen Draw logic -void DrawLogoScreen(void) -{ - if (state == 0) - { - if ((framesCounter/10)%2) DrawRectangle(logoPositionX, logoPositionY, 16, 16, BLACK); - } - else if (state == 1) - { - DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK); - DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK); - } - else if (state == 2) - { - DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, BLACK); - DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, BLACK); - - DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, BLACK); - DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, BLACK); - } - else if (state == 3) - { - DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, Fade(BLACK, alpha)); - DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, Fade(BLACK, alpha)); - - DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, Fade(BLACK, alpha)); - DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, Fade(BLACK, alpha)); - - DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, Fade(RAYWHITE, alpha)); - - DrawText(SubText("raylib", 0, lettersCount), GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha)); - - if (framesCounter > 20) DrawText("powered by", logoPositionX, logoPositionY - 27, 20, Fade(DARKGRAY, alpha)); - } -} - -// Logo Screen Unload logic -void UnloadLogoScreen(void) -{ - // Unload LOGO screen variables here! -} - -// Logo Screen should finish? -int FinishLogoScreen(void) -{ - return finishScreen; -} \ No newline at end of file diff --git a/games/wave_collector/screens/screen_title.c b/games/wave_collector/screens/screen_title.c deleted file mode 100644 index 5c414f4f..00000000 --- a/games/wave_collector/screens/screen_title.c +++ /dev/null @@ -1,112 +0,0 @@ -/********************************************************************************************** -* -* raylib - Advance Game template -* -* Title Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Title screen global variables -static int framesCounter; -static int finishScreen; - -static Texture2D texBackground; -static Texture2D texTitle; -static Texture2D texLogo; - -static float titleAlpha = 0.0f; - -static Sound fxStart; - -//---------------------------------------------------------------------------------- -// Title Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Title Screen Initialization logic -void InitTitleScreen(void) -{ - // Initialize TITLE screen variables here! - framesCounter = 0; - finishScreen = 0; - - texBackground = LoadTexture("resources/textures/background_title.png"); - texTitle = LoadTexture("resources/textures/title.png"); - texLogo = LoadTexture("resources/textures/logo_raylib.png"); - - fxStart = LoadSound("resources/audio/start.wav"); -} - -// Title Screen Update logic -void UpdateTitleScreen(void) -{ - // Update TITLE screen variables here! - framesCounter++; - - titleAlpha += 0.005f; - - if (titleAlpha >= 1.0f) titleAlpha = 1.0f; - - // Press enter to change to ATTIC screen - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - PlaySound(fxStart); - StopMusicStream(music); - finishScreen = 1; - } -} - -// Title Screen Draw logic -void DrawTitleScreen(void) -{ - DrawTexture(texBackground, 0, 0, WHITE); - DrawTexture(texTitle, GetScreenWidth()/2 - texTitle.width/2, -25, Fade(WHITE, titleAlpha)); - - DrawRectangle(0, GetScreenHeight() - 70, 560, 40, Fade(RAYWHITE, 0.8f)); - DrawText("(c) Developed by Ramon Santamaria (@raysan5)", 36, GetScreenHeight() - 60, 20, DARKBLUE); - - DrawText("powered by", GetScreenWidth() - 162, GetScreenHeight() - 190, 20, DARKGRAY); - DrawTexture(texLogo, GetScreenWidth() - 128 - 34, GetScreenHeight() - 128 - 36, WHITE); - - if ((framesCounter > 160) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to start", (Vector2){ 325, 500 }, font.baseSize, 0, SKYBLUE); -} - -// Title Screen Unload logic -void UnloadTitleScreen(void) -{ - // Unload TITLE screen variables here! - UnloadTexture(texBackground); - UnloadTexture(texTitle); - UnloadTexture(texLogo); - - UnloadSound(fxStart); -} - -// Title Screen should finish? -int FinishTitleScreen(void) -{ - return finishScreen; -} \ No newline at end of file diff --git a/games/wave_collector/screens/screens.h b/games/wave_collector/screens/screens.h deleted file mode 100644 index 6e896d58..00000000 --- a/games/wave_collector/screens/screens.h +++ /dev/null @@ -1,88 +0,0 @@ -/********************************************************************************************** -* -* raylib - Advance Game template -* -* Screens Functions Declarations (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#ifndef SCREENS_H -#define SCREENS_H - -//---------------------------------------------------------------------------------- -// Types and Structures Definition -//---------------------------------------------------------------------------------- -typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen; - -//---------------------------------------------------------------------------------- -// Global Variables Definition -//---------------------------------------------------------------------------------- -GameScreen currentScreen; -Font font; -Music music; -int endingStatus; // 1 - Win, 2 - Lose - -char *sampleFilename; // Required for custom music file - -#ifdef __cplusplus -extern "C" { // Prevents name mangling of functions -#endif - -//---------------------------------------------------------------------------------- -// Logo Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLogoScreen(void); -void UpdateLogoScreen(void); -void DrawLogoScreen(void); -void UnloadLogoScreen(void); -int FinishLogoScreen(void); - -//---------------------------------------------------------------------------------- -// Title Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitTitleScreen(void); -void UpdateTitleScreen(void); -void DrawTitleScreen(void); -void UnloadTitleScreen(void); -int FinishTitleScreen(void); - -//---------------------------------------------------------------------------------- -// Gameplay Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitGameplayScreen(void); -void UpdateGameplayScreen(void); -void DrawGameplayScreen(void); -void UnloadGameplayScreen(void); -int FinishGameplayScreen(void); - -//---------------------------------------------------------------------------------- -// Ending Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitEndingScreen(void); -void UpdateEndingScreen(void); -void DrawEndingScreen(void); -void UnloadEndingScreen(void); -int FinishEndingScreen(void); - -#ifdef __cplusplus -} -#endif - -#endif // SCREENS_H \ No newline at end of file diff --git a/games/wave_collector/wave_collector.c b/games/wave_collector/wave_collector.c deleted file mode 100644 index 64881816..00000000 --- a/games/wave_collector/wave_collector.c +++ /dev/null @@ -1,308 +0,0 @@ -/******************************************************************************************* -* -* WAVE COLLECTOR [GLOBAL GAME JAM 2017] -* -* The ultimate wave particles collector is here! -* You must follow the wave and collect all the particles -* The level is actually the wave and the wave is the level! -* Be fast! Be smart! Be the best wave collector! -* -* This game has been created using raylib v1.7 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2017 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" -#include "screens/screens.h" // NOTE: Defines global variable: currentScreen - -#include - -#include // Required for: printf() -#include // Required for: strcpy() - -#if defined(PLATFORM_WEB) - #include -#endif - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- -const int screenWidth = 1280; -const int screenHeight = 720; - -// Required variables to manage screen transitions (fade-in, fade-out) -static float transAlpha = 0.0f; -static bool onTransition = false; -static bool transFadeOut = false; -static int transFromScreen = -1; -static int transToScreen = -1; - -// NOTE: Some global variables that require to be visible for all screens, -// are defined in screens.h (i.e. currentScreen) - -//---------------------------------------------------------------------------------- -// Local Functions Declaration -//---------------------------------------------------------------------------------- -static void ChangeToScreen(int screen); // No transition effect - -static void TransitionToScreen(int screen); -static void UpdateTransition(void); -static void DrawTransition(void); - -static void UpdateDrawFrame(void); // Update and Draw one frame - -//---------------------------------------------------------------------------------- -// Main entry point -//---------------------------------------------------------------------------------- -int main(int argc, char *argv[]) -{ - // Initialization - //--------------------------------------------------------- -#if defined(PLATFORM_DESKTOP) - // TODO: Support for dropped files on the exe - - // Support command line argument for custom music file - if (argc > 1) - { - // Just supporting an input argument parameter!!! o__O - - if ((IsFileExtension(argv[1], ".ogg")) || - (IsFileExtension(argv[1], ".wav"))) - { - if (sampleFilename != NULL) free(sampleFilename); - - sampleFilename = (char *)malloc(256); - strcpy(sampleFilename, argv[1]); - - printf("Custom audio file: %s", sampleFilename); - } - } -#endif - -#ifndef PLATFORM_ANDROID - SetConfigFlags(FLAG_MSAA_4X_HINT); -#endif - // Note windowTitle is unused on Android - InitWindow(screenWidth, screenHeight, "WAVE COLLECTOR [GGJ17]"); - - // Global data loading (assets that must be available in all screens, i.e. fonts) - InitAudioDevice(); - - font = LoadFont("resources/font.fnt"); - music = LoadMusicStream("resources/audio/wave.ogg"); - - SetMusicVolume(music, 1.0f); - - // Setup and Init first screen - currentScreen = LOGO; - InitLogoScreen(); - //InitTitleScreen(); - //InitGameplayScreen(); - //InitEndingScreen(); - -#if defined(PLATFORM_WEB) - emscripten_set_main_loop(UpdateDrawFrame, 0, 1); -#else - SetTargetFPS(60); // Set our game to run at 60 frames-per-second - //-------------------------------------------------------------------------------------- - - // Main game loop - while (!WindowShouldClose()) // Detect window close button or ESC key - { - UpdateDrawFrame(); - } -#endif - - // De-Initialization - //-------------------------------------------------------------------------------------- - switch (currentScreen) - { - case LOGO: UnloadLogoScreen(); break; - case TITLE: UnloadTitleScreen(); break; - case GAMEPLAY: UnloadGameplayScreen(); break; - case ENDING: UnloadEndingScreen(); break; - default: break; - } - - // Unload all global loaded data (i.e. fonts) here! - UnloadFont(font); - UnloadMusicStream(music); - - CloseAudioDevice(); // Close audio context - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -} - -//---------------------------------------------------------------------------------- -// Module specific Functions Definition -//---------------------------------------------------------------------------------- - -// Change to next screen, no transition -static void ChangeToScreen(int screen) -{ - // Unload current screen - switch (currentScreen) - { - case LOGO: UnloadLogoScreen(); break; - case TITLE: UnloadTitleScreen(); break; - case GAMEPLAY: UnloadGameplayScreen(); break; - case ENDING: UnloadEndingScreen(); break; - default: break; - } - - // Init next screen - switch (screen) - { - case LOGO: InitLogoScreen(); break; - case TITLE: InitTitleScreen(); break; - case GAMEPLAY: InitGameplayScreen(); break; - case ENDING: InitEndingScreen(); break; - default: break; - } - - currentScreen = screen; -} - -// Define transition to next screen -static void TransitionToScreen(int screen) -{ - onTransition = true; - transFadeOut = false; - transFromScreen = currentScreen; - transToScreen = screen; - transAlpha = 0.0f; -} - -// Update transition effect -static void UpdateTransition(void) -{ - if (!transFadeOut) - { - transAlpha += 0.05f; - - // NOTE: Due to float internal representation, condition jumps on 1.0f instead of 1.05f - // For that reason we compare against 1.01f, to avoid last frame loading stop - if ((int)transAlpha >= 1) - { - transAlpha = 1.0f; - - // Unload current screen - switch (transFromScreen) - { - case LOGO: UnloadLogoScreen(); break; - case TITLE: UnloadTitleScreen(); break; - case GAMEPLAY: UnloadGameplayScreen(); break; - case ENDING: UnloadEndingScreen(); break; - default: break; - } - - // Load next screen - switch (transToScreen) - { - case LOGO: InitLogoScreen(); break; - case TITLE: InitTitleScreen(); break; - case GAMEPLAY: InitGameplayScreen(); break; - case ENDING: InitEndingScreen(); break; - default: break; - } - - currentScreen = transToScreen; - - // Activate fade out effect to next loaded screen - transFadeOut = true; - } - } - else // Transition fade out logic - { - transAlpha -= 0.05f; - - if ((int)transAlpha <= 0) - { - transAlpha = 0.0f; - transFadeOut = false; - onTransition = false; - transFromScreen = -1; - transToScreen = -1; - } - } -} - -// Draw transition effect (full-screen rectangle) -static void DrawTransition(void) -{ - DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, transAlpha)); -} - -// Update and draw game frame -static void UpdateDrawFrame(void) -{ - // Update - //---------------------------------------------------------------------------------- - if (!onTransition) - { - switch(currentScreen) - { - case LOGO: - { - UpdateLogoScreen(); - - if (FinishLogoScreen()) TransitionToScreen(TITLE); - - } break; - case TITLE: - { - UpdateTitleScreen(); - - if (FinishTitleScreen() == 1) TransitionToScreen(GAMEPLAY); - - } break; - case GAMEPLAY: - { - UpdateGameplayScreen(); - - if (FinishGameplayScreen() == 1) TransitionToScreen(ENDING); - //else if (FinishGameplayScreen() == 2) TransitionToScreen(TITLE); - - } break; - case ENDING: - { - UpdateEndingScreen(); - - if (FinishEndingScreen() == 1) TransitionToScreen(TITLE); - - } break; - default: break; - } - } - else UpdateTransition(); // Update transition (fade-in, fade-out) - - // TODO: Review! It breaks the game... issues with audio buffering... - if (currentScreen != ENDING) UpdateMusicStream(music); - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - switch(currentScreen) - { - case LOGO: DrawLogoScreen(); break; - case TITLE: DrawTitleScreen(); break; - case GAMEPLAY: DrawGameplayScreen(); break; - case ENDING: DrawEndingScreen(); break; - default: break; - } - - // Draw full screen rectangle in front of everything - if (onTransition) DrawTransition(); - - EndDrawing(); - //---------------------------------------------------------------------------------- -} -- cgit v1.2.3