diff options
| author | raysan5 <[email protected]> | 2020-04-13 13:31:45 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2020-04-13 13:31:45 +0200 |
| commit | fd5d1dfcb6d740728f21cdd08ba8387b0ee2f899 (patch) | |
| tree | 6884674e4585aeef46346e0f8868b0e25c634efd /games/just_do | |
| parent | eb04be8141c5e70f99d8104c44a61fb71779a55a (diff) | |
| download | raylib-fd5d1dfcb6d740728f21cdd08ba8387b0ee2f899.tar.gz raylib-fd5d1dfcb6d740728f21cdd08ba8387b0ee2f899.zip | |
WARNING: REMOVED raylib/games - Moved to raysan5/raylib-games
Move raylib games to another repo. It will reduce repo size for new clones.
I considered also removing the related history with [`git filter-repo`](https://github.com/newren/git-filter-repo) (the current sane alternative to the deprecated `filter-branch`) but it has some implications: It would had made a new repository with distinct history and checksums. If the repo was previously published,
the history of the new one won't have been compatible with the history others have pulled.
Diffstat (limited to 'games/just_do')
| -rw-r--r-- | games/just_do/CMakeLists.txt | 16 | ||||
| -rw-r--r-- | games/just_do/LICENSE.txt | 20 | ||||
| -rw-r--r-- | games/just_do/Makefile | 413 | ||||
| -rw-r--r-- | games/just_do/Makefile.Android | 300 | ||||
| -rw-r--r-- | games/just_do/just_do.c | 356 | ||||
| -rw-r--r-- | games/just_do/resources/ambient.ogg | bin | 2672956 -> 0 bytes | |||
| -rw-r--r-- | games/just_do/resources/win.wav | bin | 6748 -> 0 bytes | |||
| -rw-r--r-- | games/just_do/screens/screen_level00.c | 167 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level01.c | 163 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level02.c | 157 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level03.c | 134 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level04.c | 147 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level05.c | 185 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level06.c | 156 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level07.c | 178 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level08.c | 157 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level09.c | 199 | ||||
| -rw-r--r-- | games/just_do/screens/screen_level10.c | 153 | ||||
| -rw-r--r-- | games/just_do/screens/screen_logo.c | 227 | ||||
| -rw-r--r-- | games/just_do/screens/screens.h | 150 |
20 files changed, 0 insertions, 3278 deletions
diff --git a/games/just_do/CMakeLists.txt b/games/just_do/CMakeLists.txt deleted file mode 100644 index f25b6e37..00000000 --- a/games/just_do/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(just_do) - -# Grab the screens -file(GLOB screen_sources "screens/*.c") - -# Executable & linking -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c ${screen_sources}) -if (NOT TARGET raylib) - find_package(raylib 2.0 REQUIRED) -endif() -target_link_libraries(${PROJECT_NAME} raylib) - -# Resources -# Copy all of the resource files to the destination -file(COPY "resources/" DESTINATION "resources/") diff --git a/games/just_do/LICENSE.txt b/games/just_do/LICENSE.txt deleted file mode 100644 index 510604da..00000000 --- a/games/just_do/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ - -This game sources are licensed under an unmodified zlib/libpng license, -which is an OSI-certified, BSD-like license: - -Copyright (c) 2013-2017 Ramon Santamaria (@raysan5) - -This software is provided "as-is", without any express or implied warranty. In no event -will the authors be held liable for any damages arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, including commercial -applications, and to alter it and redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not claim that you - wrote the original software. If you use this software in a product, an acknowledgment - in the product documentation would be appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and must not be misrepresented - as being the original software. - - 3. This notice may not be removed or altered from any source distribution.
\ No newline at end of file diff --git a/games/just_do/Makefile b/games/just_do/Makefile deleted file mode 100644 index 7e463174..00000000 --- a/games/just_do/Makefile +++ /dev/null @@ -1,413 +0,0 @@ -#************************************************************************************************** -# -# raylib makefile for Desktop platforms, Raspberry Pi, Android and HTML5 -# -# Copyright (c) 2013-2020 Ramon Santamaria (@raysan5) -# -# This software is provided "as-is", without any express or implied warranty. In no event -# will the authors be held liable for any damages arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, including commercial -# applications, and to alter it and redistribute it freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not claim that you -# wrote the original software. If you use this software in a product, an acknowledgment -# in the product documentation would be appreciated but is not required. -# -# 2. Altered source versions must be plainly marked as such, and must not be misrepresented -# as being the original software. -# -# 3. This notice may not be removed or altered from any source distribution. -# -#************************************************************************************************** - -.PHONY: all clean - -# Define required raylib variables -PROJECT_NAME ?= just_do -RAYLIB_VERSION ?= 3.0.0 -RAYLIB_API_VERSION ?= 3 -RAYLIB_PATH ?= C:\GitHub\raylib - -# Define default options - -# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB -PLATFORM ?= PLATFORM_DESKTOP - -# Locations of your newly installed library and associated headers. See ../src/Makefile -# On Linux, if you have installed raylib but cannot compile the examples, check that -# the *_INSTALL_PATH values here are the same as those in src/Makefile or point to known locations. -# To enable system-wide compile-time and runtime linking to libraylib.so, run ../src/$ sudo make install RAYLIB_LIBTYPE_SHARED. -# To enable compile-time linking to a special version of libraylib.so, change these variables here. -# To enable runtime linking to a special version of libraylib.so, see EXAMPLE_RUNTIME_PATH below. -# If there is a libraylib in both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, at runtime, -# the library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over the one at RAYLIB_INSTALL_PATH. -# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths. -DESTDIR ?= /usr/local -RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib -# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files. -RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include - -# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC - -# Build mode for project: DEBUG or RELEASE -BUILD_MODE ?= RELEASE - -# Use external GLFW library instead of rglfw module -# TODO: Review usage on Linux. Target version of choice. Switch on -lglfw or -lglfw3 -USE_EXTERNAL_GLFW ?= FALSE - -# Use Wayland display server protocol on Linux desktop -# by default it uses X11 windowing system -USE_WAYLAND_DISPLAY ?= FALSE - -# Determine PLATFORM_OS in case PLATFORM_DESKTOP selected -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - # No uname.exe on MinGW!, but OS=Windows_NT on Windows! - # ifeq ($(UNAME),Msys) -> Windows - ifeq ($(OS),Windows_NT) - PLATFORM_OS=WINDOWS - else - UNAMEOS=$(shell uname) - ifeq ($(UNAMEOS),Linux) - PLATFORM_OS=LINUX - endif - ifeq ($(UNAMEOS),FreeBSD) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),OpenBSD) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),NetBSD) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),DragonFly) - PLATFORM_OS=BSD - endif - ifeq ($(UNAMEOS),Darwin) - PLATFORM_OS=OSX - endif - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - UNAMEOS=$(shell uname) - ifeq ($(UNAMEOS),Linux) - PLATFORM_OS=LINUX - endif -endif - -# RAYLIB_PATH adjustment for different platforms. -# If using GNU make, we can get the full path to the top of the tree. Windows? BSD? -# Required for ldconfig or other tools that do not perform path expansion. -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),LINUX) - RAYLIB_PREFIX ?= .. - RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX)) - endif -endif -# Default path for raylib on Raspberry Pi, if installed in different path, update it! -# This is not currently used by src/Makefile. Not sure of its origin or usage. Refer to wiki. -# TODO: update install: target in src/Makefile for RPI, consider relation to LINUX. -ifeq ($(PLATFORM),PLATFORM_RPI) - RAYLIB_PATH ?= /home/pi/raylib -endif - -ifeq ($(PLATFORM),PLATFORM_WEB) - # Emscripten required variables - EMSDK_PATH ?= C:/emsdk - EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/fastcomp/emscripten - CLANG_PATH = $(EMSDK_PATH)/fastcomp/bin - PYTHON_PATH = $(EMSDK_PATH)/python/2.7.13.1_64bit/python-2.7.13.amd64 - NODE_PATH = $(EMSDK_PATH)/node/12.9.1_64bit/bin - export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH) -endif - -# Define raylib release directory for compiled library. -# RAYLIB_RELEASE_PATH points to provided binaries or your freshly built version -RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src - -# EXAMPLE_RUNTIME_PATH embeds a custom runtime location of libraylib.so or other desired libraries -# into each example binary compiled with RAYLIB_LIBTYPE=SHARED. It defaults to RAYLIB_RELEASE_PATH -# so that these examples link at runtime with your version of libraylib.so in ../release/libs/linux -# without formal installation from ../src/Makefile. It aids portability and is useful if you have -# multiple versions of raylib, have raylib installed to a non-standard location, or want to -# bundle libraylib.so with your game. Change it to your liking. -# NOTE: If, at runtime, there is a libraylib.so at both EXAMPLE_RUNTIME_PATH and RAYLIB_INSTALL_PATH, -# The library at EXAMPLE_RUNTIME_PATH, if present, will take precedence over RAYLIB_INSTALL_PATH, -# Implemented for LINUX below with CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH) -# To see the result, run readelf -d core/core_basic_window; looking at the RPATH or RUNPATH attribute. -# To see which libraries a built example is linking to, ldd core/core_basic_window; -# Look for libraylib.so.1 => $(RAYLIB_INSTALL_PATH)/libraylib.so.1 or similar listing. -EXAMPLE_RUNTIME_PATH ?= $(RAYLIB_RELEASE_PATH) - -# Define default C compiler: gcc -# NOTE: define g++ compiler if using C++ -CC = gcc - -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),OSX) - # OSX default compiler - CC = clang - endif - ifeq ($(PLATFORM_OS),BSD) - # FreeBSD, OpenBSD, NetBSD, DragonFly default compiler - CC = clang - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) - # Define RPI cross-compiler - #CC = armv6j-hardfloat-linux-gnueabi-gcc - CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc - endif -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - # HTML5 emscripten compiler - # WARNING: To compile to HTML5, code must be redesigned - # to use emscripten.h and emscripten_set_main_loop() - CC = emcc -endif - -# Define default make program: Mingw32-make -MAKE = mingw32-make - -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),LINUX) - MAKE = make - endif -endif - -# Define compiler flags: -# -O1 defines optimization level -# -g include debug information on compilation -# -s strip unnecessary data from build -# -Wall turns on most, but not all, compiler warnings -# -std=c99 defines C language mode (standard C from 1999 revision) -# -std=gnu99 defines C language mode (GNU C from 1999 revision) -# -Wno-missing-braces ignore invalid warning (GCC bug 53119) -# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec -CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces - -ifeq ($(BUILD_MODE),DEBUG) - CFLAGS += -g - ifeq ($(PLATFORM),PLATFORM_WEB) - CFLAGS += -s ASSERTIONS=1 --profiling - endif -else - ifeq ($(PLATFORM),PLATFORM_WEB) - CFLAGS += -Os - else - CFLAGS += -s -O1 - endif -endif - -# Additional flags for compiler (if desired) -#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),LINUX) - ifeq ($(RAYLIB_LIBTYPE),STATIC) - CFLAGS += -D_DEFAULT_SOURCE - endif - ifeq ($(RAYLIB_LIBTYPE),SHARED) - # Explicitly enable runtime link to libraylib.so - CFLAGS += -Wl,-rpath,$(EXAMPLE_RUNTIME_PATH) - endif - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - CFLAGS += -std=gnu99 -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - # -Os # size optimization - # -O2 # optimization level 2, if used, also set --memory-init-file 0 - # -s USE_GLFW=3 # Use glfw3 library (context/input management) - # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL! - # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) - # -s USE_PTHREADS=1 # multithreading support - # -s WASM=0 # disable Web Assembly, emitted by default - # -s EMTERPRETIFY=1 # enable emscripten code interpreter (very slow) - # -s EMTERPRETIFY_ASYNC=1 # support synchronous loops by emterpreter - # -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data - # -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off) - # --profiling # include information for code profiling - # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) - # --preload-file resources # specify a resources folder for data compilation - CFLAGS += -s USE_GLFW=3 -s TOTAL_MEMORY=67108864 --preload-file resources - - # Define a custom shell .html and output extension - CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html - EXT = .html -endif - -# Define include paths for required headers -# NOTE: Several external required libraries (stb and others) -INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external - -# Define additional directories containing required header files -ifeq ($(PLATFORM),PLATFORM_RPI) - # RPI required libraries - INCLUDE_PATHS += -I/opt/vc/include - INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux - INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads -endif -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),BSD) - # Consider -L$(RAYLIB_H_INSTALL_PATH) - INCLUDE_PATHS += -I/usr/local/include - endif - ifeq ($(PLATFORM_OS),LINUX) - # Reset everything. - # Precedence: immediately local, installed version, raysan5 provided libs -I$(RAYLIB_H_INSTALL_PATH) -I$(RAYLIB_PATH)/release/include - INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -isystem. -isystem$(RAYLIB_PATH)/src -isystem$(RAYLIB_PATH)/release/include -isystem$(RAYLIB_PATH)/src/external - endif -endif - -# Define library paths containing required libs. -LDFLAGS = -L. -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)/src - -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - # resource file contains windows executable icon and properties - LDFLAGS += $(RAYLIB_PATH)/src/raylib.rc.data - # -Wl,--subsystem,windows hides the console window - ifeq ($(BUILD_MODE), RELEASE) - LDFLAGS += -Wl,--subsystem,windows - endif - endif - ifeq ($(PLATFORM_OS),BSD) - # Consider -L$(RAYLIB_INSTALL_PATH) - LDFLAGS += -L. -Lsrc -L/usr/local/lib - endif - ifeq ($(PLATFORM_OS),LINUX) - # Reset everything. - # Precedence: immediately local, installed version, raysan5 provided libs - LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) - endif -endif - -ifeq ($(PLATFORM),PLATFORM_RPI) - LDFLAGS += -L/opt/vc/lib -endif - -# Define any libraries required on linking -# if you want to link libraries (libname.so or libname.a), use the -lname -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - # Libraries for Windows desktop compilation - # NOTE: WinMM library required to set high-res timer resolution - LDLIBS = -lraylib -lopengl32 -lgdi32 -lwinmm - # Required for physac examples - LDLIBS += -static -lpthread - endif - ifeq ($(PLATFORM_OS),LINUX) - # Libraries for Debian GNU/Linux desktop compiling - # NOTE: Required packages: libegl1-mesa-dev - LDLIBS = -lraylib -lGL -lm -lpthread -ldl -lrt - - # On X11 requires also below libraries - LDLIBS += -lX11 - # NOTE: It seems additional libraries are not required any more, latest GLFW just dlopen them - #LDLIBS += -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor - - # On Wayland windowing system, additional libraries requires - ifeq ($(USE_WAYLAND_DISPLAY),TRUE) - LDLIBS += -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon - endif - # Explicit link to libc - ifeq ($(RAYLIB_LIBTYPE),SHARED) - LDLIBS += -lc - endif - endif - ifeq ($(PLATFORM_OS),OSX) - # Libraries for OSX 10.9 desktop compiling - # NOTE: Required packages: libopenal-dev libegl1-mesa-dev - LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo - endif - ifeq ($(PLATFORM_OS),BSD) - # Libraries for FreeBSD, OpenBSD, NetBSD, DragonFly desktop compiling - # NOTE: Required packages: mesa-libs - LDLIBS = -lraylib -lGL -lpthread -lm - - # On XWindow requires also below libraries - LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor - endif - ifeq ($(USE_EXTERNAL_GLFW),TRUE) - # NOTE: It could require additional packages installed: libglfw3-dev - LDLIBS += -lglfw - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - # Libraries for Raspberry Pi compiling - # NOTE: Required packages: libasound2-dev (ALSA) - LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - # Libraries for web (HTML5) compiling - LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.bc -endif - -# Define all source files required -PROJECT_SOURCE_FILES ?= \ - just_do.c \ - screens/screen_logo.c \ - screens/screen_level00.c \ - screens/screen_level01.c \ - screens/screen_level02.c \ - screens/screen_level03.c \ - screens/screen_level04.c \ - screens/screen_level05.c \ - screens/screen_level06.c \ - screens/screen_level07.c \ - screens/screen_level08.c \ - screens/screen_level09.c - -# Define all object files from source files -OBJS = $(patsubst %.c, %.o, $(PROJECT_SOURCE_FILES)) - -# For Android platform we call a custom Makefile.Android -ifeq ($(PLATFORM),PLATFORM_ANDROID) - MAKEFILE_PARAMS = -f Makefile.Android - export PROJECT_NAME - export PROJECT_SOURCE_FILES -else - MAKEFILE_PARAMS = $(PROJECT_NAME) -endif - -# Default target entry -# NOTE: We call this Makefile target or Makefile.Android target -all: - $(MAKE) $(MAKEFILE_PARAMS) - -# Project target defined by PROJECT_NAME -$(PROJECT_NAME): $(OBJS) - $(CC) -o $(PROJECT_NAME)$(EXT) $(OBJS) $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) - -# Compile source files -# NOTE: This pattern will compile every module defined on $(OBJS) -%.o: %.c - $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) - -# Clean everything -clean: -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - del *.o *.exe /s - endif - ifeq ($(PLATFORM_OS),LINUX) - find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable|x-pie-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -fv - endif - ifeq ($(PLATFORM_OS),OSX) - find . -type f -perm +ugo+x -delete - rm -f *.o - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - find . -type f -executable -delete - rm -fv *.o -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - del *.o *.html *.js -endif - @echo Cleaning done - diff --git a/games/just_do/Makefile.Android b/games/just_do/Makefile.Android deleted file mode 100644 index 29d437b1..00000000 --- a/games/just_do/Makefile.Android +++ /dev/null @@ -1,300 +0,0 @@ -#************************************************************************************************** -# -# raylib makefile for Android project (APK building) -# -# Copyright (c) 2017 Ramon Santamaria (@raysan5) -# -# This software is provided "as-is", without any express or implied warranty. In no event -# will the authors be held liable for any damages arising from the use of this software. -# -# Permission is granted to anyone to use this software for any purpose, including commercial -# applications, and to alter it and redistribute it freely, subject to the following restrictions: -# -# 1. The origin of this software must not be misrepresented; you must not claim that you -# wrote the original software. If you use this software in a product, an acknowledgment -# in the product documentation would be appreciated but is not required. -# -# 2. Altered source versions must be plainly marked as such, and must not be misrepresented -# as being the original software. -# -# 3. This notice may not be removed or altered from any source distribution. -# -#************************************************************************************************** - -# Define required raylib variables -PLATFORM ?= PLATFORM_ANDROID -RAYLIB_PATH ?= ..\.. - -# Define Android architecture (armeabi-v7a, arm64-v8a, x86, x86-64) and API version -ANDROID_ARCH ?= ARM -ANDROID_API_VERSION = 21 -ifeq ($(ANDROID_ARCH),ARM) - ANDROID_ARCH_NAME = armeabi-v7a -endif -ifeq ($(ANDROID_ARCH),ARM64) - ANDROID_ARCH_NAME = arm64-v8a -endif - -# Required path variables -# NOTE: JAVA_HOME must be set to JDK -JAVA_HOME ?= C:/JavaJDK -ANDROID_HOME = C:/android-sdk -ANDROID_TOOLCHAIN = C:/android_toolchain_$(ANDROID_ARCH)_API$(ANDROID_API_VERSION) -ANDROID_BUILD_TOOLS = $(ANDROID_HOME)/build-tools/28.0.1 -ANDROID_PLATFORM_TOOLS = $(ANDROID_HOME)/platform-tools - -# Android project configuration variables -PROJECT_NAME ?= raylib_game -PROJECT_LIBRARY_NAME ?= main -PROJECT_BUILD_PATH ?= android.$(PROJECT_NAME) -PROJECT_RESOURCES_PATH ?= resources -PROJECT_SOURCE_FILES ?= raylib_game.c - -# Some source files are placed in directories, when compiling to some -# output directory other than source, that directory must pre-exist. -# Here we get a list of required folders that need to be created on -# code output folder $(PROJECT_BUILD_PATH)\obj to avoid GCC errors. -PROJECT_SOURCE_DIRS = $(sort $(dir $(PROJECT_SOURCE_FILES))) - -# Android app configuration variables -APP_LABEL_NAME ?= rGame -APP_COMPANY_NAME ?= raylib -APP_PRODUCT_NAME ?= rgame -APP_VERSION_CODE ?= 1 -APP_VERSION_NAME ?= 1.0 -APP_ICON_LDPI ?= $(RAYLIB_PATH)\logo\raylib_36x36.png -APP_ICON_MDPI ?= $(RAYLIB_PATH)\logo\raylib_48x48.png -APP_ICON_HDPI ?= $(RAYLIB_PATH)\logo\raylib_72x72.png -APP_SCREEN_ORIENTATION ?= landscape -APP_KEYSTORE_PASS ?= raylib - -# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC - -# Library path for libraylib.a/libraylib.so -RAYLIB_LIB_PATH = $(RAYLIB_PATH)\src - -# Shared libs must be added to APK if required -# NOTE: Generated NativeLoader.java automatically load those libraries -ifeq ($(RAYLIB_LIBTYPE),SHARED) - PROJECT_SHARED_LIBS = lib/$(ANDROID_ARCH_NAME)/libraylib.so -endif - -# Compiler and archiver -# NOTE: GCC is being deprecated in Android NDK r16 -ifeq ($(ANDROID_ARCH),ARM) - CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang - AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar -endif -ifeq ($(ANDROID_ARCH),ARM64) - CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-clang - AR = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-ar -endif - -# Compiler flags for arquitecture -ifeq ($(ANDROID_ARCH),ARM) - CFLAGS = -std=c99 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -endif -ifeq ($(ANDROID_ARCH),ARM64) - CFLAGS = -std=c99 -target aarch64 -mfix-cortex-a53-835769 -endif -# Compilation functions attributes options -CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC -# Compiler options for the linker -CFLAGS += -Wall -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes -# Preprocessor macro definitions -CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=$(ANDROID_API_VERSION) - -# Paths containing required header files -INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external/android/native_app_glue - -# Linker options -LDFLAGS = -Wl,-soname,lib$(PROJECT_LIBRARY_NAME).so -Wl,--exclude-libs,libatomic.a -LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -# Force linking of library module to define symbol -LDFLAGS += -u ANativeActivity_onCreate -# Library paths containing required libs -LDFLAGS += -L. -L$(PROJECT_BUILD_PATH)/obj -L$(PROJECT_BUILD_PATH)/lib/$(ANDROID_ARCH_NAME) -L$(ANDROID_TOOLCHAIN)\sysroot\usr\lib - -# Define any libraries to link into executable -# if you want to link libraries (libname.so or libname.a), use the -lname -LDLIBS = -lm -lc -lraylib -llog -landroid -lEGL -lGLESv2 -lOpenSLES -ldl - -# Generate target objects list from PROJECT_SOURCE_FILES -OBJS = $(patsubst %.c, $(PROJECT_BUILD_PATH)/obj/%.o, $(PROJECT_SOURCE_FILES)) - -# Android APK building process... some steps required... -# NOTE: typing 'make' will invoke the default target entry called 'all', -all: create_temp_project_dirs \ - copy_project_required_libs \ - copy_project_resources \ - generate_loader_script \ - generate_android_manifest \ - generate_apk_keystore \ - config_project_package \ - compile_project_code \ - compile_project_class \ - compile_project_class_dex \ - create_project_apk_package \ - sign_project_apk_package \ - zipalign_project_apk_package - -# Create required temp directories for APK building -create_temp_project_dirs: - if not exist $(PROJECT_BUILD_PATH) mkdir $(PROJECT_BUILD_PATH) - if not exist $(PROJECT_BUILD_PATH)\obj mkdir $(PROJECT_BUILD_PATH)\obj - if not exist $(PROJECT_BUILD_PATH)\src mkdir $(PROJECT_BUILD_PATH)\src - if not exist $(PROJECT_BUILD_PATH)\src\com mkdir $(PROJECT_BUILD_PATH)\src\com - if not exist $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME) mkdir $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME) - if not exist $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)\$(APP_PRODUCT_NAME) mkdir $(PROJECT_BUILD_PATH)\src\com\$(APP_COMPANY_NAME)\$(APP_PRODUCT_NAME) - if not exist $(PROJECT_BUILD_PATH)\lib mkdir $(PROJECT_BUILD_PATH)\lib - if not exist $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME) mkdir $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME) - if not exist $(PROJECT_BUILD_PATH)\bin mkdir $(PROJECT_BUILD_PATH)\bin - if not exist $(PROJECT_BUILD_PATH)\res mkdir $(PROJECT_BUILD_PATH)\res - if not exist $(PROJECT_BUILD_PATH)\res\drawable-ldpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-ldpi - if not exist $(PROJECT_BUILD_PATH)\res\drawable-mdpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-mdpi - if not exist $(PROJECT_BUILD_PATH)\res\drawable-hdpi mkdir $(PROJECT_BUILD_PATH)\res\drawable-hdpi - if not exist $(PROJECT_BUILD_PATH)\res\values mkdir $(PROJECT_BUILD_PATH)\res\values - if not exist $(PROJECT_BUILD_PATH)\assets mkdir $(PROJECT_BUILD_PATH)\assets - if not exist $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) mkdir $(PROJECT_BUILD_PATH)\assets\$(PROJECT_RESOURCES_PATH) - if not exist $(PROJECT_BUILD_PATH)\obj\screens mkdir $(PROJECT_BUILD_PATH)\obj\screens - $(foreach dir, $(PROJECT_SOURCE_DIRS), $(call create_dir, $(dir))) - -define create_dir - if not exist $(PROJECT_BUILD_PATH)\obj\$(1) mkdir $(PROJECT_BUILD_PATH)\obj\$(1) -endef - -# Copy required shared libs for integration into APK -# NOTE: If using shared libs they are loaded by generated NativeLoader.java -copy_project_required_libs: -ifeq ($(RAYLIB_LIBTYPE),SHARED) - copy /Y $(RAYLIB_LIB_PATH)\libraylib.so $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME)\libraylib.so -endif -ifeq ($(RAYLIB_LIBTYPE),STATIC) - copy /Y $(RAYLIB_LIB_PATH)\libraylib.a $(PROJECT_BUILD_PATH)\lib\$(ANDROID_ARCH_NAME)\libraylib.a -endif - -# Copy project required resources: strings.xml, icon.png, assets -# NOTE: Required strings.xml is generated and game resources are copied to assets folder -# TODO: Review xcopy usage, it can not be found in some systems! -copy_project_resources: - copy $(APP_ICON_LDPI) $(PROJECT_BUILD_PATH)\res\drawable-ldpi\icon.png /Y - copy $(APP_ICON_MDPI) $(PROJECT_BUILD_PATH)\res\drawable-mdpi\icon.png /Y - copy $(APP_ICON_HDPI) $(PROJECT_BUILD_PATH)\res\drawable-hdpi\icon.png /Y - @echo ^<?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 diff --git a/games/just_do/just_do.c b/games/just_do/just_do.c deleted file mode 100644 index 6a73a2b3..00000000 --- a/games/just_do/just_do.c +++ /dev/null @@ -1,356 +0,0 @@ -/******************************************************************************************* -* -* JUST DO [GLOBAL GAME JAM 2015] -* -* Experimental puzzle game that lets the user try to find a logic -* solution to different shape-color-based situations. -* -* This game has been created using raylib 1.6 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2015 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; // Moved to screens.h -const int screenHeight = 720; // Moved to screens.h - -// Required variables to manage screen transitions (fade-in, fade-out) -float transAlpha = 0; -bool onTransition = false; -bool transFadeOut = false; -int transFromScreen = -1; -int transToScreen = -1; -int framesCounter = 0; - -//static Sound levelWin; -Music music; - -//---------------------------------------------------------------------------------- -// Local Functions Declaration -//---------------------------------------------------------------------------------- -void TransitionToScreen(int screen); -void UpdateTransition(void); -void DrawTransition(void); - -void UpdateDrawFrame(void); // Update and Draw one frame - -//---------------------------------------------------------------------------------- -// Main entry point -//---------------------------------------------------------------------------------- -int main(void) -{ - // Initialization (Note windowTitle is unused on Android) - //--------------------------------------------------------- - InitWindow(screenWidth, screenHeight, "JUST DO [GGJ15]"); - - // Load global data here (assets that must be available in all screens, i.e. fonts) - InitAudioDevice(); - - levelWin = LoadSound("resources/win.wav"); - music = LoadMusicStream("resources/ambient.ogg"); - - // 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 all global loaded data (i.e. fonts) here! - UnloadSound(levelWin); - UnloadMusicStream(music); - - CloseAudioDevice(); - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -} - -//---------------------------------------------------------------------------------- -// Local Functions Definition -//---------------------------------------------------------------------------------- -void TransitionToScreen(int screen) -{ - onTransition = true; - transFromScreen = currentScreen; - transToScreen = screen; -} - -void UpdateTransition(void) -{ - if (!transFadeOut) - { - transAlpha += 0.02f; - - if (transAlpha >= 1.0) - { - transAlpha = 1.0; - currentScreen = transToScreen; - transFadeOut = true; - framesCounter = 0; - } - } - else // Transition fade out logic - { - transAlpha -= 0.02f; - - if (transAlpha <= 0) - { - transAlpha = 0; - transFadeOut = false; - onTransition = false; - transFromScreen = -1; - transToScreen = -1; - } - } -} - -void DrawTransition(void) -{ - DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, transAlpha)); -} - -void UpdateDrawFrame(void) -{ - // Update - //---------------------------------------------------------------------------------- - if (currentScreen != LOGO) UpdateMusicStream(music); - - if (!onTransition) - { - if (IsKeyPressed('0')) - { - TransitionToScreen(LEVEL00); - InitLevel00Screen(); - } - else if (IsKeyPressed('1')) - { - TransitionToScreen(LEVEL01); - InitLevel01Screen(); - } - else if (IsKeyPressed('2')) - { - TransitionToScreen(LEVEL02); - InitLevel02Screen(); - } - else if (IsKeyPressed('3')) - { - TransitionToScreen(LEVEL03); - InitLevel03Screen(); - } - else if (IsKeyPressed('4')) - { - TransitionToScreen(LEVEL04); - InitLevel04Screen(); - } - else if (IsKeyPressed('5')) - { - TransitionToScreen(LEVEL05); - InitLevel05Screen(); - } - else if (IsKeyPressed('6')) - { - TransitionToScreen(LEVEL06); - InitLevel06Screen(); - } - else if (IsKeyPressed('7')) - { - TransitionToScreen(LEVEL07); - InitLevel07Screen(); - } - else if (IsKeyPressed('8')) - { - TransitionToScreen(LEVEL08); - InitLevel08Screen(); - } - else if (IsKeyPressed('9')) - { - TransitionToScreen(LEVEL09); - InitLevel08Screen(); - } - - switch(currentScreen) - { - case LOGO: - { - UpdateLogoScreen(); - - if (FinishLogoScreen()) - { - UnloadLogoScreen(); - TransitionToScreen(LEVEL00); - InitLevel00Screen(); - - PlayMusicStream(music); - SetMusicVolume(music, 0.6f); - } - } break; - case LEVEL00: - { - UpdateLevel00Screen(); - - if (FinishLevel00Screen()) - { - UnloadLevel00Screen(); - TransitionToScreen(LEVEL01); - InitLevel01Screen(); - } - } break; - case LEVEL01: - { - UpdateLevel01Screen(); - - if (FinishLevel01Screen()) - { - UnloadLevel01Screen(); - TransitionToScreen(LEVEL02); - InitLevel02Screen(); - } - } break; - case LEVEL02: - { - UpdateLevel02Screen(); - - if (FinishLevel02Screen()) - { - UnloadLevel02Screen(); - TransitionToScreen(LEVEL03); - InitLevel03Screen(); - } - } break; - case LEVEL03: - { - UpdateLevel03Screen(); - - if (FinishLevel03Screen()) - { - UnloadLevel03Screen(); - TransitionToScreen(LEVEL04); - InitLevel04Screen(); - } - } break; - case LEVEL04: - { - UpdateLevel04Screen(); - - if (FinishLevel04Screen()) - { - UnloadLevel04Screen(); - TransitionToScreen(LEVEL05); - InitLevel05Screen(); - } - } break; - case LEVEL05: - { - UpdateLevel05Screen(); - - if (FinishLevel05Screen()) - { - UnloadLevel05Screen(); - TransitionToScreen(LEVEL06); - InitLevel06Screen(); - } - } break; - case LEVEL06: - { - UpdateLevel06Screen(); - - if (FinishLevel06Screen()) - { - UnloadLevel06Screen(); - TransitionToScreen(LEVEL07); - InitLevel07Screen(); - } - } break; - case LEVEL07: - { - UpdateLevel07Screen(); - - if (FinishLevel07Screen()) - { - UnloadLevel07Screen(); - TransitionToScreen(LEVEL08); - InitLevel08Screen(); - } - } break; - case LEVEL08: - { - UpdateLevel08Screen(); - - if (FinishLevel08Screen()) - { - UnloadLevel08Screen(); - TransitionToScreen(LEVEL09); - InitLevel09Screen(); - } - } break; - case LEVEL09: - { - UpdateLevel09Screen(); - - if (FinishLevel09Screen()) - { - UnloadLevel09Screen(); - TransitionToScreen(LEVEL00); - InitLevel00Screen(); - } - } break; - default: break; - } - } - else UpdateTransition(); // Update transition (fade-in, fade-out) - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - switch(currentScreen) - { - case LOGO: DrawLogoScreen(); break; - case LEVEL00: DrawLevel00Screen(); break; - case LEVEL01: DrawLevel01Screen(); break; - case LEVEL02: DrawLevel02Screen(); break; - case LEVEL03: DrawLevel03Screen(); break; - case LEVEL04: DrawLevel04Screen(); break; - case LEVEL05: DrawLevel05Screen(); break; - case LEVEL06: DrawLevel06Screen(); break; - case LEVEL07: DrawLevel07Screen(); break; - case LEVEL08: DrawLevel08Screen(); break; - case LEVEL09: DrawLevel09Screen(); break; - default: break; - } - - if (onTransition) DrawTransition(); - - EndDrawing(); - //---------------------------------------------------------------------------------- -} diff --git a/games/just_do/resources/ambient.ogg b/games/just_do/resources/ambient.ogg Binary files differdeleted file mode 100644 index af7f836e..00000000 --- a/games/just_do/resources/ambient.ogg +++ /dev/null diff --git a/games/just_do/resources/win.wav b/games/just_do/resources/win.wav Binary files differdeleted file mode 100644 index 72520f99..00000000 --- a/games/just_do/resources/win.wav +++ /dev/null diff --git a/games/just_do/screens/screen_level00.c b/games/just_do/screens/screen_level00.c deleted file mode 100644 index e72e3812..00000000 --- a/games/just_do/screens/screen_level00.c +++ /dev/null @@ -1,167 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level00 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level00 screen global variables -static int framesCounter; -static int finishScreen; - -static Rectangle boundsU, boundsO; - -static bool mouseOverU = false; -static bool mouseOverO = false; -static bool placedU = false; -static bool placedO = false; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level00 Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Level00 Screen Initialization logic -void InitLevel00Screen(void) -{ - // Initialize Level00 screen variables here! - framesCounter = 0; - finishScreen = 0; - - boundsU = (Rectangle){GetScreenWidth()/2 - 265, -200, MeasureText("U", 160) + 40, 160 }; - boundsO = (Rectangle){GetScreenWidth() - 370, -30, MeasureText("O", 160) + 40, 160 }; -} - -// Level00 Screen Update logic -void UpdateLevel00Screen(void) -{ - // Update Level00 screen variables here! - if (!done) framesCounter++; - - if (!done) - { - if (!placedU) boundsU.y += 2; - - if (boundsU.y >= GetScreenHeight()) boundsU.y = -boundsU.height; - - Vector2 mousePos = GetMousePosition(); - - if (CheckCollisionPointRec(mousePos, boundsU)) - { - mouseOverU = true; - - if (!placedU && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - if ((boundsU.y > GetScreenHeight()/2 - 110) && ((boundsU.y + boundsU.height) < (GetScreenHeight()/2 + 100))) - { - placedU = true; - } - } - } - else mouseOverU = false; - - if (CheckCollisionPointRec(mousePos, boundsO)) - { - mouseOverO = true; - - if (!placedO && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) boundsO.y += 100; - - if (boundsO.y >= (GetScreenHeight()/2 - 130)) placedO = true; - } - else mouseOverO = false; - - if (placedO && placedU) - { - done = true; - PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 30) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level00 Screen Draw logic -void DrawLevel00Screen(void) -{ - // Draw Level00 screen - DrawText("U", boundsU.x, boundsU.y + 10, 160, GRAY); - DrawText("J", GetScreenWidth()/2 - MeasureText("JUST DO", 160)/2, GetScreenHeight()/2 - 80, 160, GRAY); - DrawText("ST D", GetScreenWidth()/2 - MeasureText("JUST DO", 160)/2 + 210, GetScreenHeight()/2 - 80, 160, GRAY); - DrawText("O", boundsO.x, boundsO.y + 10, 160, GRAY); - - DrawText("by RAMON SANTAMARIA (@raysan5)", 370, GetScreenHeight()/2 + 100, 30, Fade(LIGHTGRAY, 0.4f)); - - if (mouseOverU && !placedU) DrawRectangleLines(boundsU.x - 20, boundsU.y, boundsU.width, boundsU.height, Fade(LIGHTGRAY, 0.8f)); - //DrawRectangleBordersRec(boundsU, -20, 0, 20, Fade(RED, 0.3f)); - - if (mouseOverO && !placedO) DrawRectangleLines(boundsO.x - 20, boundsO.y, boundsO.width, boundsO.height, Fade(LIGHTGRAY, 0.8f)); - //DrawRectangleBordersRec(boundsO, -20, 0, 20, Fade(RED, 0.3f)); - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 00", GetScreenWidth()/2 - MeasureText("LEVEL 00", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 00", GetScreenWidth()/2 - MeasureText("LEVEL 00", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level00 Screen Unload logic -void UnloadLevel00Screen(void) -{ - // TODO: Unload Level00 screen variables here! -} - -// Level00 Screen should finish? -int FinishLevel00Screen(void) -{ - return finishScreen; -} - -void DrawRectangleBordersRec(Rectangle rec, int offsetX, int offsetY, int borderSize, Color col) -{ - DrawRectangle(rec.x + offsetX, rec.y + offsetY, rec.width, borderSize, col); - DrawRectangle(rec.x + offsetX, rec.y + borderSize + offsetY, borderSize, rec.height - borderSize*2, col); - DrawRectangle(rec.x + rec.width - borderSize + offsetX, rec.y + borderSize + offsetY, borderSize, rec.height - borderSize*2, col); - DrawRectangle(rec.x + offsetX, rec.y + rec.height - borderSize + offsetY, rec.width, borderSize, col); -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level01.c b/games/just_do/screens/screen_level01.c deleted file mode 100644 index 8cb76bf1..00000000 --- a/games/just_do/screens/screen_level01.c +++ /dev/null @@ -1,163 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level01 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level01 screen global variables -static int framesCounter; -static int finishScreen; - -static Rectangle innerLeftRec, outerLeftRec; -static Rectangle innerRightRec, outerRightRec; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level01 Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Level01 Screen Initialization logic -void InitLevel01Screen(void) -{ - // Initialize Level01 screen variables here! - framesCounter = 0; - finishScreen = 0; - - outerLeftRec = (Rectangle){ 0, 0, GetScreenWidth()/2, GetScreenHeight() }; - outerRightRec = (Rectangle){ GetScreenWidth()/2, 0, GetScreenWidth()/2, GetScreenHeight() }; - - innerLeftRec = (Rectangle){ GetScreenWidth()/4 - 200, GetScreenHeight()/2 - 200, 400, 400}; - innerRightRec = (Rectangle){ GetScreenWidth()/2 + GetScreenWidth()/4 - 200, GetScreenHeight()/2 - 200, 400, 400}; -} - -// Level01 Screen Update logic -void UpdateLevel01Screen(void) -{ - // Update Level01 screen - framesCounter++; - - if (!done) - { - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - if (CheckCollisionPointRec(GetMousePosition(), innerLeftRec)) - { - if (innerRightRec.width > 0) - { - innerRightRec.x += 20; - innerRightRec.y += 20; - innerRightRec.width -= 40; - innerRightRec.height -= 40; - } - } - else if (CheckCollisionPointRec(GetMousePosition(), innerRightRec)) - { - if (innerLeftRec.width > 0) - { - innerLeftRec.x += 20; - innerLeftRec.y += 20; - innerLeftRec.width -= 40; - innerLeftRec.height -= 40; - } - } - else if (CheckCollisionPointRec(GetMousePosition(), outerLeftRec)) - { - innerLeftRec.x -= 20; - innerLeftRec.y -= 20; - innerLeftRec.width += 40; - innerLeftRec.height += 40; - } - else if (CheckCollisionPointRec(GetMousePosition(), outerRightRec)) - { - innerRightRec.x -= 20; - innerRightRec.y -= 20; - innerRightRec.width += 40; - innerRightRec.height += 40; - } - } - - - if (((innerRightRec.width == 0) && (innerLeftRec.height >= GetScreenHeight())) || - ((innerLeftRec.width == 0) && (innerRightRec.height >= GetScreenHeight()))) - { - done = true; - PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level01 Screen Draw logic -void DrawLevel01Screen(void) -{ - // Draw Level01 screen - if (!levelFinished) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), LIGHTGRAY); - else DrawRectangle(60, 60, GetScreenWidth() - 120, GetScreenHeight() - 120, LIGHTGRAY); - - DrawRectangleRec(outerLeftRec, GRAY); - DrawRectangleRec(innerLeftRec, RAYWHITE); - DrawRectangleRec(outerRightRec, RAYWHITE); - DrawRectangleRec(innerRightRec, GRAY); - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 01", GetScreenWidth()/2 - MeasureText("LEVEL 01", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 01", GetScreenWidth()/2 - MeasureText("LEVEL 01", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level01 Screen Unload logic -void UnloadLevel01Screen(void) -{ - // TODO: Unload Level01 screen variables here! -} - -// Level01 Screen should finish? -int FinishLevel01Screen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level02.c b/games/just_do/screens/screen_level02.c deleted file mode 100644 index 584edcef..00000000 --- a/games/just_do/screens/screen_level02.c +++ /dev/null @@ -1,157 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level02 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -#include <math.h> - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level02 screen global variables -static int framesCounter; -static int finishScreen; - -static Vector2 bouncingBallPos; -static float bouncingBallRadius = 40; -static Vector2 bouncingBallSpeed; - -static Vector2 holeCirclePos; -static float holeCircleRadius = 50; - -static bool ballOnHole = false; - -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level02 Screen Functions Definition -//---------------------------------------------------------------------------------- -float Vector2Distance(Vector2 v1, Vector2 v2); - -// Level02 Screen Initialization logic -void InitLevel02Screen(void) -{ - // TODO: Initialize Level02 screen variables here! - framesCounter = 0; - finishScreen = 0; - - bouncingBallPos = (Vector2){ 120, 80 }; - bouncingBallSpeed = (Vector2){ 6, 8 }; - holeCirclePos = (Vector2){ GetScreenWidth()/2, GetScreenHeight()/2 }; -} - -// Level02 Screen Update logic -void UpdateLevel02Screen(void) -{ - // Update Level02 screen - framesCounter++; - - if (!ballOnHole) - { - bouncingBallPos.x += bouncingBallSpeed.x; - bouncingBallPos.y += bouncingBallSpeed.y; - - if (((bouncingBallPos.x - bouncingBallRadius) <= 0) || ((bouncingBallPos.x + bouncingBallRadius) >= GetScreenWidth())) bouncingBallSpeed.x *= -1; - if (((bouncingBallPos.y - bouncingBallRadius) <= 0) || ((bouncingBallPos.y + bouncingBallRadius) >= GetScreenHeight())) bouncingBallSpeed.y *= -1; - - Vector2 mousePos = GetMousePosition(); - - if (CheckCollisionPointCircle(mousePos, bouncingBallPos, 120)) - { - bouncingBallPos.x = GetRandomValue(80, 1200); - bouncingBallPos.y = GetRandomValue(80, 650); - } - - if (CheckCollisionPointCircle(mousePos, holeCirclePos, 120)) - { - if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) - { - holeCirclePos = mousePos; - - if ((holeCirclePos.x - holeCircleRadius) <= 0) holeCirclePos.x = holeCircleRadius; - else if ((holeCirclePos.x + holeCircleRadius) >= GetScreenWidth()) holeCirclePos.x = GetScreenWidth() - holeCircleRadius; - - if ((holeCirclePos.y - holeCircleRadius) <= 0) holeCirclePos.y = holeCircleRadius; - else if ((holeCirclePos.y + holeCircleRadius) >= GetScreenHeight()) holeCirclePos.y = GetScreenHeight() - holeCircleRadius; - } - } - - if (Vector2Distance(bouncingBallPos, holeCirclePos) < 20) - { - ballOnHole = true; - PlaySound(levelWin); - } - } - - if (ballOnHole && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level02 Screen Draw logic -void DrawLevel02Screen(void) -{ - // Draw Level02 screen - - DrawCircleV(holeCirclePos, holeCircleRadius, LIGHTGRAY); - DrawCircleV(bouncingBallPos, bouncingBallRadius, DARKGRAY); - - DrawCircleLines(bouncingBallPos.x, bouncingBallPos.y, 120, Fade(LIGHTGRAY, 0.8f)); - - - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 02", GetScreenWidth()/2 - MeasureText("LEVEL 02", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 02", GetScreenWidth()/2 - MeasureText("LEVEL 02", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level02 Screen Unload logic -void UnloadLevel02Screen(void) -{ - // TODO: Unload Level02 screen variables here! -} - -// Level02 Screen should finish? -int FinishLevel02Screen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level03.c b/games/just_do/screens/screen_level03.c deleted file mode 100644 index 7c3aa286..00000000 --- a/games/just_do/screens/screen_level03.c +++ /dev/null @@ -1,134 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level03 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level03 screen global variables -static int framesCounter; -static int finishScreen; - -static Rectangle holeRec, pieceRec; -static bool showPiece = false; -static bool pieceSelected = false; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level03 Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Level03 Screen Initialization logic -void InitLevel03Screen(void) -{ - // Initialize Level03 screen variables here! - framesCounter = 0; - finishScreen = 0; - - holeRec = (Rectangle){ GetScreenWidth()/2 - 50, GetScreenHeight()/2 - 50, 100, 100 }; - pieceRec = (Rectangle){ 200, 400, 100, 100 }; -} - -// Level03 Screen Update logic -void UpdateLevel03Screen(void) -{ - // Update Level03 screen variables here! - framesCounter++; - - Vector2 mousePos = GetMousePosition(); - - if (!done) - { - if (CheckCollisionPointRec(mousePos, holeRec)) showPiece = true; - else showPiece = false; - - if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) - { - if (CheckCollisionPointRec(mousePos, pieceRec)) - { - pieceSelected = true; - - pieceRec.x = ((int)mousePos.x - 50); - pieceRec.y = ((int)mousePos.y - 50); - } - } - - if ((pieceRec.x == holeRec.x) && !(CheckCollisionPointRec(mousePos, holeRec))) - { - done = true; - PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level03 Screen Draw logic -void DrawLevel03Screen(void) -{ - // Draw Level03 screen - DrawRectangleRec(holeRec, GRAY); - DrawRectangleRec(pieceRec, RAYWHITE); - - if (showPiece) DrawRectangleLines(pieceRec.x, pieceRec.y, pieceRec.width, pieceRec.height, Fade(LIGHTGRAY, 0.8f)); - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 03", GetScreenWidth()/2 - MeasureText("LEVEL 03", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 03", GetScreenWidth()/2 - MeasureText("LEVEL 03", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level03 Screen Unload logic -void UnloadLevel03Screen(void) -{ - // TODO: Unload Level03 screen variables here! -} - -// Level03 Screen should finish? -int FinishLevel03Screen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level04.c b/games/just_do/screens/screen_level04.c deleted file mode 100644 index 7a8a21f1..00000000 --- a/games/just_do/screens/screen_level04.c +++ /dev/null @@ -1,147 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level04 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level04 screen global variables -static int framesCounter; -static int finishScreen; - -static Vector2 circlesCenter; -static float innerCircleRadius = 40; -static float outerCircleRadius = 300; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level04 Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Level04 Screen Initialization logic -void InitLevel04Screen(void) -{ - // Initialize Level04 screen variables here! - framesCounter = 0; - finishScreen = 0; - - circlesCenter = (Vector2){ GetScreenWidth()/2, GetScreenHeight()/2 }; -} - -// Level04 Screen Update logic -void UpdateLevel04Screen(void) -{ - // Update Level04 screen variables here! - framesCounter++; - - if (!done) - { - if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) - { - if (CheckCollisionPointCircle(GetMousePosition(), circlesCenter, innerCircleRadius)) - { - innerCircleRadius += 2; - } - else if (CheckCollisionPointCircle(GetMousePosition(), circlesCenter, outerCircleRadius)) - { - outerCircleRadius += 2; - } - else - { - outerCircleRadius -= 2; - - if (outerCircleRadius <= 260) outerCircleRadius = 260; - } - } - else - { - if (!done) - { - innerCircleRadius -= 2; - if (outerCircleRadius > 300) outerCircleRadius -= 2; - } - } - - if (innerCircleRadius >= 270) innerCircleRadius = 270; - else if (innerCircleRadius <= 40) innerCircleRadius = 40; - - if (outerCircleRadius >= 600) outerCircleRadius = 600; - - if (innerCircleRadius >= outerCircleRadius) - { - done = true; - PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level04 Screen Draw logic -void DrawLevel04Screen(void) -{ - // Draw Level04 screen here! - //DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), GRAY); - DrawCircleV(circlesCenter, outerCircleRadius, GRAY); - DrawCircleV(circlesCenter, innerCircleRadius, RAYWHITE); - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 04", GetScreenWidth()/2 - MeasureText("LEVEL 04", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 04", GetScreenWidth()/2 - MeasureText("LEVEL 04", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level04 Screen Unload logic -void UnloadLevel04Screen(void) -{ - // TODO: Unload Level04 screen variables here! -} - -// Level04 Screen should finish? -int FinishLevel04Screen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level05.c b/games/just_do/screens/screen_level05.c deleted file mode 100644 index 5d5d23d6..00000000 --- a/games/just_do/screens/screen_level05.c +++ /dev/null @@ -1,185 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level05 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -#define NUM_CIRCLES 10 - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level05 screen global variables -static int framesCounter; -static int finishScreen; - -static Vector2 circleCenter; -static float circleRadius[NUM_CIRCLES]; -static bool circleLocked[NUM_CIRCLES]; -static Color circleColor[NUM_CIRCLES]; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level05 Screen Functions Definition -//---------------------------------------------------------------------------------- -static bool CheckColor(Color col1, Color col2); - -// Level05 Screen Initialization logic -void InitLevel05Screen(void) -{ - // Initialize Level05 screen variables here! - framesCounter = 0; - finishScreen = 0; - - circleCenter = (Vector2){ GetScreenWidth()/2, GetScreenHeight()/2 }; - - for (int i = 0; i < NUM_CIRCLES; i++) - { - circleRadius[i] = 760/NUM_CIRCLES*(NUM_CIRCLES - i); - circleLocked[i] = false; - } - - // That's a dirty hack to give sonme coherence to this puzzle... - circleColor[9] = GRAY; - circleColor[8] = RAYWHITE; - circleColor[7] = RAYWHITE; - circleColor[6] = GRAY; - circleColor[5] = RAYWHITE; - circleColor[4] = GRAY; - circleColor[3] = GRAY; - circleColor[2] = GRAY; - circleColor[1] = RAYWHITE; - circleColor[0] = GRAY; -} - -// Level05 Screen Update logic -void UpdateLevel05Screen(void) -{ - // Update Level05 screen variables here! - framesCounter++; - - if (!done) - { - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - for (int i = NUM_CIRCLES - 1; i >= 0; i--) - { - if (CheckCollisionPointCircle(GetMousePosition(), circleCenter, circleRadius[i])) - { - if (i == 0) - { - if (CheckColor(circleColor[8], GRAY)) circleColor[8] = RAYWHITE; - else circleColor[8] = GRAY; - } - else if (i == 2) - { - if (CheckColor(circleColor[5], GRAY)) circleColor[5] = RAYWHITE; - else circleColor[5] = GRAY; - } - else if (i == 3) - { - if (CheckColor(circleColor[6], GRAY)) circleColor[6] = RAYWHITE; - else circleColor[6] = GRAY; - } - else - { - if (CheckColor(circleColor[i], GRAY)) circleColor[i] = RAYWHITE; - else circleColor[i] = GRAY; - } - return; - } - } - } - - // Check all cicles done - for (int i = 0; i < NUM_CIRCLES; i++) - { - done = true; - - if (CheckColor(circleColor[i], RAYWHITE)) - { - done = false; - return; - } - - //if (done) PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level05 Screen Draw logic -void DrawLevel05Screen(void) -{ - // Draw Level05 screen - for (int i = 0; i < NUM_CIRCLES; i++) - { - DrawPoly(circleCenter, 64, circleRadius[i], 0.0f, circleColor[i]); - } - - - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 05", GetScreenWidth()/2 - MeasureText("LEVEL 05", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 05", GetScreenWidth()/2 - MeasureText("LEVEL 05", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level05 Screen Unload logic -void UnloadLevel05Screen(void) -{ - // TODO: Unload Level05 screen variables here! -} - -// Level05 Screen should finish? -int FinishLevel05Screen(void) -{ - return finishScreen; -} - -static bool CheckColor(Color col1, Color col2) -{ - return ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a)); -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level06.c b/games/just_do/screens/screen_level06.c deleted file mode 100644 index ec72d70c..00000000 --- a/games/just_do/screens/screen_level06.c +++ /dev/null @@ -1,156 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level06 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level06 screen global variables -static int framesCounter; -static int finishScreen; - -static Rectangle centerRec; - -static Rectangle movingRecs[4]; -static int speedRecs[4]; -static bool stoppedRec[4]; -static int mouseOverNum = -1; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level06 Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Level06 Screen Initialization logic -void InitLevel06Screen(void) -{ - // Initialize Level06 screen variables here! - framesCounter = 0; - finishScreen = 0; - - centerRec = (Rectangle){ GetScreenWidth()/2 - 100, 0, 200, GetScreenHeight() }; - - for (int i = 0; i < 4; i++) - { - movingRecs[i] = (Rectangle){ GetRandomValue(0, 5)*150, (i*150) + 90, 100, 100 }; - stoppedRec[i] = false; - speedRecs[i] = GetRandomValue(4, 8); - } -} - -// Level06 Screen Update logic -void UpdateLevel06Screen(void) -{ - // Update Level06 screen variables here! - framesCounter++; - - if (!done) - { - for (int i = 0; i < 4; i++) - { - if (!stoppedRec[i]) movingRecs[i].x += speedRecs[i]; - - if (movingRecs[i].x >= GetScreenWidth()) movingRecs[i].x = -movingRecs[i].width; - - if (CheckCollisionPointRec(GetMousePosition(), movingRecs[i])) - { - mouseOverNum = i; - - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - if (i == 0) stoppedRec[3] = !stoppedRec[3]; - else if (i == 1) stoppedRec[2] = !stoppedRec[2]; - else if (i == 2) stoppedRec[0] = !stoppedRec[0]; - else if (i == 3) stoppedRec[1] = !stoppedRec[1]; - } - } - } - - // Check if all boxes are aligned - if (((movingRecs[0].x > centerRec.x) && ((movingRecs[0].x + movingRecs[0].width) < (centerRec.x + centerRec.width))) && - ((movingRecs[1].x > centerRec.x) && ((movingRecs[1].x + movingRecs[1].width) < (centerRec.x + centerRec.width))) && - ((movingRecs[2].x > centerRec.x) && ((movingRecs[2].x + movingRecs[2].width) < (centerRec.x + centerRec.width))) && - ((movingRecs[3].x > centerRec.x) && ((movingRecs[3].x + movingRecs[3].width) < (centerRec.x + centerRec.width)))) - { - done = true; - PlaySound(levelWin); - } - } - - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level06 Screen Draw logic -void DrawLevel06Screen(void) -{ - // Draw Level06 screen - DrawRectangleRec(centerRec, LIGHTGRAY); - - for (int i = 0; i < 4; i++) - { - DrawRectangleRec(movingRecs[i], GRAY); - } - - if (!done && (mouseOverNum >= 0)) DrawRectangleLines(movingRecs[mouseOverNum].x - 5, movingRecs[mouseOverNum].y - 5, movingRecs[mouseOverNum].width + 10, movingRecs[mouseOverNum].height + 10, Fade(LIGHTGRAY, 0.8f)); - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 06", GetScreenWidth()/2 - MeasureText("LEVEL 06", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 06", GetScreenWidth()/2 - MeasureText("LEVEL 06", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level06 Screen Unload logic -void UnloadLevel06Screen(void) -{ - // TODO: Unload Level06 screen variables here! -} - -// Level06 Screen should finish? -int FinishLevel06Screen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level07.c b/games/just_do/screens/screen_level07.c deleted file mode 100644 index 2ed4f944..00000000 --- a/games/just_do/screens/screen_level07.c +++ /dev/null @@ -1,178 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level07 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level07 screen global variables -static int framesCounter; -static int finishScreen; - -static Vector2 leftCirclePos, middleCirclePos, rightCirclePos; -static Vector2 leftBtnPos, middleBtnPos, rightBtnPos; -static float circleRadius = 100; -static float btnRadius = 80; - -static bool leftCircleActive, middleCircleActive, rightCircleActive; -static Color leftCircleColor, middleCircleColor, rightCircleColor; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level07 Screen Functions Definition -//---------------------------------------------------------------------------------- -static bool CheckColor(Color col1, Color col2); - -// Level07 Screen Initialization logic -void InitLevel07Screen(void) -{ - // Initialize Level07 screen variables here! - framesCounter = 0; - finishScreen = 0; - - leftCirclePos = (Vector2){ GetScreenWidth()/2 - 340, GetScreenHeight()/2 - 100 }; - middleCirclePos = (Vector2){ GetScreenWidth()/2, GetScreenHeight()/2 - 100 }; - rightCirclePos = (Vector2){ GetScreenWidth()/2 + 340, GetScreenHeight()/2 - 100 }; - - leftBtnPos = (Vector2){ GetScreenWidth()/2 - 340, GetScreenHeight()/2 + 120 }; - middleBtnPos = (Vector2){ GetScreenWidth()/2, GetScreenHeight()/2 + 120 }; - rightBtnPos = (Vector2){ GetScreenWidth()/2 + 340, GetScreenHeight()/2 + 120 }; - - leftCircleActive = false; - middleCircleActive = true; - rightCircleActive = false; - - leftCircleColor = GRAY; - middleCircleColor = GRAY; - rightCircleColor = GRAY; -} - -// Level07 Screen Update logic -void UpdateLevel07Screen(void) -{ - // Update Level07 screen variables here! - framesCounter++; - - if (!done) - { - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - if (CheckCollisionPointCircle(GetMousePosition(), leftBtnPos, btnRadius)) leftCircleActive = !leftCircleActive; - else if (CheckCollisionPointCircle(GetMousePosition(), middleBtnPos, btnRadius)) middleCircleActive = !middleCircleActive; - else if (CheckCollisionPointCircle(GetMousePosition(), rightBtnPos, btnRadius)) rightCircleActive = !rightCircleActive; - - if (rightCircleActive && CheckCollisionPointCircle(GetMousePosition(), leftCirclePos, circleRadius)) - { - if (CheckColor(leftCircleColor, GRAY)) leftCircleColor = LIGHTGRAY; - else leftCircleColor = GRAY; - } - - if (middleCircleActive && CheckCollisionPointCircle(GetMousePosition(), middleCirclePos, circleRadius)) - { - if (CheckColor(middleCircleColor, GRAY)) middleCircleColor = LIGHTGRAY; - else middleCircleColor = GRAY; - } - - if (rightCircleActive && leftCircleActive && CheckCollisionPointCircle(GetMousePosition(), rightCirclePos, circleRadius)) - { - if (CheckColor(rightCircleColor, GRAY)) rightCircleColor = LIGHTGRAY; - else rightCircleColor = GRAY; - } - } - - // Check all cicles done - if (CheckColor(leftCircleColor, LIGHTGRAY) && CheckColor(middleCircleColor, LIGHTGRAY) && CheckColor(rightCircleColor, LIGHTGRAY) && - !leftCircleActive && !middleCircleActive && !rightCircleActive) - { - done = true; - PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level07 Screen Draw logic -void DrawLevel07Screen(void) -{ - // Draw Level07 screen here! - DrawCircleV(leftCirclePos, circleRadius, leftCircleColor); - DrawCircleV(middleCirclePos, circleRadius, middleCircleColor); - DrawCircleV(rightCirclePos, circleRadius, rightCircleColor); - - if (leftCircleActive) DrawCircleV(leftBtnPos, btnRadius, GRAY); - else DrawCircleV(leftBtnPos, btnRadius, LIGHTGRAY); - - if (middleCircleActive) DrawCircleV(middleBtnPos, btnRadius, GRAY); - else DrawCircleV(middleBtnPos, btnRadius, LIGHTGRAY); - - if (rightCircleActive) DrawCircleV(rightBtnPos, btnRadius, GRAY); - else DrawCircleV(rightBtnPos, btnRadius, LIGHTGRAY); - - - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 07", GetScreenWidth()/2 - MeasureText("LEVEL 07", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 07", GetScreenWidth()/2 - MeasureText("LEVEL 07", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level07 Screen Unload logic -void UnloadLevel07Screen(void) -{ - // TODO: Unload Level07 screen variables here! -} - -// Level07 Screen should finish? -int FinishLevel07Screen(void) -{ - return finishScreen; -} - -static bool CheckColor(Color col1, Color col2) -{ - return ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a)); -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level08.c b/games/just_do/screens/screen_level08.c deleted file mode 100644 index 1caced49..00000000 --- a/games/just_do/screens/screen_level08.c +++ /dev/null @@ -1,157 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level08 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level08 screen global variables -static int framesCounter; -static int finishScreen; - -static Rectangle leftColumnRec, middleColumnRec, rightColumnRec; -static Rectangle movingBox; -static int moveSpeed = 4; - -static bool leftColumnActive, middleColumnActive, rightColumnActive; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level08 Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Level08 Screen Initialization logic -void InitLevel08Screen(void) -{ - // TODO: Initialize Level08 screen variables here! - framesCounter = 0; - finishScreen = 0; - - movingBox = (Rectangle){ 20, GetScreenHeight()/2 - 20, 40, 40 }; - - leftColumnRec = (Rectangle){ 240, 0, 100, GetScreenHeight() }; - middleColumnRec = (Rectangle){ GetScreenWidth()/2 - 50, 0, 100, GetScreenHeight() }; - rightColumnRec = (Rectangle){ 920, 0, 100, GetScreenHeight() }; - - leftColumnActive = true; - middleColumnActive = false; - rightColumnActive = true; -} - -// Level08 Screen Update logic -void UpdateLevel08Screen(void) -{ - // Update Level08 screen variables here! - framesCounter++; - - if (!done) - { - movingBox.x += moveSpeed; - - if (movingBox.x <= 0) moveSpeed *= -1; - - if ((leftColumnActive && (CheckCollisionRecs(leftColumnRec, movingBox))) || - (middleColumnActive && (CheckCollisionRecs(middleColumnRec, movingBox))) || - (rightColumnActive && (CheckCollisionRecs(rightColumnRec, movingBox)))) moveSpeed *= -1; - - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - if (CheckCollisionPointRec(GetMousePosition(), leftColumnRec)) - { - middleColumnActive = false; - rightColumnActive = true; - } - else if (CheckCollisionPointRec(GetMousePosition(), middleColumnRec)) - { - rightColumnActive = false; - leftColumnActive = true; - } - else if (CheckCollisionPointRec(GetMousePosition(), rightColumnRec)) - { - leftColumnActive = false; - middleColumnActive = true; - } - } - - if (movingBox.x >= 1100) - { - done = true; - PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level08 Screen Draw logic -void DrawLevel08Screen(void) -{ - // Draw Level08 screen - DrawRectangle(1100, GetScreenHeight()/2 - 20, 40, 40, GRAY); - - DrawRectangleRec(movingBox, LIGHTGRAY); - - if (leftColumnActive) DrawRectangleRec(leftColumnRec, GRAY); - if (middleColumnActive) DrawRectangleRec(middleColumnRec, GRAY); - if (rightColumnActive) DrawRectangleRec(rightColumnRec, GRAY); - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 08", GetScreenWidth()/2 - MeasureText("LEVEL 08", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 08", GetScreenWidth()/2 - MeasureText("LEVEL 08", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level08 Screen Unload logic -void UnloadLevel08Screen(void) -{ - // TODO: Unload Level08 screen variables here! -} - -// Level08 Screen should finish? -int FinishLevel08Screen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level09.c b/games/just_do/screens/screen_level09.c deleted file mode 100644 index 91b0a6f7..00000000 --- a/games/just_do/screens/screen_level09.c +++ /dev/null @@ -1,199 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level09 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -#define NUM_BOXES 21 - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level09 screen global variables -static int framesCounter; -static int finishScreen; - -static Rectangle bwRecs[NUM_BOXES]; -static Color bwColors[NUM_BOXES]; -static bool activated[NUM_BOXES]; -static int resetCounter = 0; -static bool enableCounter = 0; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level09 Screen Functions Definition -//---------------------------------------------------------------------------------- -static bool CheckColor(Color col1, Color col2); - -// Level09 Screen Initialization logic -void InitLevel09Screen(void) -{ - // Initialize Level09 screen variables here! - framesCounter = 0; - finishScreen = 0; - - for (int i = 0; i < NUM_BOXES; i++) - { - bwRecs[i].x = GetScreenWidth()/7*(i%7); - bwRecs[i].y = GetScreenHeight()/3*(i/7); - bwRecs[i].width = GetScreenWidth()/7; - bwRecs[i].height = GetScreenHeight()/3; - - activated[i] = false; - - if (i%2 == 0) bwColors[i] = LIGHTGRAY; - else bwColors[i] = GRAY; - } - - bwColors[10] = RAYWHITE; -} - -// Level09 Screen Update logic -void UpdateLevel09Screen(void) -{ - // Update Level09 screen variables here! - framesCounter++; - if (enableCounter) resetCounter++; - - if (!done) - { - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - for (int i = 0; i < NUM_BOXES; i++) - { - if (CheckCollisionPointRec(GetMousePosition(), bwRecs[i])) - { - if (i == 10) - { - if (CheckColor(bwColors[i], RAYWHITE)) - { - bwColors[i] = LIGHTGRAY; - enableCounter = true; - resetCounter = 0; - activated[1] = true; - } - else - { - bwColors[i] = RAYWHITE; - enableCounter = false; - resetCounter = 5*60; - - for (int i = 0; i < NUM_BOXES; i++) activated[i] = false; - } - } - else if ((i%2 == 1) && enableCounter) - { - if (activated[i]) - { - bwColors[i] = LIGHTGRAY; - if (i != 19) activated[i + 2] = true; - } - } - } - } - } - - if (resetCounter > (4*60 + 10)) - { - for (int i = 0; i < NUM_BOXES; i++) - { - if (i%2 == 0) bwColors[i] = LIGHTGRAY; - else bwColors[i] = GRAY; - - activated[i] = false; - } - - bwColors[10] = RAYWHITE; - enableCounter = false; - resetCounter = 0; - } - - for (int i = 0; i < NUM_BOXES; i++) - { - done = true; - - if (!CheckColor(bwColors[i], LIGHTGRAY)) - { - done = false; - return; - } - - //if (done) PlaySound(levelWin); - } - } - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level09 Screen Draw logic -void DrawLevel09Screen(void) -{ - // Draw Level09 screen - for (int i = 0; i < NUM_BOXES; i++) - { - DrawRectangleRec(bwRecs[i], bwColors[i]); - } - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(RAYWHITE, 0.6f)); - DrawText("LEVEL 09", GetScreenWidth()/2 - MeasureText("LEVEL 09", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 09", GetScreenWidth()/2 - MeasureText("LEVEL 09", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level09 Screen Unload logic -void UnloadLevel09Screen(void) -{ - // TODO: Unload Level09 screen variables here! -} - -// Level09 Screen should finish? -int FinishLevel09Screen(void) -{ - return finishScreen; -} - -static bool CheckColor(Color col1, Color col2) -{ - return ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a)); -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_level10.c b/games/just_do/screens/screen_level10.c deleted file mode 100644 index f42b1e66..00000000 --- a/games/just_do/screens/screen_level10.c +++ /dev/null @@ -1,153 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Level10 Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Level10 screen global variables -static int framesCounter; -static int finishScreen; - -static Rectangle leftColumnRec, middleColumnRec, rightColumnRec; -static Rectangle movingBox; -static int moveSpeed = 4; - -static bool leftColumnActive, middleColumnActive, rightColumnActive; - -static bool done = false; -static int levelTimeSec = 0; -static bool levelFinished = false; - -//---------------------------------------------------------------------------------- -// Level10 Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Level10 Screen Initialization logic -void InitLevel10Screen(void) -{ - // TODO: Initialize Level10 screen variables here! - framesCounter = 0; - finishScreen = 0; - - movingBox = (Rectangle){ 20, GetScreenHeight()/2 - 20, 40, 40 }; - - leftColumnRec = (Rectangle){ 240, 0, 100, GetScreenHeight() }; - middleColumnRec = (Rectangle){ GetScreenWidth()/2 - 50, 0, 100, GetScreenHeight() }; - rightColumnRec = (Rectangle){ 920, 0, 100, GetScreenHeight() }; - - leftColumnActive = true; - middleColumnActive = false; - rightColumnActive = true; -} - -// Level10 Screen Update logic -void UpdateLevel10Screen(void) -{ - // Update Level10 screen variables here! - framesCounter++; - - if (!done) - { - movingBox.x += moveSpeed; - - if (movingBox.x <= 0) moveSpeed *= -1; - - if ((leftColumnActive && (CheckCollisionRecs(leftColumnRec, movingBox))) || - (middleColumnActive && (CheckCollisionRecs(middleColumnRec, movingBox))) || - (rightColumnActive && (CheckCollisionRecs(rightColumnRec, movingBox)))) moveSpeed *= -1; - - if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) - { - if (CheckCollisionPointRec(GetMousePosition(), leftColumnRec)) - { - middleColumnActive = false; - rightColumnActive = true; - } - else if (CheckCollisionPointRec(GetMousePosition(), middleColumnRec)) - { - rightColumnActive = false; - leftColumnActive = true; - } - else if (CheckCollisionPointRec(GetMousePosition(), rightColumnRec)) - { - leftColumnActive = false; - middleColumnActive = true; - } - } - } - - if (movingBox.x >= 1100) done = true; - - if (done && !levelFinished) - { - levelTimeSec = framesCounter/60; - levelFinished = true; - framesCounter = 0; - } - - if (levelFinished) - { - framesCounter++; - - if ((framesCounter > 90) && (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) finishScreen = true; - } -} - -// Level10 Screen Draw logic -void DrawLevel10Screen(void) -{ - // Draw Level10 screen - DrawRectangle(1100, GetScreenHeight()/2 - 20, 40, 40, GRAY); - - DrawRectangleRec(movingBox, LIGHTGRAY); - - if (leftColumnActive) DrawRectangleRec(leftColumnRec, GRAY); - if (middleColumnActive) DrawRectangleRec(middleColumnRec, GRAY); - if (rightColumnActive) DrawRectangleRec(rightColumnRec, GRAY); - - if (levelFinished) - { - DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f)); - DrawText("LEVEL 08", GetScreenWidth()/2 - MeasureText("LEVEL 08", 30)/2, 20, 30, GRAY); - DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY); - } - else DrawText("LEVEL 08", GetScreenWidth()/2 - MeasureText("LEVEL 08", 30)/2, 20, 30, LIGHTGRAY); -} - -// Level10 Screen Unload logic -void UnloadLevel10Screen(void) -{ - // TODO: Unload Level10 screen variables here! -} - -// Level10 Screen should finish? -int FinishLevel10Screen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screen_logo.c b/games/just_do/screens/screen_logo.c deleted file mode 100644 index 1c9a9b49..00000000 --- a/games/just_do/screens/screen_logo.c +++ /dev/null @@ -1,227 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Logo Screen Functions Definitions (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#include "raylib.h" -#include "screens.h" - -#include <string.h> - -//---------------------------------------------------------------------------------- -// Global Variables Definition (local to this module) -//---------------------------------------------------------------------------------- - -// Logo screen global variables -static int framesCounter; -static int finishScreen; - -const char msgLogoA[64] = "A simple and easy-to-use library"; -const char msgLogoB[64] = "to enjoy videogames programming"; - -int logoPositionX; -int logoPositionY; - -int raylibLettersCount = 0; - -int topSideRecWidth = 16; -int leftSideRecHeight = 16; - -int bottomSideRecWidth = 16; -int rightSideRecHeight = 16; - -char raylib[8] = " \0"; // raylib text array, max 8 letters - -int logoScreenState = 0; // Tracking animation states (State Machine) -bool msgLogoADone = false; -bool msgLogoBDone = false; - -int lettersCounter = 0; -char msgBuffer[128] = { ' ' }; - -//---------------------------------------------------------------------------------- -// Logo Screen Functions Definition -//---------------------------------------------------------------------------------- - -// Logo Screen Initialization logic -void InitLogoScreen(void) -{ - // Initialize LOGO screen variables here! - framesCounter = 0; - finishScreen = 0; - - logoPositionX = GetScreenWidth()/2 - 128; - logoPositionY = GetScreenHeight()/2 - 128; -} - -// Logo Screen Update logic -void UpdateLogoScreen(void) -{ - // Update LOGO screen - framesCounter++; // Count frames - - // Update LOGO screen variables - if (logoScreenState == 0) // State 0: Small box blinking - { - framesCounter++; - - if (framesCounter == 120) - { - logoScreenState = 1; - framesCounter = 0; // Reset counter... will be used later... - } - } - else if (logoScreenState == 1) // State 1: Top and left bars growing - { - topSideRecWidth += 4; - leftSideRecHeight += 4; - - if (topSideRecWidth == 256) logoScreenState = 2; - } - else if (logoScreenState == 2) // State 2: Bottom and right bars growing - { - bottomSideRecWidth += 4; - rightSideRecHeight += 4; - - if (bottomSideRecWidth == 256) - { - lettersCounter = 0; - for (int i = 0; i < strlen(msgBuffer); i++) msgBuffer[i] = ' '; - - logoScreenState = 3; - } - } - else if (logoScreenState == 3) // State 3: Letters appearing (one by one) - { - framesCounter++; - - // Every 12 frames, one more letter! - if ((framesCounter%12) == 0) raylibLettersCount++; - - switch (raylibLettersCount) - { - 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; - } - - if (raylibLettersCount >= 10) - { - // Write raylib description messages - if ((framesCounter%2) == 0) lettersCounter++; - - if (!msgLogoADone) - { - if (lettersCounter <= strlen(msgLogoA)) strncpy(msgBuffer, msgLogoA, lettersCounter); - else - { - for (int i = 0; i < strlen(msgBuffer); i++) msgBuffer[i] = ' '; - - lettersCounter = 0; - msgLogoADone = true; - } - } - else if (!msgLogoBDone) - { - if (lettersCounter <= strlen(msgLogoB)) strncpy(msgBuffer, msgLogoB, lettersCounter); - else - { - msgLogoBDone = true; - framesCounter = 0; - PlaySound(levelWin); - } - } - } - } - - // Wait for 2 seconds (60 frames) before jumping to TITLE screen - if (msgLogoBDone) - { - framesCounter++; - - if (framesCounter > 90) finishScreen = true; - } -} - -// Logo Screen Draw logic -void DrawLogoScreen(void) -{ - // Draw LOGO screen - if (logoScreenState == 0) - { - if ((framesCounter/15)%2) DrawRectangle(logoPositionX, logoPositionY - 60, 16, 16, BLACK); - } - else if (logoScreenState == 1) - { - DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK); - DrawRectangle(logoPositionX, logoPositionY - 60, 16, leftSideRecHeight, BLACK); - } - else if (logoScreenState == 2) - { - DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK); - DrawRectangle(logoPositionX, logoPositionY - 60, 16, leftSideRecHeight, BLACK); - - DrawRectangle(logoPositionX + 240, logoPositionY - 60, 16, rightSideRecHeight, BLACK); - DrawRectangle(logoPositionX, logoPositionY + 240 - 60, bottomSideRecWidth, 16, BLACK); - } - else if (logoScreenState == 3) - { - DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK); - DrawRectangle(logoPositionX, logoPositionY + 16 - 60, 16, leftSideRecHeight - 32, BLACK); - - DrawRectangle(logoPositionX + 240, logoPositionY + 16 - 60, 16, rightSideRecHeight - 32, BLACK); - DrawRectangle(logoPositionX, logoPositionY + 240 - 60, bottomSideRecWidth, 16, BLACK); - - DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112 - 60, 224, 224, RAYWHITE); - - DrawText(raylib, GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48 - 60, 50, BLACK); - - if (!msgLogoADone) DrawText(msgBuffer, GetScreenWidth()/2 - MeasureText(msgLogoA, 30)/2, logoPositionY + 230, 30, GRAY); - else - { - DrawText(msgLogoA, GetScreenWidth()/2 - MeasureText(msgLogoA, 30)/2, logoPositionY + 230, 30, GRAY); - - if (!msgLogoBDone) DrawText(msgBuffer, GetScreenWidth()/2 - MeasureText(msgLogoB, 30)/2, logoPositionY + 280, 30, GRAY); - else - { - DrawText(msgLogoB, GetScreenWidth()/2 - MeasureText(msgLogoA, 30)/2, logoPositionY + 280, 30, GRAY); - } - } - } -} - -// Logo Screen Unload logic -void UnloadLogoScreen(void) -{ - // TODO: Unload LOGO screen variables here! -} - -// Logo Screen should finish? -int FinishLogoScreen(void) -{ - return finishScreen; -}
\ No newline at end of file diff --git a/games/just_do/screens/screens.h b/games/just_do/screens/screens.h deleted file mode 100644 index 13bd8d72..00000000 --- a/games/just_do/screens/screens.h +++ /dev/null @@ -1,150 +0,0 @@ -/********************************************************************************************** -* -* raylib - Standard Game template -* -* Screens Functions Declarations (Init, Update, Draw, Unload) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -* This software is provided "as-is", without any express or implied warranty. In no event -* will the authors be held liable for any damages arising from the use of this software. -* -* Permission is granted to anyone to use this software for any purpose, including commercial -* applications, and to alter it and redistribute it freely, subject to the following restrictions: -* -* 1. The origin of this software must not be misrepresented; you must not claim that you -* wrote the original software. If you use this software in a product, an acknowledgment -* in the product documentation would be appreciated but is not required. -* -* 2. Altered source versions must be plainly marked as such, and must not be misrepresented -* as being the original software. -* -* 3. This notice may not be removed or altered from any source distribution. -* -**********************************************************************************************/ - -#ifndef SCREENS_H -#define SCREENS_H - -//---------------------------------------------------------------------------------- -// Types and Structures Definition -//---------------------------------------------------------------------------------- -typedef enum GameScreen { LOGO, LEVEL00, LEVEL01, LEVEL02, LEVEL03, LEVEL04, LEVEL05, LEVEL06, LEVEL07, LEVEL08, LEVEL09 } GameScreen; - -//---------------------------------------------------------------------------------- -// Global Variables Definition -//---------------------------------------------------------------------------------- -GameScreen currentScreen; -Sound levelWin; - -#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); - -//---------------------------------------------------------------------------------- -// Level00 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel00Screen(void); -void UpdateLevel00Screen(void); -void DrawLevel00Screen(void); -void UnloadLevel00Screen(void); -int FinishLevel00Screen(void); - -//---------------------------------------------------------------------------------- -// Level01 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel01Screen(void); -void UpdateLevel01Screen(void); -void DrawLevel01Screen(void); -void UnloadLevel01Screen(void); -int FinishLevel01Screen(void); - -//---------------------------------------------------------------------------------- -// Level02 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel02Screen(void); -void UpdateLevel02Screen(void); -void DrawLevel02Screen(void); -void UnloadLevel02Screen(void); -int FinishLevel02Screen(void); - -//---------------------------------------------------------------------------------- -// Level03 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel03Screen(void); -void UpdateLevel03Screen(void); -void DrawLevel03Screen(void); -void UnloadLevel03Screen(void); -int FinishLevel03Screen(void); - -//---------------------------------------------------------------------------------- -// Level04 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel04Screen(void); -void UpdateLevel04Screen(void); -void DrawLevel04Screen(void); -void UnloadLevel04Screen(void); -int FinishLevel04Screen(void); - -//---------------------------------------------------------------------------------- -// Level05 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel05Screen(void); -void UpdateLevel05Screen(void); -void DrawLevel05Screen(void); -void UnloadLevel05Screen(void); -int FinishLevel05Screen(void); - -//---------------------------------------------------------------------------------- -// Level06 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel06Screen(void); -void UpdateLevel06Screen(void); -void DrawLevel06Screen(void); -void UnloadLevel06Screen(void); -int FinishLevel06Screen(void); - -//---------------------------------------------------------------------------------- -// Level07 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel07Screen(void); -void UpdateLevel07Screen(void); -void DrawLevel07Screen(void); -void UnloadLevel07Screen(void); -int FinishLevel07Screen(void); - -//---------------------------------------------------------------------------------- -// Level08 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel08Screen(void); -void UpdateLevel08Screen(void); -void DrawLevel08Screen(void); -void UnloadLevel08Screen(void); -int FinishLevel08Screen(void); - -//---------------------------------------------------------------------------------- -// Level09 Screen Functions Declaration -//---------------------------------------------------------------------------------- -void InitLevel09Screen(void); -void UpdateLevel09Screen(void); -void DrawLevel09Screen(void); -void UnloadLevel09Screen(void); -int FinishLevel09Screen(void); - - -void DrawRectangleBordersRec(Rectangle rec, int offsetX, int offsetY, int borderSize, Color col); - -#ifdef __cplusplus -} -#endif - -#endif // SCREENS_H
\ No newline at end of file |
