| @ -0,0 +1,20 @@ | |||
| | |||
| This game sources are licensed under an unmodified zlib/libpng license, | |||
| which is an OSI-certified, BSD-like license: | |||
| Copyright (c) 2013-2019 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. | |||
| @ -0,0 +1,331 @@ | |||
| #************************************************************************************************** | |||
| # | |||
| # raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 | |||
| # | |||
| # Copyright (c) 2013-2018 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 | |||
| # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop() | |||
| PLATFORM ?= PLATFORM_DESKTOP | |||
| RAYLIB_PATH ?= C:/GitHub/raylib | |||
| PROJECT_NAME ?= roomba | |||
| # Default path for raylib on Raspberry Pi, if installed in different path, update it! | |||
| ifeq ($(PLATFORM),PLATFORM_RPI) | |||
| RAYLIB_PATH ?= /home/pi/raylib | |||
| endif | |||
| # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) | |||
| RAYLIB_LIBTYPE ?= STATIC | |||
| # Use external GLFW library instead of rglfw module | |||
| USE_EXTERNAL_GLFW ?= FALSE | |||
| # Use Wayland display server protocol on Linux desktop | |||
| # by default it uses X11 windowing system | |||
| USE_WAYLAND_DISPLAY ?= FALSE | |||
| # NOTE: On PLATFORM_WEB OpenAL Soft backend is used by default (check raylib/src/Makefile) | |||
| # 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 | |||
| ifeq ($(PLATFORM),PLATFORM_WEB) | |||
| # Emscripten required variables | |||
| EMSDK_PATH = C:/emsdk | |||
| EMSCRIPTEN_VERSION = 1.38.20 | |||
| CLANG_VERSION = e1.38.20_64bit | |||
| PYTHON_VERSION = 2.7.13.1_64bit\python-2.7.13.amd64 | |||
| NODE_VERSION = 8.9.1_64bit | |||
| export PATH = $(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) | |||
| EMSCRIPTEN = $(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) | |||
| endif | |||
| RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs | |||
| # Define raylib release directory for compiled library | |||
| ifeq ($(PLATFORM),PLATFORM_DESKTOP) | |||
| ifeq ($(PLATFORM_OS),WINDOWS) | |||
| RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32 | |||
| endif | |||
| ifeq ($(PLATFORM_OS),LINUX) | |||
| RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux | |||
| endif | |||
| ifeq ($(PLATFORM_OS),OSX) | |||
| RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx | |||
| endif | |||
| ifeq ($(PLATFORM_OS),BSD) | |||
| RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/bsd | |||
| endif | |||
| endif | |||
| ifeq ($(PLATFORM),PLATFORM_RPI) | |||
| RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi | |||
| endif | |||
| ifeq ($(PLATFORM),PLATFORM_WEB) | |||
| RAYLIB_RELEASE_PATH = . | |||
| endif | |||
| # 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 | |||
| 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 enable debugging | |||
| # -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 += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces | |||
| # Additional flags for compiler (if desired) | |||
| #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes | |||
| ifeq ($(PLATFORM),PLATFORM_DESKTOP) | |||
| ifeq ($(PLATFORM_OS),WINDOWS) | |||
| # resources file contains windows exe icon | |||
| # -Wl,--subsystem,windows hides the console window | |||
| CFLAGS += $(RAYLIB_PATH)/raylib.rc.data -Wl,--subsystem,windows | |||
| endif | |||
| ifeq ($(PLATFORM_OS),LINUX) | |||
| CFLAGS += -D_DEFAULT_SOURCE | |||
| endif | |||
| endif | |||
| ifeq ($(PLATFORM),PLATFORM_RPI) | |||
| CFLAGS += -std=gnu99 | |||
| endif | |||
| ifeq ($(PLATFORM),PLATFORM_WEB) | |||
| # -O2 # if used, also set --memory-init-file 0 | |||
| # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) | |||
| # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing | |||
| # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) | |||
| # -s USE_PTHREADS=1 # multithreading support | |||
| # -s WASM=1 # support Web Assembly (https://github.com/kripken/emscripten/wiki/WebAssembly) | |||
| # --preload-file resources # specify a resources folder for data compilation | |||
| # -s ASSERTIONS=1 --profiling | |||
| CFLAGS += -s USE_GLFW=3 -s WASM=1 -s TOTAL_MEMORY=16777216 --preload-file resources | |||
| # Define a custom shell .html and output extension | |||
| CFLAGS += --shell-file $(RAYLIB_PATH)\templates\web_shell\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)/release/include -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external | |||
| # Define additional directories containing required header files | |||
| ifeq ($(PLATFORM),PLATFORM_RPI) | |||
| # RPI requried 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 | |||
| # Define library paths containing required libs | |||
| LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src | |||
| ifeq ($(PLATFORM),PLATFORM_DESKTOP) | |||
| ifeq ($(PLATFORM_OS),BSD) | |||
| INCLUDE_PATHS += -I/usr/local/include | |||
| LDFLAGS += -L. -Lsrc -L/usr/local/lib | |||
| 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 | |||
| LDLIBS = -lraylib -lopengl32 -lgdi32 | |||
| # 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 | |||
| 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 OpenAL -framework Cocoa | |||
| 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 ?= roomba.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' | rev | cut -d ':' -f 2- | rev | xargs rm -f | |||
| 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 -f *.o | |||
| endif | |||
| ifeq ($(PLATFORM),PLATFORM_WEB) | |||
| del *.o *.html *.js | |||
| endif | |||
| @echo Cleaning done | |||
| @ -0,0 +1,298 @@ | |||
| #************************************************************************************************** | |||
| # | |||
| # 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 | |||
| RAYLIB_LIB_PATH = $(RAYLIB_PATH)\release\libs\android\$(ANDROID_ARCH_NAME) | |||
| # 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)/release/include -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 ^<?xml version="1.0" encoding="utf-8"^?^> > $(PROJECT_BUILD_PATH)/res/values/strings.xml | |||
| @echo ^<resources^>^<string name="app_name"^>$(APP_LABEL_NAME)^</string^>^</resources^> >> $(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 ^<?xml version="1.0" encoding="utf-8"^?^> > $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^<manifest xmlns:android="http://schemas.android.com/apk/res/android" >> $(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 ^<uses-sdk android:minSdkVersion="$(ANDROID_API_VERSION)" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^<uses-feature android:glEsVersion="0x00020000" android:required="true" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^<application android:allowBackup="false" android:label="@string/app_name" android:icon="@drawable/icon" ^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^<activity android:name="com.$(APP_COMPANY_NAME).$(APP_PRODUCT_NAME).NativeLoader" >> $(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 ^<meta-data android:name="android.app.lib_name" android:value="$(PROJECT_LIBRARY_NAME)" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^<intent-filter^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^<action android:name="android.intent.action.MAIN" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^<category android:name="android.intent.category.LAUNCHER" /^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^</intent-filter^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^</activity^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^</application^> >> $(PROJECT_BUILD_PATH)/AndroidManifest.xml | |||
| @echo ^</manifest^> >> $(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 | |||
| @ -0,0 +1,16 @@ | |||
| 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,1,1,1,1,1,1,1,1, | |||
| 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 0,0,1,1,1,1,2,2,2,1,1,1,0,0,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 0,0,1,1,1,1,2,2,2,1,1,1,0,0,1,1,1,2,2,2,1,1,1,1,0,0,1,1,1,1,0,0, | |||
| 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,0,0,1,1,1,1,0,0, | |||
| 0,0,1,1,2,2,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0, | |||
| 1,1,1,1,2,2,2,2,2,2,2,2,0,0,1,1,1,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0, | |||
| 1,1,1,1,2,2,2,2,2,2,2,2,0,0,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,2,2,2,2,2,2,1,1, | |||
| 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,2,2,2,2,2,2,1,1, | |||
| 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1, | |||
| 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1, | |||
| 0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,0,0 | |||
| @ -0,0 +1,34 @@ | |||
| .furniture | |||
| .state: 0-Block, 1-Alpha, 2-Breakable | |||
| .f setId cellX cellY state counter | |||
| .puff and sits | |||
| f 3 0 4 0 0 | |||
| f 3 13 0 0 0 | |||
| f 3 22 0 0 0 | |||
| f 3 21 11 0 0 | |||
| f 2 19 15 0 0 | |||
| f 2 30 5 0 0 | |||
| f 4 12 4 0 0 | |||
| .wood pieces | |||
| f 26 3 0 0 0 | |||
| f 27 4 10 0 0 | |||
| f 27 24 7 0 0 | |||
| f 17 30 15 0 0 | |||
| .kitchen | |||
| f 11 0 15 0 0 | |||
| f 13 0 12 0 0 | |||
| .sofa and bed (alpha) | |||
| f 14 4 7 1 0 | |||
| f 10 24 11 1 0 | |||
| .glass and tables (alpha) | |||
| f 9 17 4 1 0 | |||
| f 16 6 4 1 0 | |||
| f 16 10 15 1 0 | |||
| f 15 22 15 1 0 | |||
| .plants (breakable) | |||
| f 6 0 6 2 1800 | |||
| f 6 12 10 2 1800 | |||
| f 7 17 0 2 1200 | |||
| f 7 15 15 2 1200 | |||
| f 8 13 15 2 2000 | |||
| f 8 24 5 2 2000 | |||
| @ -0,0 +1,37 @@ | |||
| .tileset | |||
| .first line | |||
| f 0 0 0 2 2 | |||
| f 1 2 0 2 2 | |||
| f 2 4 0 2 2 | |||
| f 3 6 0 2 2 | |||
| f 4 8 0 2 2 | |||
| f 5 10 0 2 2 | |||
| f 6 12 0 2 2 | |||
| f 7 14 0 2 2 | |||
| f 8 16 0 2 2 | |||
| f 9 18 0 5 6 | |||
| f 10 23 0 6 6 | |||
| .second line | |||
| f 11 0 2 10 2 | |||
| f 12 10 2 7 3 | |||
| .third line | |||
| f 13 0 4 2 3 | |||
| f 14 2 4 8 3 | |||
| f 15 10 5 2 2 | |||
| f 16 12 5 3 2 | |||
| f 17 15 5 2 2 | |||
| .cups | |||
| f 18 17 6 1 1 | |||
| f 19 18 6 1 1 | |||
| f 20 19 6 1 1 | |||
| f 21 20 6 1 1 | |||
| f 22 21 6 1 1 | |||
| f 23 22 6 1 1 | |||
| f 24 23 6 1 1 | |||
| f 25 24 6 1 1 | |||
| .four line | |||
| f 26 0 7 10 2 | |||
| f 27 10 7 8 2 | |||
| f 28 18 7 3 2 | |||
| f 29 21 7 3 2 | |||
| f 30 24 7 2 2 | |||
| @ -0,0 +1,139 @@ | |||
| info face="Starcatcher" size=-64 bold=0 italic=0 charset="ANSI" unicode=0 stretchH=100 smooth=1 aa=1 padding=4,4,4,4 spacing=1,1 outline=0 | |||
| common lineHeight=63 base=50 scaleW=512 scaleH=512 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 | |||
| page id=0 file="star.png" | |||
| chars count=135 | |||
| char id=32 x=416 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=33 x=347 y=360 width=17 height=71 xoffset=-4 yoffset=-4 xadvance=9 page=0 chnl=15 | |||
| char id=35 x=183 y=0 width=48 height=71 xoffset=-4 yoffset=-4 xadvance=40 page=0 chnl=15 | |||
| char id=36 x=328 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=37 x=67 y=0 width=62 height=71 xoffset=-4 yoffset=-4 xadvance=55 page=0 chnl=15 | |||
| char id=38 x=488 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=39 x=266 y=360 width=21 height=71 xoffset=-4 yoffset=-4 xadvance=13 page=0 chnl=15 | |||
| char id=40 x=471 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=41 x=387 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=42 x=415 y=0 width=42 height=71 xoffset=-4 yoffset=-4 xadvance=34 page=0 chnl=15 | |||
| char id=43 x=403 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=44 x=309 y=360 width=18 height=71 xoffset=-4 yoffset=-4 xadvance=10 page=0 chnl=15 | |||
| char id=45 x=82 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=46 x=365 y=360 width=16 height=71 xoffset=-4 yoffset=-4 xadvance=7 page=0 chnl=15 | |||
| char id=47 x=155 y=288 width=29 height=71 xoffset=-4 yoffset=-4 xadvance=21 page=0 chnl=15 | |||
| char id=48 x=38 y=144 width=36 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=49 x=188 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=50 x=339 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=51 x=0 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=52 x=35 y=216 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=53 x=105 y=216 width=33 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=54 x=207 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=55 x=433 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=56 x=468 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=57 x=0 y=216 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=58 x=399 y=360 width=16 height=71 xoffset=-4 yoffset=-4 xadvance=7 page=0 chnl=15 | |||
| char id=59 x=328 y=360 width=18 height=71 xoffset=-4 yoffset=-4 xadvance=10 page=0 chnl=15 | |||
| char id=60 x=185 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=61 x=371 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=62 x=221 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=63 x=398 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=25 page=0 chnl=15 | |||
| char id=64 x=130 y=0 width=52 height=71 xoffset=-4 yoffset=-4 xadvance=44 page=0 chnl=15 | |||
| char id=65 x=445 y=72 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=66 x=209 y=72 width=40 height=71 xoffset=-4 yoffset=-4 xadvance=32 page=0 chnl=15 | |||
| char id=67 x=173 y=216 width=33 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=68 x=250 y=72 width=39 height=71 xoffset=-4 yoffset=-4 xadvance=31 page=0 chnl=15 | |||
| char id=69 x=306 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=70 x=149 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=71 x=112 y=144 width=36 height=71 xoffset=-4 yoffset=-4 xadvance=28 page=0 chnl=15 | |||
| char id=72 x=458 y=0 width=42 height=71 xoffset=-4 yoffset=-4 xadvance=34 page=0 chnl=15 | |||
| char id=73 x=288 y=360 width=20 height=71 xoffset=-4 yoffset=-4 xadvance=12 page=0 chnl=15 | |||
| char id=74 x=257 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=75 x=0 y=144 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=76 x=139 y=216 width=33 height=71 xoffset=-4 yoffset=-4 xadvance=25 page=0 chnl=15 | |||
| char id=77 x=85 y=72 width=41 height=71 xoffset=-4 yoffset=-4 xadvance=33 page=0 chnl=15 | |||
| char id=78 x=371 y=0 width=43 height=71 xoffset=-4 yoffset=-4 xadvance=35 page=0 chnl=15 | |||
| char id=79 x=168 y=72 width=40 height=71 xoffset=-4 yoffset=-4 xadvance=31 page=0 chnl=15 | |||
| char id=80 x=75 y=144 width=36 height=71 xoffset=-4 yoffset=-4 xadvance=28 page=0 chnl=15 | |||
| char id=81 x=280 y=0 width=45 height=71 xoffset=-4 yoffset=-4 xadvance=37 page=0 chnl=15 | |||
| char id=82 x=369 y=72 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=83 x=70 y=216 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=84 x=43 y=72 width=41 height=71 xoffset=-4 yoffset=-4 xadvance=33 page=0 chnl=15 | |||
| char id=85 x=0 y=72 width=42 height=71 xoffset=-4 yoffset=-4 xadvance=34 page=0 chnl=15 | |||
| char id=86 x=326 y=0 width=44 height=71 xoffset=-4 yoffset=-4 xadvance=36 page=0 chnl=15 | |||
| char id=87 x=232 y=0 width=47 height=71 xoffset=-4 yoffset=-4 xadvance=39 page=0 chnl=15 | |||
| char id=88 x=127 y=72 width=40 height=71 xoffset=-4 yoffset=-4 xadvance=33 page=0 chnl=15 | |||
| char id=89 x=290 y=72 width=39 height=71 xoffset=-4 yoffset=-4 xadvance=31 page=0 chnl=15 | |||
| char id=90 x=330 y=72 width=38 height=71 xoffset=-4 yoffset=-4 xadvance=30 page=0 chnl=15 | |||
| char id=91 x=499 y=288 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=92 x=109 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=93 x=499 y=216 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=97 x=302 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=98 x=415 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=99 x=136 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=100 x=124 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=101 x=162 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=102 x=443 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=103 x=0 y=360 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=104 x=240 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=105 x=382 y=360 width=16 height=71 xoffset=-4 yoffset=-4 xadvance=8 page=0 chnl=15 | |||
| char id=106 x=359 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=107 x=483 y=72 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=108 x=55 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=109 x=435 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=110 x=273 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=111 x=31 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=112 x=331 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=113 x=363 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=114 x=273 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=115 x=28 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=116 x=62 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=117 x=93 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=118 x=467 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=119 x=293 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=120 x=185 y=288 width=29 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=121 x=215 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=122 x=244 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=123 x=428 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=124 x=440 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=125 x=452 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=126 x=0 y=0 width=66 height=71 xoffset=-4 yoffset=-4 xadvance=58 page=0 chnl=15 | |||
| char id=162 x=464 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=163 x=407 y=72 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=167 x=476 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=171 x=214 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=187 x=240 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=191 x=500 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=192 x=0 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=193 x=12 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=194 x=24 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=196 x=36 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=199 x=48 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=200 x=60 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=201 x=72 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=202 x=84 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=203 x=96 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=206 x=108 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=207 x=120 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=209 x=132 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=211 x=144 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=212 x=156 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=214 x=168 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=217 x=180 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=218 x=192 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=219 x=204 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=220 x=216 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=223 x=228 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=224 x=240 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=225 x=252 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=226 x=264 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=228 x=276 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=231 x=288 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=232 x=300 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=233 x=312 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=234 x=324 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=235 x=336 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=238 x=348 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=239 x=360 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=243 x=372 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=244 x=384 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=246 x=396 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=249 x=408 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=250 x=420 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=251 x=432 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=252 x=444 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| @ -0,0 +1,139 @@ | |||
| info face="Starcatcher" size=-64 bold=0 italic=0 charset="ANSI" unicode=0 stretchH=100 smooth=1 aa=1 padding=4,4,4,4 spacing=1,1 outline=0 | |||
| common lineHeight=63 base=50 scaleW=512 scaleH=512 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 | |||
| page id=0 file="star2.png" | |||
| chars count=135 | |||
| char id=32 x=416 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=33 x=347 y=360 width=17 height=71 xoffset=-4 yoffset=-4 xadvance=9 page=0 chnl=15 | |||
| char id=35 x=183 y=0 width=48 height=71 xoffset=-4 yoffset=-4 xadvance=40 page=0 chnl=15 | |||
| char id=36 x=328 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=37 x=67 y=0 width=62 height=71 xoffset=-4 yoffset=-4 xadvance=55 page=0 chnl=15 | |||
| char id=38 x=488 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=39 x=266 y=360 width=21 height=71 xoffset=-4 yoffset=-4 xadvance=13 page=0 chnl=15 | |||
| char id=40 x=471 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=41 x=387 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=42 x=415 y=0 width=42 height=71 xoffset=-4 yoffset=-4 xadvance=34 page=0 chnl=15 | |||
| char id=43 x=403 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=44 x=309 y=360 width=18 height=71 xoffset=-4 yoffset=-4 xadvance=10 page=0 chnl=15 | |||
| char id=45 x=82 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=46 x=365 y=360 width=16 height=71 xoffset=-4 yoffset=-4 xadvance=7 page=0 chnl=15 | |||
| char id=47 x=155 y=288 width=29 height=71 xoffset=-4 yoffset=-4 xadvance=21 page=0 chnl=15 | |||
| char id=48 x=38 y=144 width=36 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=49 x=188 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=50 x=339 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=51 x=0 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=52 x=35 y=216 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=53 x=105 y=216 width=33 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=54 x=207 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=55 x=433 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=56 x=468 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=57 x=0 y=216 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=58 x=399 y=360 width=16 height=71 xoffset=-4 yoffset=-4 xadvance=7 page=0 chnl=15 | |||
| char id=59 x=328 y=360 width=18 height=71 xoffset=-4 yoffset=-4 xadvance=10 page=0 chnl=15 | |||
| char id=60 x=185 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=61 x=371 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=62 x=221 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=63 x=398 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=25 page=0 chnl=15 | |||
| char id=64 x=130 y=0 width=52 height=71 xoffset=-4 yoffset=-4 xadvance=44 page=0 chnl=15 | |||
| char id=65 x=445 y=72 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=66 x=209 y=72 width=40 height=71 xoffset=-4 yoffset=-4 xadvance=32 page=0 chnl=15 | |||
| char id=67 x=173 y=216 width=33 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=68 x=250 y=72 width=39 height=71 xoffset=-4 yoffset=-4 xadvance=31 page=0 chnl=15 | |||
| char id=69 x=306 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=70 x=149 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=71 x=112 y=144 width=36 height=71 xoffset=-4 yoffset=-4 xadvance=28 page=0 chnl=15 | |||
| char id=72 x=458 y=0 width=42 height=71 xoffset=-4 yoffset=-4 xadvance=34 page=0 chnl=15 | |||
| char id=73 x=288 y=360 width=20 height=71 xoffset=-4 yoffset=-4 xadvance=12 page=0 chnl=15 | |||
| char id=74 x=257 y=144 width=35 height=71 xoffset=-4 yoffset=-4 xadvance=27 page=0 chnl=15 | |||
| char id=75 x=0 y=144 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=76 x=139 y=216 width=33 height=71 xoffset=-4 yoffset=-4 xadvance=25 page=0 chnl=15 | |||
| char id=77 x=85 y=72 width=41 height=71 xoffset=-4 yoffset=-4 xadvance=33 page=0 chnl=15 | |||
| char id=78 x=371 y=0 width=43 height=71 xoffset=-4 yoffset=-4 xadvance=35 page=0 chnl=15 | |||
| char id=79 x=168 y=72 width=40 height=71 xoffset=-4 yoffset=-4 xadvance=31 page=0 chnl=15 | |||
| char id=80 x=75 y=144 width=36 height=71 xoffset=-4 yoffset=-4 xadvance=28 page=0 chnl=15 | |||
| char id=81 x=280 y=0 width=45 height=71 xoffset=-4 yoffset=-4 xadvance=37 page=0 chnl=15 | |||
| char id=82 x=369 y=72 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=83 x=70 y=216 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=84 x=43 y=72 width=41 height=71 xoffset=-4 yoffset=-4 xadvance=33 page=0 chnl=15 | |||
| char id=85 x=0 y=72 width=42 height=71 xoffset=-4 yoffset=-4 xadvance=34 page=0 chnl=15 | |||
| char id=86 x=326 y=0 width=44 height=71 xoffset=-4 yoffset=-4 xadvance=36 page=0 chnl=15 | |||
| char id=87 x=232 y=0 width=47 height=71 xoffset=-4 yoffset=-4 xadvance=39 page=0 chnl=15 | |||
| char id=88 x=127 y=72 width=40 height=71 xoffset=-4 yoffset=-4 xadvance=33 page=0 chnl=15 | |||
| char id=89 x=290 y=72 width=39 height=71 xoffset=-4 yoffset=-4 xadvance=31 page=0 chnl=15 | |||
| char id=90 x=330 y=72 width=38 height=71 xoffset=-4 yoffset=-4 xadvance=30 page=0 chnl=15 | |||
| char id=91 x=499 y=288 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=92 x=109 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=93 x=499 y=216 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=97 x=302 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=98 x=415 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=99 x=136 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=100 x=124 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=101 x=162 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=102 x=443 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=103 x=0 y=360 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=104 x=240 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=105 x=382 y=360 width=16 height=71 xoffset=-4 yoffset=-4 xadvance=8 page=0 chnl=15 | |||
| char id=106 x=359 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=107 x=483 y=72 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=108 x=55 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=109 x=435 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=110 x=273 y=216 width=32 height=71 xoffset=-4 yoffset=-4 xadvance=24 page=0 chnl=15 | |||
| char id=111 x=31 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=112 x=331 y=288 width=27 height=71 xoffset=-4 yoffset=-4 xadvance=19 page=0 chnl=15 | |||
| char id=113 x=363 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=114 x=273 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=115 x=28 y=360 width=26 height=71 xoffset=-4 yoffset=-4 xadvance=18 page=0 chnl=15 | |||
| char id=116 x=62 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=117 x=93 y=288 width=30 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=118 x=467 y=216 width=31 height=71 xoffset=-4 yoffset=-4 xadvance=23 page=0 chnl=15 | |||
| char id=119 x=293 y=144 width=34 height=71 xoffset=-4 yoffset=-4 xadvance=26 page=0 chnl=15 | |||
| char id=120 x=185 y=288 width=29 height=71 xoffset=-4 yoffset=-4 xadvance=22 page=0 chnl=15 | |||
| char id=121 x=215 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=122 x=244 y=288 width=28 height=71 xoffset=-4 yoffset=-4 xadvance=20 page=0 chnl=15 | |||
| char id=123 x=428 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=124 x=440 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=125 x=452 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=126 x=0 y=0 width=66 height=71 xoffset=-4 yoffset=-4 xadvance=58 page=0 chnl=15 | |||
| char id=162 x=464 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=163 x=407 y=72 width=37 height=71 xoffset=-4 yoffset=-4 xadvance=29 page=0 chnl=15 | |||
| char id=167 x=476 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=171 x=214 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=187 x=240 y=360 width=25 height=71 xoffset=-4 yoffset=-4 xadvance=17 page=0 chnl=15 | |||
| char id=191 x=500 y=360 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=192 x=0 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=193 x=12 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=194 x=24 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=196 x=36 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=199 x=48 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=200 x=60 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=201 x=72 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=202 x=84 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=203 x=96 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=206 x=108 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=207 x=120 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=209 x=132 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=211 x=144 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=212 x=156 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=214 x=168 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=217 x=180 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=218 x=192 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=219 x=204 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=220 x=216 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=223 x=228 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=224 x=240 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=225 x=252 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=226 x=264 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=228 x=276 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=231 x=288 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=232 x=300 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=233 x=312 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=234 x=324 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=235 x=336 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=238 x=348 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=239 x=360 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=243 x=372 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=244 x=384 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=246 x=396 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=249 x=408 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=250 x=420 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=251 x=432 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| char id=252 x=444 y=432 width=11 height=71 xoffset=-5 yoffset=-4 xadvance=1 page=0 chnl=15 | |||
| @ -0,0 +1,286 @@ | |||
| /******************************************************************************************* | |||
| * | |||
| * raylib - Advance Game template | |||
| * | |||
| * <Game title> | |||
| * <Game description> | |||
| * | |||
| * This game has been created using raylib (www.raylib.com) | |||
| * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) | |||
| * | |||
| * Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) | |||
| * | |||
| ********************************************************************************************/ | |||
| #include "raylib.h" | |||
| #include "screens/screens.h" // NOTE: Defines global variable: currentScreen | |||
| #if defined(PLATFORM_WEB) | |||
| #include <emscripten/emscripten.h> | |||
| #endif | |||
| //---------------------------------------------------------------------------------- | |||
| // Global Variables Definition (local to this module) | |||
| //---------------------------------------------------------------------------------- | |||
| const int screenWidth = 1280; | |||
| #if defined(TILE_VIEWER_MODE) | |||
| const int screenHeight = 1080; | |||
| #else | |||
| const int screenHeight = 720; | |||
| #endif | |||
| // 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(void) | |||
| { | |||
| // Initialization (Note windowTitle is unused on Android) | |||
| //--------------------------------------------------------- | |||
| InitWindow(screenWidth, screenHeight, "raylib template - advance game"); | |||
| // Global data loading (assets that must be available in all screens, i.e. fonts) | |||
| InitAudioDevice(); | |||
| font = LoadFont("resources/star.fnt"); | |||
| font2 = LoadFont("resources/star2.fnt"); | |||
| music = LoadMusicStream("resources/cat_mouse.mod"); | |||
| fxCoin = LoadSound("resources/coin.wav"); | |||
| SetMusicVolume(music, 1.0f); | |||
| PlayMusicStream(music); | |||
| // Setup and Init first screen | |||
| currentScreen = LOGO; | |||
| InitLogoScreen(); | |||
| #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 | |||
| //-------------------------------------------------------------------------------------- | |||
| // Unload current screen data before closing | |||
| 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); | |||
| UnloadFont(font2); | |||
| UnloadMusicStream(music); | |||
| UnloadSound(fxCoin); | |||
| 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.02f; | |||
| // 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 (transAlpha > 1.01f) | |||
| { | |||
| 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.02f; | |||
| if (transAlpha < -0.01f) | |||
| { | |||
| 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(BLACK, transAlpha)); | |||
| } | |||
| // Update and draw game frame | |||
| static void UpdateDrawFrame(void) | |||
| { | |||
| // Update | |||
| //---------------------------------------------------------------------------------- | |||
| UpdateMusicStream(music); // NOTE: Music keeps playing between screens | |||
| if (!onTransition) | |||
| { | |||
| switch(currentScreen) | |||
| { | |||
| case LOGO: | |||
| { | |||
| UpdateLogoScreen(); | |||
| if (FinishLogoScreen()) TransitionToScreen(TITLE); | |||
| } break; | |||
| case TITLE: | |||
| { | |||
| UpdateTitleScreen(); | |||
| if (FinishTitleScreen() == 1) TransitionToScreen(OPTIONS); | |||
| else if (FinishTitleScreen() == 2) 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) | |||
| //---------------------------------------------------------------------------------- | |||
| // 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(); | |||
| //DrawFPS(10, 10); | |||
| EndDrawing(); | |||
| //---------------------------------------------------------------------------------- | |||
| } | |||
| @ -0,0 +1,96 @@ | |||
| /********************************************************************************************** | |||
| * | |||
| * raylib - Advance Game template | |||
| * | |||
| * Ending Screen Functions Definitions (Init, Update, Draw, Unload) | |||
| * | |||
| * Copyright (c) 2014-2018 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 int scrollPositionX; | |||
| //---------------------------------------------------------------------------------- | |||
| // Ending Screen Functions Definition | |||
| //---------------------------------------------------------------------------------- | |||
| // Ending Screen Initialization logic | |||
| void InitEndingScreen(void) | |||
| { | |||
| // TODO: Initialize ENDING screen variables here! | |||
| framesCounter = 0; | |||
| finishScreen = 0; | |||
| PlayMusicStream(music); | |||
| } | |||
| // Ending Screen Update logic | |||
| void UpdateEndingScreen(void) | |||
| { | |||
| framesCounter++; | |||
| scrollPositionX -= 5; | |||
| if (scrollPositionX < -GetScreenWidth()) scrollPositionX = 0; | |||
| // Press enter or tap to return to TITLE screen | |||
| if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP)) | |||
| { | |||
| finishScreen = 1; | |||
| PlaySound(fxCoin); | |||
| } | |||
| } | |||
| // Ending Screen Draw logic | |||
| void DrawEndingScreen(void) | |||
| { | |||
| for (int i = 0; i < 64*2*2; i++) | |||
| { | |||
| DrawRectangle(64*i + scrollPositionX, 0, 64, GetScreenHeight(), (i%2 == 0)? GetColor(0xf3726dff) : GetColor(0xffcf6bff)); | |||
| } | |||
| if (result == 0) DrawTextEx(font2, "YOU LOOSE...", (Vector2){ 350, 200 }, font2.baseSize*2, 2, WHITE); | |||
| else if (result == 1) DrawTextEx(font, "YOU WIN!!!", (Vector2){ 380, 200 }, font.baseSize*2, 2, WHITE); | |||
| // Draw score | |||
| DrawTextEx(font, FormatText("FINAL SCORE: %i", score), (Vector2){ 400, 360 }, font2.baseSize, 2, WHITE); | |||
| if ((framesCounter/30)%2) DrawTextEx(font2, "PRESS ENTER to TITLE", (Vector2){ 340, 550 }, font2.baseSize, 2, WHITE); | |||
| } | |||
| // Ending Screen Unload logic | |||
| void UnloadEndingScreen(void) | |||
| { | |||
| // TODO: Unload ENDING screen variables here! | |||
| } | |||
| // Ending Screen should finish? | |||
| int FinishEndingScreen(void) | |||
| { | |||
| return finishScreen; | |||
| } | |||
| @ -0,0 +1,652 @@ | |||
| /********************************************************************************************** | |||
| * | |||
| * raylib - Advance Game template | |||
| * | |||
| * Gameplay Screen Functions Definitions (Init, Update, Draw, Unload) | |||
| * | |||
| * Copyright (c) 2014-2018 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 "raymath.h" | |||
| #include <stdio.h> | |||
| #define TILE_REQUIRED_CLEAN_TIME 2 // Frames it takes to clean a dirt level | |||
| #define TILE_SCORE_BY_CLEANED_LEVEL 100 // Score by cleanied dirt level | |||
| #define TILE_REQUIRED_CLEAN_AREA 28*28 // Required are for actually cleaning tile | |||
| #define TILE_SIZE 36 // Tile size, it should match texture | |||
| #define MAX_TILES_X 32 | |||
| #define MAX_TILES_Y 17 | |||
| #define CAT_TARGET_RADIUS 3 // Target proximity radius | |||
| #define CAT_DIRT_CELL_RADIUS 2 // Cells around cat for dirt spreading | |||
| #define TIME_LIMIT_SECONDS 180 // Time to complete the level in seconds | |||
| #define MAX_SCORE_POPUPS 60 // Maximum simultaneous score pop-ups! | |||
| //---------------------------------------------------------------------------------- | |||
| // Module types | |||
| //---------------------------------------------------------------------------------- | |||
| // One dirt tile type | |||
| typedef struct { | |||
| Vector2 position; // Relative to top-left corner | |||
| int level; // Dirtiness: 0-Clean, 1-2-3-Dirt levels | |||
| int state; // Current dirtiness state | |||
| int counter; // Frames counter for cleaning | |||
| //int time; // Time it takes to make it clean --> Depends on level | |||
| //int score; // It depends on the dirt level | |||
| bool cleaned; // If it was cleaned (not clean by default) | |||
| } Dirtile; | |||
| // Score poping-up type | |||
| typedef struct { | |||
| Vector2 position; | |||
| int value; | |||
| float alpha; | |||
| bool enabled; | |||
| } ScorePopup; | |||
| // Furniture tile set | |||
| typedef struct { | |||
| int id; // Furniture tile id | |||
| int posX; // Position X on tileset | |||
| int posY; // Position Y on tileset | |||
| int width; // Furniture piece width | |||
| int height; // Furniture piece height | |||
| } FurSet; | |||
| // Furniture type | |||
| typedef struct { | |||
| int furId; // Tileset id | |||
| int cellX; // Cell position X | |||
| int cellY; // Cell position Y | |||
| int state; // 0-Block, 1-Alpha, 2-Breakable | |||
| int counter; // Counter in case of break | |||
| } Furniture; | |||
| //---------------------------------------------------------------------------------- | |||
| // Global Variables Definition (local to this module) | |||
| //---------------------------------------------------------------------------------- | |||
| // Gameplay screen global variables | |||
| static int framesCounter; | |||
| static int timeLevelSeconds; | |||
| static bool levelFinished; | |||
| static int finishScreen; | |||
| const Vector2 roomOffset = { 70, 70 }; | |||
| static Texture2D roomba; | |||
| static Texture2D cat; | |||
| static Texture2D dirtiles; | |||
| static Texture2D furniture; | |||
| #if defined(TILE_VIEWER_MODE) | |||
| static Texture2D tracemap; | |||
| static Texture2D fursetid; | |||
| #endif | |||
| static Music catch; | |||
| static Sound fxCat[2]; | |||
| static Sound fxRoomba[3]; | |||
| static Vector2 roombaPosition = { 100, 100 }; | |||
| static Vector2 roombaSpeed = { 4, 4 }; | |||
| static int roombaTilePosX = 0, roombaTilePosY = 0; | |||
| static Vector2 catPosition = { 0, 0 }; | |||
| static Vector2 catTargetPosition = { 0, 0 }; | |||
| static Vector2 catSpeed = { 3, 3 }; | |||
| static int catTilePosX = 0, catTilePosY = 0; | |||
| static bool catShouldMove = false; | |||
| static Vector2 mousePosition = { 0, 0 }; | |||
| static int mouseTileX = -1, mouseTileY = -1; | |||
| static Dirtile tiles[MAX_TILES_X*MAX_TILES_Y] = { 0 }; | |||
| static ScorePopup popup[MAX_SCORE_POPUPS] = { 0 }; | |||
| static FurSet furset[32] = { -1 }; | |||
| static Furniture furmap[40] = { -1 }; | |||
| static int furnitureCount = 0; | |||
| // Furniture collisions map | |||
| // 0-block, 1-normal, 2-alpha, 3-breakable | |||
| static int furcolmap[MAX_TILES_X*MAX_TILES_Y] = { | |||
| 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,3,3,1,1,1,0,0,1,1,1,1,1,1,1,1, | |||
| 1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,3,3,1,1,1,0,0,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 0,0,1,1,1,1,2,2,2,1,1,1,0,0,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 0,0,1,1,1,1,2,2,2,1,1,1,0,0,1,1,1,2,2,2,1,1,1,1,3,3,1,1,1,1,0,0, | |||
| 3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,3,3,1,1,1,1,0,0, | |||
| 3,3,1,1,2,2,2,2,2,2,2,2,1,1,1,1,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0, | |||
| 1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0, | |||
| 1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,0,0,0,0,0,0,0,0,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |||
| 1,1,1,1,0,0,0,0,0,0,0,0,3,3,1,1,1,1,1,1,1,0,0,1,2,2,2,2,2,2,1,1, | |||
| 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,2,2,2,2,2,2,1,1, | |||
| 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1, | |||
| 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,1,1, | |||
| 0,0,0,0,0,0,0,0,0,0,2,2,2,3,3,3,3,1,1,0,0,1,2,2,2,2,2,2,2,2,0,0, | |||
| 0,0,0,0,0,0,0,0,0,0,2,2,2,3,3,3,3,1,1,0,0,1,2,2,2,2,2,2,2,2,0,0 }; | |||
| static bool showObjective = false; | |||
| //---------------------------------------------------------------------------------- | |||
| // Module Functions Definition | |||
| //---------------------------------------------------------------------------------- | |||
| static float GetTileCleanPercent(void); | |||
| //---------------------------------------------------------------------------------- | |||
| // Gameplay Screen Functions Definition | |||
| //---------------------------------------------------------------------------------- | |||
| // Gameplay Screen Initialization logic | |||
| void InitGameplayScreen(void) | |||
| { | |||
| // Initialize GAMEPLAY screen variables here! | |||
| framesCounter = 0; | |||
| finishScreen = 0; | |||
| timeLevelSeconds = TIME_LIMIT_SECONDS; | |||
| levelFinished = false; | |||
| roomba = LoadTexture("resources/roomba.png"); | |||
| cat = LoadTexture("resources/cat.png"); | |||
| dirtiles = LoadTexture("resources/dirtiles.png"); | |||
| furniture = LoadTexture("resources/furniture.png"); | |||
| #if defined(TILE_VIEWER_MODE) | |||
| tracemap = LoadTexture("resources/tracemap.png"); | |||
| fursetid = LoadTexture("resources/fursetid.png"); | |||
| #endif | |||
| int furCount = 0; | |||
| FILE *fursetFile = fopen("resources/furset.txt", "rt"); | |||
| if (fursetFile != NULL) | |||
| { | |||
| char buffer[512] = { 0 }; | |||
| while (!feof(fursetFile)) | |||
| { | |||
| fgets(buffer, 512, fursetFile); | |||
| switch (buffer[0]) | |||
| { | |||
| case 'f': | |||
| { | |||
| sscanf(buffer, "f %i %i %i %i %i", | |||
| &furset[furCount].id, | |||
| &furset[furCount].posX, | |||
| &furset[furCount].posY, | |||
| &furset[furCount].width, | |||
| &furset[furCount].height); | |||
| furCount++; | |||
| } break; | |||
| case '.': // This is a comment | |||
| default: break; | |||
| } | |||
| } | |||
| fclose(fursetFile); | |||
| } | |||
| // Position and size come in cell form, not pixels | |||
| for (int i = 0; i < furCount; i++) | |||
| { | |||
| furset[i].posX *= TILE_SIZE; | |||
| furset[i].posY *= TILE_SIZE; | |||
| furset[i].width *= TILE_SIZE; | |||
| furset[i].height *= TILE_SIZE; | |||
| } | |||
| printf("Furniture SET elements read: %i\n", furCount); | |||
| // Init furniture elements | |||
| FILE *furnitureFile = fopen("resources/furmap.txt", "rt"); | |||
| if (furnitureFile != NULL) | |||
| { | |||
| char buffer[512] = { 0 }; | |||
| while (!feof(furnitureFile)) | |||
| { | |||
| fgets(buffer, 512, furnitureFile); | |||
| switch (buffer[0]) | |||
| { | |||
| case 'f': | |||
| { | |||
| sscanf(buffer, "f %i %i %i %i %i", | |||
| &furmap[furnitureCount].furId, | |||
| &furmap[furnitureCount].cellX, | |||
| &furmap[furnitureCount].cellY, | |||
| &furmap[furnitureCount].state, | |||
| &furmap[furnitureCount].counter); | |||
| furnitureCount++; | |||
| } break; | |||
| case '.': // This is a comment | |||
| default: break; | |||
| } | |||
| } | |||
| fclose(furnitureFile); | |||
| } | |||
| printf("Furniture MAP elements read: %i\n", furnitureCount); | |||
| // Init dirt tiles | |||
| for (int y = 0; y < MAX_TILES_Y; y++) | |||
| { | |||
| for (int x = 0; x < MAX_TILES_X; x++) | |||
| { | |||
| tiles[y*MAX_TILES_X + x].position = (Vector2){ roomOffset.x + TILE_SIZE*x, roomOffset.y + TILE_SIZE*y }; | |||
| if ((furcolmap[y*MAX_TILES_X + x] != 0) && | |||
| (furcolmap[y*MAX_TILES_X + x] != 3)) | |||
| { | |||
| // TODO: Level of dirtiness depends on difficulty level | |||
| // Adjust probability of every tile dirt level | |||
| int dirt = GetRandomValue(0, 100); | |||
| if (dirt < 50) tiles[y*MAX_TILES_X + x].level = 0; // 50% probability | |||
| else if (dirt < 70) tiles[y*MAX_TILES_X + x].level = 1; // 20% probability | |||
| else if (dirt < 90) tiles[y*MAX_TILES_X + x].level = 2; // 10% probability | |||
| else if (dirt < 100) tiles[y*MAX_TILES_X + x].level = 3; // 10% probability | |||
| } | |||
| else tiles[y*MAX_TILES_X + x].level = 0; | |||
| tiles[y*MAX_TILES_X + x].state = tiles[y*MAX_TILES_X + x].level; | |||
| tiles[y*MAX_TILES_X + x].counter = (tiles[y*MAX_TILES_X + x].level == 0)? 0 : TILE_REQUIRED_CLEAN_TIME; | |||
| tiles[y*MAX_TILES_X + x].cleaned = (tiles[y*MAX_TILES_X + x].level == 0)? true : false; | |||
| } | |||
| } | |||
| // Init score popups | |||
| for (int i = 0; i < MAX_SCORE_POPUPS; i++) | |||
| { | |||
| popup[i].position = (Vector2){ 0, 0 }; | |||
| popup[i].value = TILE_SCORE_BY_CLEANED_LEVEL; | |||
| popup[i].enabled = false; | |||
| popup[i].alpha = 1.0f; | |||
| } | |||
| // Init cat position | |||
| catPosition = (Vector2){ 30*TILE_SIZE + roomOffset.x, TILE_SIZE + roomOffset.y }; | |||
| catTargetPosition = catPosition; | |||
| showObjective = true; | |||
| // Load music and sounds | |||
| fxCat[0] = LoadSound("resources/fxcat01.wav"); | |||
| fxCat[1] = LoadSound("resources/fxcat02.wav"); | |||
| fxRoomba[0] = LoadSound("resources/fxrobot01.wav"); | |||
| fxRoomba[1] = LoadSound("resources/fxrobot02.wav"); | |||
| fxRoomba[2] = LoadSound("resources/fxrobot03.wav"); | |||
| catch = LoadMusicStream("resources/catch22.mod"); | |||
| StopMusicStream(music); | |||
| SetMusicVolume(catch, 0.6f); | |||
| PlayMusicStream(catch); | |||
| result = 0; // Global variable: screens.h | |||
| } | |||
| // Gameplay Screen Update logic | |||
| void UpdateGameplayScreen(void) | |||
| { | |||
| UpdateMusicStream(catch); | |||
| if (showObjective) | |||
| { | |||
| if (IsKeyPressed(KEY_ENTER)) | |||
| { | |||
| showObjective = false; | |||
| PlaySound(fxCoin); | |||
| } | |||
| return; | |||
| } | |||
| framesCounter++; | |||
| if (framesCounter == 60) | |||
| { | |||
| timeLevelSeconds--; | |||
| if (timeLevelSeconds == 0) | |||
| { | |||
| levelFinished = true; | |||
| finishScreen = 1; | |||
| PlaySound(fxCoin); | |||
| if (GetTileCleanPercent() >= 80) result = 1; | |||
| } | |||
| framesCounter = 0; | |||
| } | |||
| mousePosition = GetMousePosition(); | |||
| mouseTileX = (int)floorf((mousePosition.x - roomOffset.x)/TILE_SIZE); | |||
| mouseTileY = (int)floorf((mousePosition.y - roomOffset.y)/TILE_SIZE); | |||
| // Roomba movement logic | |||
| Vector2 prevPosition = roombaPosition; | |||
| if (IsKeyDown(KEY_D)) roombaPosition.x += roombaSpeed.x; | |||
| else if (IsKeyDown(KEY_A)) roombaPosition.x -= roombaSpeed.x; | |||
| if (IsKeyDown(KEY_W)) roombaPosition.y -= roombaSpeed.y; | |||
| else if (IsKeyDown(KEY_S)) roombaPosition.y += roombaSpeed.y; | |||
| // Verify current player position is valid or reset | |||
| roombaTilePosX = (int)(floorf(roombaPosition.x - roomOffset.x)/TILE_SIZE); | |||
| roombaTilePosY = (int)(floorf(roombaPosition.y - roomOffset.y)/TILE_SIZE); | |||
| if ((roombaPosition.x - roomba.width/2 < roomOffset.x) || | |||
| ((roombaPosition.x + roomba.width/2) >= (roomOffset.x + MAX_TILES_X*TILE_SIZE)) || | |||
| (roombaPosition.y - roomba.height/2 < roomOffset.y) || | |||
| ((roombaPosition.y + roomba.height/2) >= (roomOffset.y + MAX_TILES_Y*TILE_SIZE)) || | |||
| (furcolmap[roombaTilePosY*MAX_TILES_X + roombaTilePosX] == 0) || | |||
| (furcolmap[roombaTilePosY*MAX_TILES_X + roombaTilePosX] == 3)) roombaPosition = prevPosition; | |||
| // Dyson movement logic | |||
| // if (IsKeyDown(KEY_RIGHT)) dysonPosition.x += dysonSpeed.x; | |||
| // else if (IsKeyDown(KEY_LEFT)) dysonPosition.x -= dysonSpeed.x; | |||
| // if (IsKeyDown(KEY_UP)) dysonPosition.y -= dysonSpeed.y; | |||
| // else if (IsKeyDown(KEY_DOWN)) dysonPosition.y += dysonSpeed.y; | |||
| // Check collision area between Roomba and dirt tiles to verify it's beeing cleaned | |||
| // TODO: OPTIMIZATION: Check only Roomba surrounding tiles | |||
| for (int y = 0; y < MAX_TILES_Y; y++) | |||
| { | |||
| for (int x = 0; x < MAX_TILES_X; x++) | |||
| { | |||
| // Check if tile requires cleaning | |||
| if (tiles[y*MAX_TILES_X + x].state > 0) | |||
| { | |||
| // TODO: Get better collision area measure, considering round roomba | |||
| Rectangle cleanRec = GetCollisionRec((Rectangle){ tiles[y*MAX_TILES_X + x].position.x, tiles[y*MAX_TILES_X + x].position.y, 36, 36 }, | |||
| (Rectangle){ roombaPosition.x - roomba.width/2, roombaPosition.y - roomba.height/2, roomba.width, roomba.height }); | |||
| // Check Roomba is covering at least half of the tile | |||
| if ((cleanRec.width*cleanRec.height) > TILE_REQUIRED_CLEAN_AREA) | |||
| { | |||
| // Start cleaning tile | |||
| tiles[y*MAX_TILES_X + x].counter--; | |||
| if (tiles[y*MAX_TILES_X + x].counter < 0) | |||
| { | |||
| tiles[y*MAX_TILES_X + x].state--; | |||
| if (tiles[y*MAX_TILES_X + x].state == 0) | |||
| { | |||
| tiles[y*MAX_TILES_X + x].counter = 0; | |||
| score += tiles[y*MAX_TILES_X + x].level*TILE_SCORE_BY_CLEANED_LEVEL; | |||
| // Show scoring popup, enable first ready! | |||
| for (int i = 0; i < MAX_SCORE_POPUPS; i++) | |||
| { | |||
| if (!popup[i].enabled) | |||
| { | |||
| popup[i].position = tiles[y*MAX_TILES_X + x].position; | |||
| popup[i].value = TILE_SCORE_BY_CLEANED_LEVEL*tiles[y*MAX_TILES_X + x].level; | |||
| popup[i].enabled = true; | |||
| popup[i].alpha = 1.0f; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| else tiles[y*MAX_TILES_X + x].counter = TILE_REQUIRED_CLEAN_TIME; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| // Update enabled popups! | |||
| for (int i = 0; i < MAX_SCORE_POPUPS; i++) | |||
| { | |||
| if (popup[i].enabled) | |||
| { | |||
| popup[i].position.y -= 2; | |||
| popup[i].alpha -= 0.015f; | |||
| if (popup[i].alpha < 0.0f) popup[i].enabled = false; | |||
| } | |||
| } | |||
| // Cat movement logic | |||
| if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) | |||
| { | |||
| // Check for a valid cell to move on | |||
| if ((mousePosition.x > roomOffset.x) && (mousePosition.x < (roomOffset.x + MAX_TILES_X*TILE_SIZE)) && | |||
| (mousePosition.y > roomOffset.y) && (mousePosition.y < (roomOffset.y + MAX_TILES_Y*TILE_SIZE)) && | |||
| furcolmap[mouseTileY*MAX_TILES_X + mouseTileX] != 0) | |||
| { | |||
| catTargetPosition = GetMousePosition(); | |||
| catShouldMove = true; | |||
| } | |||
| } | |||
| if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) PlaySound(fxCat[GetRandomValue(0,1)]); | |||
| if (IsKeyPressed(KEY_SPACE)) PlaySound(fxRoomba[GetRandomValue(0,2)]); | |||
| // Check if cat should move | |||
| if (catShouldMove) | |||
| { | |||
| if (CheckCollisionPointCircle(catPosition, catTargetPosition, CAT_TARGET_RADIUS)) | |||
| { | |||
| catShouldMove = false; | |||
| // Spread dirt all around selected cell! | |||
| // NOTE: We consider cat drawing offset | |||
| catTilePosX = (int)floorf((catPosition.x - cat.width/2 - roomOffset.x)/TILE_SIZE) + 1; | |||
| catTilePosY = (int)floorf((catPosition.y - cat.height/2 - 10 - roomOffset.y)/TILE_SIZE) + 1; | |||
| // Check if tile includes a dirt element | |||
| if (furcolmap[mouseTileY*MAX_TILES_X + mouseTileX] == 3) | |||
| { | |||
| for (int y = (catTilePosY - CAT_DIRT_CELL_RADIUS); y < (catTilePosY + CAT_DIRT_CELL_RADIUS + 1); y++) | |||
| { | |||
| for (int x = (catTilePosX - CAT_DIRT_CELL_RADIUS); x < (catTilePosX + CAT_DIRT_CELL_RADIUS + 1); x++) | |||
| { | |||
| if (((y >= 0) && (y < MAX_TILES_Y) && (x >= 0) && (x < MAX_TILES_X)) && | |||
| (tiles[y*MAX_TILES_X + x].state == 0) && | |||
| (furcolmap[y*MAX_TILES_X + x] != 0) && | |||
| (furcolmap[y*MAX_TILES_X + x] != 3)) | |||
| { | |||
| int dirt = GetRandomValue(0, 100); | |||
| if (dirt < 50) tiles[y*MAX_TILES_X + x].level = 0; // 50% probability | |||
| else if (dirt < 70) tiles[y*MAX_TILES_X + x].level = 1; // 20% probability | |||
| else if (dirt < 90) tiles[y*MAX_TILES_X + x].level = 2; // 10% probability | |||
| else if (dirt < 100) tiles[y*MAX_TILES_X + x].level = 3; // 10% probability | |||
| tiles[y*MAX_TILES_X + x].state = tiles[y*MAX_TILES_X + x].level; | |||
| tiles[y*MAX_TILES_X + x].counter = (tiles[y*MAX_TILES_X + x].level == 0)? 0 : TILE_REQUIRED_CLEAN_TIME; | |||
| tiles[y*MAX_TILES_X + x].cleaned = (tiles[y*MAX_TILES_X + x].level == 0)? true : false; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| else | |||
| { | |||
| Vector2 dir = Vector2Subtract(catTargetPosition, catPosition); | |||
| Vector2 dirnorm = Vector2Normalize(dir); | |||
| catPosition.x += catSpeed.x*dirnorm.x; | |||
| catPosition.y += catSpeed.y*dirnorm.y; | |||
| } | |||
| } | |||
| if (levelFinished) | |||
| { | |||
| // TODO: Check level finished | |||
| } | |||
| } | |||
| // Gameplay Screen Draw logic | |||
| void DrawGameplayScreen(void) | |||
| { | |||
| DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), GetColor(0x57374cff)); | |||
| // Draw tiles | |||
| for (int y = 0; y < MAX_TILES_Y; y++) | |||
| { | |||
| for (int x = 0; x < MAX_TILES_X; x++) | |||
| { | |||
| // Draw dirty tiles | |||
| DrawTextureRec(dirtiles, (Rectangle){ tiles[y*MAX_TILES_X + x].state*TILE_SIZE, 0, TILE_SIZE, TILE_SIZE }, | |||
| (Vector2){ roomOffset.x + TILE_SIZE*x, roomOffset.y + TILE_SIZE*y }, WHITE); | |||
| // TODO: Draw possible walls | |||
| } | |||
| } | |||
| // Draw starting point for roomba and cat | |||
| DrawTextureRec(furniture, (Rectangle){ furset[30].posX, furset[30].posY, furset[30].width, furset[30].height }, roomOffset, WHITE); | |||
| DrawTextureRec(furniture, (Rectangle){ furset[29].posX, furset[29].posY, furset[29].width, furset[29].height }, (Vector2){ roomOffset.x + 29*36, roomOffset.y }, WHITE); | |||
| DrawTexture(roomba, roombaPosition.x - roomba.width/2, roombaPosition.y - roomba.height/2, WHITE); | |||
| DrawTexture(cat, catPosition.x - cat.width/2, catPosition.y - cat.height/2 - 10, WHITE); | |||
| float furAlpha = 1.0f; | |||
| // Draw home objects | |||
| for (int i = 0; i < furnitureCount; i++) | |||
| { | |||
| if (CheckCollisionCircleRec((Vector2){ roombaPosition.x - roomba.width/2, roombaPosition.y - roomba.height/2 }, roomba.width, | |||
| (Rectangle){ roomOffset.x + furmap[i].cellX*TILE_SIZE, roomOffset.y + furmap[i].cellY*TILE_SIZE, | |||
| furset[furmap[i].furId].width, furset[furmap[i].furId].height}) && (furmap[i].state == 1)) | |||
| { | |||
| DrawTextureRec(furniture, (Rectangle){ furset[furmap[i].furId].posX, furset[furmap[i].furId].posY, furset[furmap[i].furId].width, furset[furmap[i].furId].height }, | |||
| (Vector2){ roomOffset.x + furmap[i].cellX*TILE_SIZE, roomOffset.y + furmap[i].cellY*TILE_SIZE }, Fade(WHITE, 0.5f)); | |||
| } | |||
| else | |||
| { | |||
| DrawTextureRec(furniture, (Rectangle){ furset[furmap[i].furId].posX, furset[furmap[i].furId].posY, furset[furmap[i].furId].width, furset[furmap[i].furId].height }, | |||
| (Vector2){ roomOffset.x + furmap[i].cellX*TILE_SIZE, roomOffset.y + furmap[i].cellY*TILE_SIZE }, Fade(WHITE, furAlpha)); | |||
| } | |||
| } | |||
| #if defined(TILE_VIEWER_MODE) | |||
| DrawTexture(tracemap, roomOffset.x, roomOffset.y, Fade(WHITE, 0.5f)); | |||
| DrawTexture(fursetid, 0, 720, WHITE); | |||
| #endif | |||
| // TODO: If an object has been used by cat, draw it in gray | |||
| // Maybe add a tempo bar for reusing? | |||
| // Draw UI | |||
| DrawTextEx(font2, "SCORE:", (Vector2){ 80, 10 }, font2.baseSize, 2, WHITE); | |||
| DrawTextEx(font, FormatText("%i", score), (Vector2){ 260, 10 }, font.baseSize, 2, WHITE); | |||
| DrawTextEx(font2, "CLEAN:", (Vector2){ 500, 10 }, font2.baseSize, 2, WHITE); | |||
| DrawTextEx(font, FormatText("%.2f%%", GetTileCleanPercent()), (Vector2){ 690, 10 }, font.baseSize, 2, WHITE); | |||
| DrawTextEx(font2, "TIME:", (Vector2){ 950, 10 }, font2.baseSize, 2, WHITE); | |||
| DrawTextEx(font, FormatText("%i:%02is", timeLevelSeconds/60, timeLevelSeconds%60), (Vector2){ 1100, 10 }, font.baseSize, 2, WHITE); | |||
| // Debug information | |||
| //DrawText(FormatText("CatTilePos: [ %i, %i ]", catTilePosX, catTilePosY), roomOffset.x, 690, 20, RAYWHITE); | |||
| //DrawText(FormatText("MousePos: [ %i, %i ]", mouseTileX, mouseTileY), 400, 690, 20, RED); | |||
| //DrawText(FormatText("RoombaPos: [ %i, %i ]", roombaTilePosX, roombaTilePosY), 600, 690, 20, GREEN); | |||
| if ((mouseTileY >= 0) && (mouseTileY < MAX_TILES_Y) && (mouseTileX >= 0) && (mouseTileX < MAX_TILES_X)) | |||
| { | |||
| DrawRectangleLinesEx((Rectangle){ tiles[mouseTileY*MAX_TILES_X + mouseTileX].position.x, | |||
| tiles[mouseTileY*MAX_TILES_X + mouseTileX].position.y, TILE_SIZE, TILE_SIZE }, 2, RED); | |||
| } | |||
| // Draw enabled popups! | |||
| for (int i = 0; i < MAX_SCORE_POPUPS; i++) | |||
| { | |||
| if (popup[i].enabled) DrawText(FormatText("+%i", popup[i].value), popup[i].position.x, popup[i].position.y, 20, Fade(RED, popup[i].alpha)); | |||
| } | |||
| // Show objective | |||
| if (showObjective) | |||
| { | |||
| DrawRectangle(0, 150, GetScreenWidth(), GetScreenHeight() - 300, Fade(DARKGRAY, 0.7f)); | |||
| DrawTextEx(font2, "OBJECTIVE:", (Vector2){ 500, 240 }, font2.baseSize, 2, WHITE); | |||
| DrawTextEx(font, "CLEAN 80% OF THE ROOM", (Vector2){ 300, 320 }, font.baseSize, 2, WHITE); | |||
| } | |||
| } | |||
| // Gameplay Screen Unload logic | |||
| void UnloadGameplayScreen(void) | |||
| { | |||
| // Unload GAMEPLAY screen variables here! | |||
| UnloadTexture(roomba); | |||
| UnloadTexture(cat); | |||
| UnloadTexture(dirtiles); | |||
| UnloadTexture(furniture); | |||
| UnloadSound(fxCat[0]); | |||
| UnloadSound(fxCat[1]); | |||
| UnloadSound(fxRoomba[0]); | |||
| UnloadSound(fxRoomba[1]); | |||
| UnloadSound(fxRoomba[2]); | |||
| StopMusicStream(catch); | |||
| UnloadMusicStream(catch); | |||
| } | |||
| // Gameplay Screen should finish? | |||
| int FinishGameplayScreen(void) | |||
| { | |||
| return finishScreen; | |||
| } | |||
| //---------------------------------------------------------------------------------- | |||
| // Module Functions Declaration | |||
| //---------------------------------------------------------------------------------- | |||
| // Check how much cleaning we have done | |||
| static float GetTileCleanPercent(void) | |||
| { | |||
| float value = 0; | |||
| int tileLevelsToClean = 0; | |||
| int tileLevelsCleaned = 0; | |||
| for (int y = 0; y < MAX_TILES_Y; y++) | |||
| { | |||
| for (int x = 0; x < MAX_TILES_X; x++) | |||
| { | |||
| if (tiles[y*MAX_TILES_X + x].level > 0) | |||
| { | |||
| tileLevelsToClean += tiles[y*MAX_TILES_X + x].level; | |||
| tileLevelsCleaned += tiles[y*MAX_TILES_X + x].state; | |||
| } | |||
| } | |||
| } | |||
| value = ((float)(tileLevelsToClean - tileLevelsCleaned)/tileLevelsToClean)*100.0f; | |||
| return value; | |||
| } | |||
| @ -0,0 +1,211 @@ | |||
| /********************************************************************************************** | |||
| * | |||
| * raylib - Advance Game template | |||
| * | |||
| * Logo Screen Functions Definitions (Init, Update, Draw, Unload) | |||
| * | |||
| * Copyright (c) 2014-2018 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 char raylib[8]; // raylib text array, max 8 letters | |||
| 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; | |||
| for (int i = 0; i < 8; i++) raylib[i] = '\0'; | |||
| 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... | |||
| } | |||
| } | |||
| 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 (framesCounter/10) // Every 12 frames, one more letter! | |||
| { | |||
| lettersCount++; | |||
| framesCounter = 0; | |||
| } | |||
| switch (lettersCount) | |||
| { | |||
| case 1: raylib[0] = 'r'; break; | |||
| case 2: raylib[1] = 'a'; break; | |||
| case 3: raylib[2] = 'y'; break; | |||
| case 4: raylib[3] = 'l'; break; | |||
| case 5: raylib[4] = 'i'; break; | |||
| case 6: raylib[5] = 'b'; break; | |||
| default: break; | |||
| } | |||
| // When all letters have appeared... | |||
| if (lettersCount >= 10) | |||
| { | |||
| state = 4; | |||
| framesCounter = 0; | |||
| } | |||
| } | |||
| else if (state == 4) | |||
| { | |||
| framesCounter++; | |||
| if (framesCounter > 100) | |||
| { | |||
| 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(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, Fade(BLACK, alpha)); | |||
| } | |||
| else if (state == 4) | |||
| { | |||
| 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(raylib, 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; | |||
| } | |||
| @ -0,0 +1,154 @@ | |||
| /********************************************************************************************** | |||
| * | |||
| * raylib - Advance Game template | |||
| * | |||
| * Title Screen Functions Definitions (Init, Update, Draw, Unload) | |||
| * | |||
| * Copyright (c) 2014-2018 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 int state; | |||
| static int scrollPositionX; | |||
| static int catPosX; | |||
| static int roombaPosX; | |||
| static float vsAlpha; | |||
| static float vsScale; | |||
| static Texture2D cat; | |||
| static Texture2D vs; | |||
| static Texture2D roomba; | |||
| //---------------------------------------------------------------------------------- | |||
| // Title Screen Functions Definition | |||
| //---------------------------------------------------------------------------------- | |||
| // Title Screen Initialization logic | |||
| void InitTitleScreen(void) | |||
| { | |||
| // TODO: Initialize TITLE screen variables here! | |||
| framesCounter = 0; | |||
| finishScreen = 0; | |||
| cat = LoadTexture("resources/title_cat.png"); | |||
| vs = LoadTexture("resources/title_vs.png"); | |||
| roomba = LoadTexture("resources/title_roomba.png"); | |||
| state = 0; | |||
| catPosX = 1760; | |||
| roombaPosX = -700; | |||
| scrollPositionX = 0; | |||
| vsAlpha = 0.0f; | |||
| vsScale = 10.0f; | |||
| PlayMusicStream(music); | |||
| } | |||
| // Title Screen Update logic | |||
| void UpdateTitleScreen(void) | |||
| { | |||
| scrollPositionX -= 5; | |||
| if (scrollPositionX < -GetScreenWidth()) scrollPositionX = 0; | |||
| if (state == 0) | |||
| { | |||
| catPosX -= 4; | |||
| roombaPosX += 3; | |||
| if (catPosX < (GetScreenWidth()/2 - cat.width/2)) catPosX = (GetScreenWidth()/2 - cat.width/2); | |||
| if (roombaPosX > (GetScreenWidth()/2 - roomba.width/2)) roombaPosX = (GetScreenWidth()/2 - roomba.width/2); | |||
| if ((catPosX == (GetScreenWidth()/2 - cat.width/2)) && (roombaPosX == (GetScreenWidth()/2 - roomba.width/2))) | |||
| { | |||
| state = 1; | |||
| framesCounter = 0; | |||
| } | |||
| } | |||
| else if (state == 1) | |||
| { | |||
| framesCounter++; | |||
| vsScale -= 0.1f; | |||
| vsAlpha += 0.01f; | |||
| if (vsScale < 1.0f) vsScale = 1.0f; | |||
| if (vsAlpha > 1.0f) vsAlpha = 1.0f; | |||
| if (framesCounter > 160) | |||
| { | |||
| state = 2; | |||
| framesCounter = 0; | |||
| } | |||
| } | |||
| else if (state == 2) framesCounter++; | |||
| // Press enter or tap to change to GAMEPLAY screen | |||
| if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP)) | |||
| { | |||
| //finishScreen = 1; // OPTIONS | |||
| finishScreen = 2; // GAMEPLAY | |||
| PlaySound(fxCoin); | |||
| } | |||
| } | |||
| // Title Screen Draw logic | |||
| void DrawTitleScreen(void) | |||
| { | |||
| for (int i = 0; i < 64*2*2; i++) | |||
| { | |||
| DrawRectangle(64*i + scrollPositionX, 0, 64, GetScreenHeight(), (i%2 == 0)? GetColor(0xf3726dff) : GetColor(0xffcf6bff)); | |||
| } | |||
| DrawTexture(cat, catPosX, 80, WHITE); | |||
| DrawTexture(roomba, roombaPosX, 320, WHITE); | |||
| if (state > 0) | |||
| { | |||
| DrawTexturePro(vs, (Rectangle){ 0, 0, vs.width, vs.height }, (Rectangle){ GetScreenWidth()/2, 300, vs.width*vsScale, vs.height*vsScale }, (Vector2){ vs.width/2*vsScale, vs.height/2*vsScale }, 0.0f, Fade(WHITE, vsAlpha)); | |||
| } | |||
| if ((state == 2) && ((framesCounter/30)%2)) DrawTextEx(font2, "PRESS ENTER to START", (Vector2){ 340, 550 }, font2.baseSize, 2, WHITE); | |||
| } | |||
| // Title Screen Unload logic | |||
| void UnloadTitleScreen(void) | |||
| { | |||
| UnloadTexture(cat); | |||
| UnloadTexture(vs); | |||
| UnloadTexture(roomba); | |||
| } | |||
| // Title Screen should finish? | |||
| int FinishTitleScreen(void) | |||
| { | |||
| return finishScreen; | |||
| } | |||
| @ -0,0 +1,92 @@ | |||
| /********************************************************************************************** | |||
| * | |||
| * raylib - Advance Game template | |||
| * | |||
| * Screens Functions Declarations (Init, Update, Draw, Unload) | |||
| * | |||
| * Copyright (c) 2014-2018 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 | |||
| //#define TILE_VIEWER_MODE | |||
| //---------------------------------------------------------------------------------- | |||
| // Types and Structures Definition | |||
| //---------------------------------------------------------------------------------- | |||
| typedef enum GameScreen { LOGO = 0, TITLE, OPTIONS, GAMEPLAY, ENDING } GameScreen; | |||
| //---------------------------------------------------------------------------------- | |||
| // Global Variables Definition | |||
| //---------------------------------------------------------------------------------- | |||
| GameScreen currentScreen; | |||
| Font font; | |||
| Font font2; | |||
| Music music; | |||
| Sound fxCoin; | |||
| int score; | |||
| int result; // 0-Loose, 1-Win | |||
| #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 | |||