Merge pull request #12 from raysan5/develop

Integration from develop branch
This commit is contained in:
Ray 2014-12-31 19:28:38 +01:00
commit 3c4a91658e
60 changed files with 9657 additions and 976 deletions

View file

@ -1,11 +1,26 @@
changelog changelog
--------- ---------
Current Release: raylib 1.2 (16 September 2014) Current Release: raylib 1.2.2 (31 December 2014)
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source. NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
NOTE: Current Release includes all previous updates. NOTE: Current Release includes all previous updates.
-----------------------------------------------
Release: raylib 1.2.2 (31 December 2014)
-----------------------------------------------
[*] Added support for HTML5 compiling (emscripten, asm.js)
[core] Corrected bug on input handling (keyboard and mouse)
[textures] Renamed function CreateTexture() to LoadTextureFromImage()
[textures] Added function ConvertToPOT()
[models] Corrected bug on DrawBillboard()
[models] Corrected bug on DrawHeightmap()
[models] Renamed LoadCubesmap() to LoadCubicmap()
[audio] Added function LoadSoundFromWave()
[makefile] Added support for Linux compiling
[stb] Updated to latest headers versions
[*] Lots of tweaks around
--------------------------------------------------------------- ---------------------------------------------------------------
Update: raylib 1.2.1 (17 October 2014) (Small Fixes Update) Update: raylib 1.2.1 (17 October 2014) (Small Fixes Update)
--------------------------------------------------------------- ---------------------------------------------------------------

View file

@ -10,6 +10,9 @@ Allegro and SDL have also been analyzed for reference.
Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm) Want to see how easy is making games with raylib? Jump to [code examples!] (http://www.raylib.com/examples.htm)
Since version 1.2.2 raylib can compile directly for web (html5) using emscripten and asm.js,
to see a demo of raylib features working on web, [check here!] (http://www.raylib.com/raylib_demo.html)
history history
------- -------
@ -83,7 +86,7 @@ features
* Powerful math module for Vector and Matrix operations [raymath] * Powerful math module for Vector and Matrix operations [raymath]
* Audio loading and playing with streaming support (WAV and OGG) * Audio loading and playing with streaming support (WAV and OGG)
* Custom color palette for fancy visuals on raywhite background * Custom color palette for fancy visuals on raywhite background
* Multiple platforms support: Windows, Linux, Mac, **Android** and **Raspberry Pi** * Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for raylib uses on its core module the outstanding [GLFW3] (http://www.glfw.org/) library. The best option by far I found for
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...). multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
@ -160,6 +163,14 @@ _Step 3._ Navigate from command line to folder raylib/template_android/ and type
NOTE: libraylib.a will be generated in folder raylib/src_android/obj/local/armeabi/, it must be copied NOTE: libraylib.a will be generated in folder raylib/src_android/obj/local/armeabi/, it must be copied
to Android project; if using raylib/template_android project, copy it to raylib/template_android/jni/libs/. to Android project; if using raylib/template_android project, copy it to raylib/template_android/jni/libs/.
**Building raylib sources for Web (HTML5)**
_Step 1._ Make sure you have installed emscripten SDK:
> Download latest version from [here].(http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) I recommend following the portable version installation instructions.
_Step 2._ TODO
building examples building examples
----------------- -----------------

View file

@ -6,16 +6,18 @@ Here it is a list of features I would like to add and functions to improve.
Around the source code there are some TODO points with pending revisions/bugs and here it is a list of features I would like to add. Around the source code there are some TODO points with pending revisions/bugs and here it is a list of features I would like to add.
This roadmap is quite outdated... a full list of all the features we are working on should be listed here at some point...
raylib v1.x raylib v1.x
- [DONE] Review Billboard Drawing functions - [DONE] Review Billboard Drawing functions
- [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model - [DONE] Review Heightmap Loading and Drawing functions - Load Heightmap directly as a Model
- Lighting support (only 3d mode) - Lighting support (only 3d mode)
- [DONE] Simple Collision Detection functions - [DONE] Simple Collision Detection functions
- Default scene Camera controls (zoom, pan, rotate) - [IN PROGRESS] Default scene Camera controls (zoom, pan, rotate)
- Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular) - Basic Procedural Image Generation (Gradient, Checked, Spot, Noise, Cellular)
- [DONE] Software mipmapping generation and POT conversion (custom implementation) - [DONE] Software mipmapping generation and POT conversion (custom implementation)
- TTF fonts support - [IN PROGRESS] TTF fonts support
Any feature missing? Do you have a request? [Let me know!][raysan5] Any feature missing? Do you have a request? [Let me know!][raysan5]

View file

@ -1,8 +1,6 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib for Raspberry Pi and Windows desktop # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
# makefile to compile raylib examples
# #
# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com) # Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
# #
@ -23,12 +21,19 @@
# #
#************************************************************************************************** #**************************************************************************************************
# define raylib platform (by default, compile for RPI) # define raylib platform to compile for
# Other possible platforms: PLATFORM_DESKTOP PLATFORM_DESKTOP_LINUX # possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
PLATFORM ?= PLATFORM_RPI # WARNING: To compile examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP
# define compiler: gcc for C program, define as g++ for C++ # define compiler: gcc for C program, define as g++ for C++
CC = gcc ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler
CC = emcc
else
# define default gcc compiler
CC = gcc
endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
@ -41,6 +46,12 @@ else
endif endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
endif
# define any directories containing required header files # define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
@ -49,10 +60,10 @@ else
endif endif
# define library paths containing required libs # define library paths containing required libs
ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../src LFLAGS = -L. -L../src -L/opt/vc/lib
else else
LFLAGS = -L. -L../src -L/opt/vc/lib LFLAGS = -L. -L../src
endif endif
# define any libraries to link into executable # define any libraries to link into executable
@ -74,6 +85,10 @@ else
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../src/libraylib.bc
endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# resources file contains windows exe icon # resources file contains windows exe icon
@ -81,6 +96,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
WINFLAGS = ../src/resources -Wl,--subsystem,windows WINFLAGS = ../src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
endif
# define all object files required # define all object files required
EXAMPLES = \ EXAMPLES = \
core_basic_window \ core_basic_window \
@ -109,7 +128,7 @@ EXAMPLES = \
models_billboard \ models_billboard \
models_obj_loading \ models_obj_loading \
models_heightmap \ models_heightmap \
models_cubesmap \ models_cubicmap \
audio_sound_loading \ audio_sound_loading \
audio_music_stream \ audio_music_stream \
#core_input_gamepad \ #core_input_gamepad \
@ -124,125 +143,125 @@ examples: $(EXAMPLES)
# compile [core] example - basic window # compile [core] example - basic window
core_basic_window: core_basic_window.c core_basic_window: core_basic_window.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - keyboard input # compile [core] example - keyboard input
core_input_keys: core_input_keys.c core_input_keys: core_input_keys.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - mouse input # compile [core] example - mouse input
core_input_mouse: core_input_mouse.c core_input_mouse: core_input_mouse.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# compile [core] example - gamepad input # compile [core] example - gamepad input
core_input_gamepad: core_input_gamepad.c core_input_gamepad: core_input_gamepad.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
endif endif
# compile [core] example - mouse wheel # compile [core] example - mouse wheel
core_mouse_wheel: core_mouse_wheel.c core_mouse_wheel: core_mouse_wheel.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - generate random values # compile [core] example - generate random values
core_random_values: core_random_values.c core_random_values: core_random_values.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - color selection (collision detection) # compile [core] example - color selection (collision detection)
core_color_select: core_color_select.c core_color_select: core_color_select.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 3d mode # compile [core] example - 3d mode
core_3d_mode: core_3d_mode.c core_3d_mode: core_3d_mode.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo (with basic shapes) # compile [shapes] example - raylib logo (with basic shapes)
shapes_logo_raylib: shapes_logo_raylib.c shapes_logo_raylib: shapes_logo_raylib.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - basic shapes usage (rectangle, circle, ...) # compile [shapes] example - basic shapes usage (rectangle, circle, ...)
shapes_basic_shapes: shapes_basic_shapes.c shapes_basic_shapes: shapes_basic_shapes.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib color palette # compile [shapes] example - raylib color palette
shapes_colors_palette: shapes_colors_palette.c shapes_colors_palette: shapes_colors_palette.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo animation # compile [shapes] example - raylib logo animation
shapes_logo_raylib_anim: shapes_logo_raylib_anim.c shapes_logo_raylib_anim: shapes_logo_raylib_anim.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - raylib logo texture loading # compile [textures] example - raylib logo texture loading
textures_logo_raylib: textures_logo_raylib.c textures_logo_raylib: textures_logo_raylib.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - image loading and conversion to texture # compile [textures] example - image loading and conversion to texture
textures_image_loading: textures_image_loading.c textures_image_loading: textures_image_loading.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture rectangle drawing # compile [textures] example - texture rectangle drawing
textures_rectangle: textures_rectangle.c textures_rectangle: textures_rectangle.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - compressed texture loading (DDS) # compile [textures] example - compressed texture loading (DDS)
textures_compressed_dds: textures_compressed_dds.c textures_compressed_dds: textures_compressed_dds.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture mipmaps generation # compile [textures] example - texture mipmaps generation
textures_mipmaps: textures_mipmaps.c textures_mipmaps: textures_mipmaps.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [textures] example - texture source and destination rectangles # compile [textures] example - texture source and destination rectangles
textures_srcrec_dstrec: textures_srcrec_dstrec.c textures_srcrec_dstrec: textures_srcrec_dstrec.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - sprite fonts loading # compile [text] example - sprite fonts loading
text_sprite_fonts: text_sprite_fonts.c text_sprite_fonts: text_sprite_fonts.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - raylib bitmap fonts (rBMF) # compile [text] example - raylib bitmap fonts (rBMF)
text_rbmf_fonts: text_rbmf_fonts.c text_rbmf_fonts: text_rbmf_fonts.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - text formatting # compile [text] example - text formatting
text_format_text: text_format_text.c text_format_text: text_format_text.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [text] example - font selection program # compile [text] example - font selection program
text_font_select: text_font_select.c text_font_select: text_font_select.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - basic geometric 3d shapes # compile [models] example - basic geometric 3d shapes
models_geometric_shapes: models_geometric_shapes.c models_geometric_shapes: models_geometric_shapes.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - basic window # compile [models] example - basic window
models_planes: models_planes.c models_planes: models_planes.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - billboard usage # compile [models] example - billboard usage
models_billboard: models_billboard.c models_billboard: models_billboard.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - OBJ model loading # compile [models] example - OBJ model loading
models_obj_loading: models_obj_loading.c models_obj_loading: models_obj_loading.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - heightmap loading # compile [models] example - heightmap loading
models_heightmap: models_heightmap.c models_heightmap: models_heightmap.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [models] example - cubesmap loading # compile [models] example - cubesmap loading
models_cubesmap: models_cubesmap.c models_cubicmap: models_cubicmap.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [audio] example - sound loading and playing (WAV and OGG) # compile [audio] example - sound loading and playing (WAV and OGG)
audio_sound_loading: audio_sound_loading.c audio_sound_loading: audio_sound_loading.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [audio] example - music stream playing (OGG) # compile [audio] example - music stream playing (OGG)
audio_music_stream: audio_music_stream.c audio_music_stream: audio_music_stream.c
$(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# clean everything # clean everything
clean: clean:
@ -253,9 +272,13 @@ else
ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX) ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX)
find . -type f -executable -delete find . -type f -executable -delete
rm -f *.o rm -f *.o
else
ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js
else else
del *.o *.exe del *.o *.exe
endif endif
endif
endif endif
@echo Cleaning done @echo Cleaning done

View file

@ -84,7 +84,7 @@ int main()
btnNextInColor = PURPLE; btnNextInColor = PURPLE;
} }
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
{ {
framesCounter = 20; // Frames button is 'active' framesCounter = 20; // Frames button is 'active'
btnNextOutColor = MAROON; btnNextOutColor = MAROON;
@ -97,8 +97,8 @@ int main()
btnNextOutColor = DARKBLUE; btnNextOutColor = DARKBLUE;
btnNextInColor = SKYBLUE; btnNextInColor = SKYBLUE;
} }
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON) && (framesCounter > 0)) framesCounter--; if (framesCounter > 0) framesCounter--;
if (framesCounter == 1) // We change font on frame 1 if (framesCounter == 1) // We change font on frame 1
{ {

210
games/floppy/floppy.c Normal file
View file

@ -0,0 +1,210 @@
/*******************************************************************************************
*
* raylib game - Floppy Bird
*
* Welcome to raylib!
*
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
* raylib official webpage: www.raylib.com
*
* Enjoy using raylib. :)
*
* This game has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
#define MAX_TUBES 100
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "Floppy Bird");
InitAudioDevice(); // Initialize audio device
Sound coin = LoadSound("resources/coin.wav");
Sound jump = LoadSound("resources/jump.wav");
Texture2D background = LoadTexture("resources/background.png");
Texture2D tubes = LoadTexture("resources/tubes.png");
Texture2D floppy = LoadTexture("resources/floppy.png");
Vector2 floppyPos = { 80, screenHeight/2 - floppy.height/2 };
Vector2 tubesPos[MAX_TUBES];
int tubesSpeedX = 2;
for (int i = 0; i < MAX_TUBES; i++)
{
tubesPos[i].x = 400 + 280*i;
tubesPos[i].y = -GetRandomValue(0, 120);
}
Rectangle tubesRecs[MAX_TUBES*2];
bool tubesActive[MAX_TUBES];
for (int i = 0; i < MAX_TUBES*2; i += 2)
{
tubesRecs[i].x = tubesPos[i/2].x;
tubesRecs[i].y = tubesPos[i/2].y;
tubesRecs[i].width = tubes.width;
tubesRecs[i].height = 255;
tubesRecs[i+1].x = tubesPos[i/2].x;
tubesRecs[i+1].y = 600 + tubesPos[i/2].y - 255;
tubesRecs[i+1].width = tubes.width;
tubesRecs[i+1].height = 255;
tubesActive[i/2] = true;
}
int backScroll = 0;
int score = 0;
int hiscore = 0;
bool gameover = false;
bool superfx = false;
SetTargetFPS(60);
//---------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
backScroll--;
if (backScroll <= -800) backScroll = 0;
for (int i = 0; i < MAX_TUBES; i++) tubesPos[i].x -= tubesSpeedX;
for (int i = 0; i < MAX_TUBES*2; i += 2)
{
tubesRecs[i].x = tubesPos[i/2].x;
tubesRecs[i+1].x = tubesPos[i/2].x;
}
if (IsKeyDown(KEY_SPACE) && !gameover) floppyPos.y -= 3;
else floppyPos.y += 1;
if (IsKeyPressed(KEY_SPACE) && !gameover) PlaySound(jump);
// Check Collisions
for (int i = 0; i < MAX_TUBES*2; i++)
{
if (CheckCollisionCircleRec((Vector2){ floppyPos.x + floppy.width/2, floppyPos.y + floppy.height/2 }, floppy.width/2, tubesRecs[i]))
{
gameover = true;
}
else if ((tubesPos[i/2].x < floppyPos.x) && tubesActive[i/2] && !gameover)
{
score += 100;
tubesActive[i/2] = false;
PlaySound(coin);
superfx = true;
if (score > hiscore) hiscore = score;
}
}
if (gameover && IsKeyPressed(KEY_ENTER))
{
for (int i = 0; i < MAX_TUBES; i++)
{
tubesPos[i].x = 400 + 280*i;
tubesPos[i].y = -GetRandomValue(0, 120);
}
for (int i = 0; i < MAX_TUBES*2; i += 2)
{
tubesRecs[i].x = tubesPos[i/2].x;
tubesRecs[i].y = tubesPos[i/2].y;
tubesRecs[i+1].x = tubesPos[i/2].x;
tubesRecs[i+1].y = 600 + tubesPos[i/2].y - 255;
tubesActive[i/2] = true;
}
floppyPos.x = 80;
floppyPos.y = screenHeight/2 - floppy.height/2;
gameover = false;
score = 0;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTexture(background, backScroll, 0, WHITE);
DrawTexture(background, screenWidth + backScroll, 0, WHITE);
if (!gameover)
{
DrawTextureEx(floppy, floppyPos, 0, 1.0, WHITE);
//DrawCircleLines(floppyPos.x + floppy.width/2, floppyPos.y + floppy.height/2, floppy.width/2, RED);
}
for (int i = 0; i < MAX_TUBES; i++)
{
if (tubesPos[i].x <= 800) DrawTextureEx(tubes, tubesPos[i], 0, 1.0, WHITE);
//DrawRectangleLines(tubesRecs[i*2].x, tubesRecs[i*2].y, tubesRecs[i*2].width, tubesRecs[i*2].height, RED);
//DrawRectangleLines(tubesRecs[i*2 + 1].x, tubesRecs[i*2 + 1].y, tubesRecs[i*2 + 1].width, tubesRecs[i*2 + 1].height, RED);
}
DrawText(FormatText("%04i", score), 20, 20, 40, PINK);
DrawText(FormatText("HI-SCORE: %04i", hiscore), 20, 70, 20, VIOLET);
if (gameover)
{
DrawText("GAME OVER", 100, 180, 100, MAROON);
DrawText("PRESS ENTER to RETRY!", 280, 280, 20, RED);
}
if (superfx)
{
DrawRectangle(0, 0, screenWidth, screenHeight, GOLD);
superfx = false;
}
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(background); // Texture unloading
UnloadTexture(tubes); // Texture unloading
UnloadTexture(floppy); // Texture unloading
UnloadSound(coin); // Unload sound data
UnloadSound(jump); // Unload sound data
CloseAudioDevice(); // Close audio device
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

123
games/raylib_demo/makefile Normal file
View file

@ -0,0 +1,123 @@
#**************************************************************************************************
#
# raylib - Basic Game
#
# makefile to compile basic game
#
# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
#
# 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 raylib platform (by default, compile for RPI)
# Other possible platform: PLATFORM_DESKTOP, PLATFORM_WEB, PLATFORM_RPI
PLATFORM ?= PLATFORM_WEB
# define compiler: gcc for C program, define as g++ for C++
ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler
CC = emcc
else
# define default gcc compiler
CC = gcc
endif
# define compiler flags:
# -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings
# -std=c99 use standard C from 1999 revision
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline
else
CFLAGS = -O1 -Wall -std=c99
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
else
INCLUDES = -I. -I../../src
endif
# define library paths containing required libs
ifeq ($(PLATFORM),PLATFORM_WEB)
LFLAGS = -L.
else
LFLAGS = -L. -L../../src -L/opt/vc/lib
endif
# define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_RPI)
# libraries for Raspberry Pi compiling
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
else
# libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../../src/libraylib.bc
endif
# define additional parameters and flags for windows
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
WINFLAGS = ../../src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
endif
# typing 'make' will invoke the first target entry in the file,
# in this case, the 'default' target entry is qidv_raylib
default: raylib_demo
# compile qidv_raylib
raylib_demo: raylib_demo.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# clean everything
clean:
ifeq ($(PLATFORM),PLATFORM_RPI)
rm -f *.o
# find . -executable -delete
else
ifeq ($(PLATFORM),PLATFORM_WEB)
del *.html *.js
else
del *.o *.exe
endif
endif
@echo Cleaning done
# instead of defining every module one by one, we can define a pattern
# this pattern below will automatically compile every module defined on $(OBJS)
#%.exe : %.c
# $(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM)

View file

@ -0,0 +1,926 @@
/*******************************************************************************************
*
* raylib - Talk: QIDV raylib (Learn Videogames Programming)
*
* Aprende a Programar Videojuegos con raylib
*
* This talk has been created using raylib v1.2 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
#include <string.h>
#include <math.h>
#define MAX_BALLS 16
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
typedef enum TalkScreen { LOADING, LOGO, MODULES, ENDING, PONG } TalkScreen;
typedef enum Modules { CORE = 0, SHAPES, TEXTURES, TEXT, MODELS, AUDIO } Modules;
//----------------------------------------------------------------------------------
// Global Variables Definition (local to this module)
//----------------------------------------------------------------------------------
int screenWidth = 1280;
int screenHeight = 720;
const char msgLoading[30] = "LOADING...";
const char msgPressEnter[30] = "Press ENTER to START";
const char msgCredits[40] = "by RAMON SANTAMARIA [@raysan5]";
const char msgWeb[30] = "www.raylib.com";
const char msgLogoA[40] = "A simple and easy-to-use library";
const char msgLogoB[40] = "to learn videogames programming";
const char msg1[50] = "THIS is a CUSTOM FONT...";
const char msg2[50] = "...and ANOTHER CUSTOM ONE...";
const char msg3[50] = "...AND ONE MORE! :)";
bool closeWindow = false;
int totalTime = 60*60*60; // fps*sec*min
int timeCounter = 0;
TalkScreen currentScreen = LOADING;
// LOADING screen variables
int loadBarWidth = 0;
int loadBarMaxWidth = 600;
// TITLE screen variables
SpriteFont fontAlagard;
SpriteFont fontPixelplay;
SpriteFont fontMecha;
SpriteFont fontSetback;
SpriteFont fontRomulus;
Vector2 pongBallPosition;
Vector2 pongBallSpeed;
Rectangle pongPlayerRec;
Rectangle pongEnemyRec;
int pongScorePlayer = 0;
int pongScoreEnemy = 0;
bool pongAutoMode = true;
int pongAutoCounter = 0;
bool pongPaused = true;
int lettersCounter = 0;
char msgBuffer[120] = { ' ' };
// LOGO screen variables
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;
// MODULES screen variables
Modules selectedModule = CORE;
Texture2D raylibWindow;
Texture2D raylibWindow01;
Texture2D raylibWindow02;
Texture2D raylibWindow03;
Texture2D platforms;
Texture2D raylibLogoB;
Texture2D lena;
Texture2D mandrill;
Texture2D texAlagard;
SpriteFont fontMechaC;
SpriteFont fontAlagardC;
SpriteFont fontJupiterC;
int coreWindow = 1;
int windowOffset = 0;
Vector2 ballPosition;
Camera camera;
Texture2D catTexture;
Model cat;
Sound fxWav;
Sound fxOgg;
Vector2 soundBallsPosition[MAX_BALLS];
Color soundBallsColor[MAX_BALLS];
bool soundBallsActive[MAX_BALLS];
float soundBallsAlpha[MAX_BALLS];
int soundBallsRadius[MAX_BALLS];
float scaleFactor = 0.0f;
float timePlayed = 0;
// ENDING screen variables
Texture2D raylibLogoA;
// 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;
//----------------------------------------------------------------------------------
// Local Functions Declaration
//----------------------------------------------------------------------------------
void TransitionToScreen(int screen);
void UpdateTransition(void);
void DrawTransition(void);
void UpdateDrawOneFrame(void);
//----------------------------------------------------------------------------------
// Main entry point
//----------------------------------------------------------------------------------
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
const char windowTitle[30] = "raylib functionality demo";
//SetupFlags(FLAG_FULLSCREEN_MODE);
InitWindow(screenWidth, screenHeight, windowTitle);
InitAudioDevice(); // Initialize audio device
// TITLE screen variables Initialization
fontAlagard = LoadSpriteFont("resources/fonts/alagard.rbmf"); // rBMF font loading
fontPixelplay = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // rBMF font loading
fontMecha = LoadSpriteFont("resources/fonts/mecha.rbmf"); // rBMF font loading
fontSetback = LoadSpriteFont("resources/fonts/setback.rbmf"); // rBMF font loading
fontRomulus = LoadSpriteFont("resources/fonts/romulus.rbmf"); // rBMF font loading
pongBallPosition = (Vector2){ screenWidth/2, screenHeight/2 + 20 };
pongBallSpeed = (Vector2){ 6, 6 };
pongPlayerRec = (Rectangle){ 20, screenHeight/2 - 50 + 40, 20, 100 };
pongEnemyRec = (Rectangle){ screenWidth - 40, screenHeight/2 - 60, 20, 120 };
// LOGO screen variables Initialization
logoPositionX = screenWidth/2 - 128;
logoPositionY = screenHeight/2 - 128;
// MODULES screen variables Initialization
raylibWindow = LoadTexture("resources/raylib_window.png");
raylibWindow01 = LoadTexture("resources/raylib_window_01.png");
raylibWindow02 = LoadTexture("resources/raylib_window_02.png");
raylibWindow03 = LoadTexture("resources/raylib_window_03.png");
platforms = LoadTexture("resources/platforms.png");
raylibLogoB = LoadTexture("resources/raylib_logo128x128.png");
lena = LoadTexture("resources/lena.png");
mandrill = LoadTexture("resources/mandrill.png");
texAlagard = LoadTexture("resources/fonts/custom_alagard.png");
fontMechaC = LoadSpriteFont("resources/fonts/custom_mecha.png");
fontAlagardC = LoadSpriteFont("resources/fonts/custom_alagard.png");
fontJupiterC = LoadSpriteFont("resources/fonts/custom_jupiter_crash.png");
ballPosition = (Vector2){ 520 + 656/2, 220 + 399/2 };
camera = (Camera){{ 0.0, 12.0, 15.0 }, { 0.0, 3.0, 0.0 }, { 0.0, 1.0, 0.0 }};
catTexture = LoadTexture("resources/catsham.png"); // Load model texture
cat = LoadModel("resources/cat.obj"); // Load OBJ model
SetModelTexture(&cat, catTexture);
fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
for (int i = 0; i < MAX_BALLS; i++)
{
soundBallsPosition[i] = (Vector2){ 650 + 560/2 + GetRandomValue(-280, 280), 220 + 200 + GetRandomValue(-200, 200) };
soundBallsColor[i] = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
soundBallsRadius[i] = GetRandomValue(2, 50);
soundBallsAlpha[i] = 1.0f;
soundBallsActive[i] = false;
}
// ENDING screen variables Initialization
raylibLogoA = LoadTexture("resources/raylib_logo.png");
#ifndef PLATFORM_WEB
SetTargetFPS(60);
#endif
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawOneFrame, 0, 1);
#else
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose() && !closeWindow) // Detect window close button or ESC key
{
UpdateDrawOneFrame();
}
#endif
// De-Initialization
//--------------------------------------------------------------------------------------
// Unload all loaded data (textures, fonts, audio)
UnloadSpriteFont(fontAlagard); // SpriteFont unloading
UnloadSpriteFont(fontPixelplay); // SpriteFont unloading
UnloadSpriteFont(fontMecha); // SpriteFont unloading
UnloadSpriteFont(fontSetback); // SpriteFont unloading
UnloadSpriteFont(fontRomulus); // SpriteFont unloading
UnloadTexture(raylibWindow);
UnloadTexture(raylibWindow01);
UnloadTexture(raylibWindow02);
UnloadTexture(raylibWindow03);
UnloadTexture(platforms);
UnloadTexture(raylibLogoA);
UnloadTexture(raylibLogoB);
UnloadTexture(lena);
UnloadTexture(mandrill);
UnloadTexture(texAlagard);
UnloadSpriteFont(fontMechaC);
UnloadSpriteFont(fontAlagardC);
UnloadSpriteFont(fontJupiterC);
UnloadTexture(catTexture);
UnloadModel(cat);
UnloadSound(fxWav);
UnloadSound(fxOgg);
CloseAudioDevice();
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
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 UpdateDrawOneFrame(void)
{
// Update
//----------------------------------------------------------------------------------
if (!onTransition)
{
switch(currentScreen)
{
case LOADING:
{
// Update LOADING screen variables
framesCounter++; // Count frames
if ((loadBarWidth < loadBarMaxWidth) && ((framesCounter%30) == 0)) loadBarWidth++;
if (IsKeyDown(KEY_SPACE) && (loadBarWidth < loadBarMaxWidth)) loadBarWidth += 4;
if (IsKeyPressed(KEY_ENTER) && (loadBarWidth >= loadBarMaxWidth)) TransitionToScreen(LOGO);
} break;
case LOGO:
{
// 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;
}
}
}
}
// Press enter to change to MODULES screen
if (IsKeyPressed(KEY_ENTER) && msgLogoBDone) TransitionToScreen(MODULES);
else if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(LOGO);
} break;
case MODULES:
{
// Update MODULES screen variables here!
framesCounter++;
if (IsKeyPressed(KEY_RIGHT) && (selectedModule < 5))
{
selectedModule++;
framesCounter = 0;
}
else if (IsKeyPressed(KEY_LEFT) && (selectedModule > 0))
{
selectedModule--;
framesCounter = 0;
}
if (selectedModule == CORE)
{
if ((framesCounter > 60) && (windowOffset < 40))
{
windowOffset++;
ballPosition.x++;
ballPosition.y++;
}
if (framesCounter > 140)
{
if (IsKeyDown('A')) ballPosition.x -= 5;
if (IsKeyDown('D')) ballPosition.x += 5;
if (IsKeyDown('W')) ballPosition.y -= 5;
if (IsKeyDown('S')) ballPosition.y += 5;
if (IsKeyPressed('1')) coreWindow = 1;
if (IsKeyPressed('2')) coreWindow = 2;
if (IsKeyPressed('3')) coreWindow = 3;
if (IsKeyPressed('4')) coreWindow = 4;
}
}
if (selectedModule == TEXTURES) scaleFactor = (sinf(2*PI/240*framesCounter) + 1.0f)/2;
if (selectedModule == AUDIO)
{
if (IsKeyPressed(KEY_SPACE) && !MusicIsPlaying()) PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
if (IsKeyPressed('S'))
{
StopMusicStream();
timePlayed = 0.0f;
for (int i = 0; i < MAX_BALLS; i++)
{
soundBallsPosition[i] = (Vector2){ 650 + 560/2 + GetRandomValue(-280, 280), 220 + 200 + GetRandomValue(-200, 200) };
soundBallsColor[i] = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
soundBallsRadius[i] = GetRandomValue(2, 50);
soundBallsAlpha[i] = 1.0f;
soundBallsActive[i] = false;
}
}
if (MusicIsPlaying())
{
timePlayed = GetMusicTimePlayed() / GetMusicTimeLength() * 100 * 4;
if ((framesCounter%10) == 0)
{
for (int i = 0; i < MAX_BALLS; i++)
{
if (!soundBallsActive[i])
{
soundBallsActive[i] = true;
break;
}
}
}
for (int i = 0; i < MAX_BALLS; i++)
{
if (soundBallsActive[i]) soundBallsAlpha[i] -= 0.005f;
if (soundBallsAlpha[i] <= 0)
{
soundBallsActive[i] = false;
// Reset ball random
soundBallsPosition[i] = (Vector2){ 650 + 560/2 + GetRandomValue(-280, 280), 220 + 200 + GetRandomValue(-200, 200) };
soundBallsColor[i] = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
soundBallsRadius[i] = GetRandomValue(2, 60);
soundBallsAlpha[i] = 1.0f;
}
}
}
if (IsKeyPressed('N')) PlaySound(fxWav);
//if (IsKeyPressed('M')) PlaySound(fxOgg);
}
// Press enter to change to ENDING screen
if (IsKeyPressed(KEY_ENTER)) TransitionToScreen(ENDING);
else if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(LOGO);
} break;
case PONG:
{
// Update SECRET screen variables here!
framesCounter++;
if (IsKeyPressed('P')) pongPaused = !pongPaused;
if (!pongPaused)
{
pongBallPosition.x += pongBallSpeed.x;
pongBallPosition.y += pongBallSpeed.y;
if ((pongBallPosition.x >= screenWidth - 5) || (pongBallPosition.x <= 5)) pongBallSpeed.x *= -1;
if ((pongBallPosition.y >= screenHeight - 5) || (pongBallPosition.y <= 5)) pongBallSpeed.y *= -1;
if (IsKeyDown(KEY_UP) || IsKeyDown('W'))
{
pongPlayerRec.y -= 5;
pongAutoMode = false;
pongAutoCounter = 180;
}
else if (IsKeyDown(KEY_DOWN) || IsKeyDown('S'))
{
pongPlayerRec.y += 5;
pongAutoMode = false;
pongAutoCounter = 180;
}
else if (pongAutoCounter > 0)
{
pongAutoCounter--;
if (pongAutoCounter == 0) pongAutoMode = true;
}
if ((pongBallPosition.x < 600) && pongAutoMode)
{
if (pongBallPosition.y > (pongPlayerRec.y + pongPlayerRec.height/2)) pongPlayerRec.y += 5;
else if (pongBallPosition.y < (pongPlayerRec.y + pongPlayerRec.height/2)) pongPlayerRec.y -= 5;
}
if (pongPlayerRec.y <= 0) pongPlayerRec.y = 0;
else if ((pongPlayerRec.y + pongPlayerRec.height) >= screenHeight) pongPlayerRec.y = screenHeight - pongPlayerRec.height;
if (pongBallPosition.x > screenWidth - 600)
{
if (pongBallPosition.y > (pongEnemyRec.y + pongEnemyRec.height/2)) pongEnemyRec.y += 5;
else if (pongBallPosition.y < (pongEnemyRec.y + pongEnemyRec.height/2)) pongEnemyRec.y -= 5;
if (pongEnemyRec.y <= 0) pongEnemyRec.y = 0;
else if ((pongEnemyRec.y + pongEnemyRec.height) >= screenHeight) pongEnemyRec.y = screenHeight - pongEnemyRec.height;
}
if ((CheckCollisionCircleRec(pongBallPosition, 10, pongPlayerRec)) || (CheckCollisionCircleRec(pongBallPosition, 10, pongEnemyRec))) pongBallSpeed.x *= -1;
if (pongBallPosition.x >= screenWidth - 5) pongScorePlayer++;
else if (pongBallPosition.x <= 5) pongScoreEnemy++;
}
// Press enter to move back to MODULES screen
if (IsKeyPressed(KEY_ENTER)) TransitionToScreen(ENDING);
if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(ENDING);
} break;
case ENDING:
{
// Update ENDING screen
framesCounter++;
// Press enter to move back to MODULES screen
if (IsKeyPressed(KEY_ENTER)) TransitionToScreen(PONG);
if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(MODULES);
} break;
default: break;
}
if ((currentScreen != LOADING) && (timeCounter < totalTime)) timeCounter++;
}
else UpdateTransition(); // Update transition (fade-in, fade-out)
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
switch(currentScreen)
{
case LOADING:
{
// Draw LOADING screen
if ((loadBarWidth < loadBarMaxWidth) && ((framesCounter/40)%2)) DrawText(msgLoading, 360, 240, 40, DARKGRAY);
DrawRectangle(360 - 4, 300 - 4, loadBarMaxWidth + 8, 60 + 8, LIGHTGRAY);
DrawRectangle(360, 300, loadBarWidth - 1, 60, DARKGRAY);
DrawRectangleLines(360 - 4, 300 - 5, loadBarMaxWidth + 8, 60 + 8, DARKGRAY);
if (loadBarWidth >= loadBarMaxWidth)
{
//DrawText(msgLoading, 360, 240, 40, DARKGRAY);
if ((framesCounter/30)%2) DrawText(msgPressEnter, screenWidth/2 - MeasureText(msgPressEnter, 40)/2 + 20, 400, 40, DARKGRAY);
}
else DrawText("PRESS SPACE to ACCELERATE LOADING! ;)", screenWidth/2 - 200, 400, 20, LIGHTGRAY);
} break;
case LOGO:
{
// 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(screenWidth/2 - 112, screenHeight/2 - 112 - 60, 224, 224, RAYWHITE);
DrawText(raylib, screenWidth/2 - 44, screenHeight/2 + 48 - 60, 50, BLACK);
if (!msgLogoADone) DrawText(msgBuffer, screenWidth/2 - MeasureText(msgLogoA, 30)/2, 460, 30, GRAY);
else
{
DrawText(msgLogoA, screenWidth/2 - MeasureText(msgLogoA, 30)/2, 460, 30, GRAY);
if (!msgLogoBDone) DrawText(msgBuffer, screenWidth/2 - MeasureText(msgLogoB, 30)/2, 510, 30, GRAY);
else
{
DrawText(msgLogoB, screenWidth/2 - MeasureText(msgLogoA, 30)/2, 510, 30, GRAY);
if ((framesCounter > 90) && ((framesCounter/30)%2)) DrawText("PRESS ENTER to CONTINUE", 930, 650, 20, GRAY);
}
}
}
} break;
case MODULES:
{
// Draw MODULES screen
DrawTexture(raylibLogoB, 40, 40, WHITE);
DrawText("raylib is composed of 6 main modules:", 128 + 40 + 30, 50, 20, GRAY);
if (framesCounter < 120)
{
if (((framesCounter/30)%2) == 0) DrawRectangle(128 + 40 + 30 - 4 + 175*selectedModule, 128 + 40 - 70 - 8 - 4, 158, 78, RED);
}
else DrawRectangle(128 + 40 + 30 - 4 + 175*selectedModule, 128 + 40 - 70 - 8 - 4, 158, 78, RED);
if (selectedModule != AUDIO)
{
DrawTriangle((Vector2){950 - 40, 685 - 10}, (Vector2){950 - 60, 685}, (Vector2){950 - 40, 685 + 10}, GRAY);
DrawTriangle((Vector2){950 - 30, 685 - 10}, (Vector2){950 - 30, 685 + 10}, (Vector2){950 - 10, 685}, GRAY);
DrawText("PRESS RIGHT or LEFT to EXPLORE MODULES", 960, 680, 10, GRAY);
}
switch (selectedModule)
{
case CORE:
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Open-Close Window", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Manage Drawing Area", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Manage Inputs", (Vector2){ 48, 290 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Manage Timming", (Vector2){ 48, 320 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Auxiliar Functions", (Vector2){ 48, 350 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
switch (coreWindow)
{
case 1: DrawTexture(raylibWindow, 520, 220, WHITE); break;
case 2: DrawTextureEx(raylibWindow01, (Vector2){ 450, 220 - 45 }, 0.0f, 4.0f, WHITE); break;
case 3: DrawTextureEx(raylibWindow02, (Vector2){ 430, 220 - 40 }, 0.0f, 4.0f, WHITE); break;
case 4: DrawTextureEx(raylibWindow03, (Vector2){ 470, 220 - 65 }, 0.0f, 4.0f, WHITE); break;
default: DrawTexture(raylibWindow, 520, 220, WHITE); break;
}
if (framesCounter > 140) DrawText("Check the possible windows raylib can run on. PRESS KEY: 1, 2, 3 or 4", 520 + 8 + windowOffset + 160, 220 + windowOffset + 10, 10, LIGHTGRAY);
DrawText("Compile raylib C code for the folowing platforms:", 48, 400, 10, MAROON);
DrawTextureRec(platforms, (Rectangle){ 0, 0, platforms.width, platforms.height}, (Vector2){ 75, 420 }, WHITE);
DrawRectangle(520 + 8 + windowOffset, 220 + 31 + windowOffset, 640, 360, RAYWHITE);
DrawRectangleLines(520 + 8 + windowOffset - 1, 220 + 31 + windowOffset - 2, 640 + 2, 360 + 2, GRAY);
DrawFPS(520 + 8 + windowOffset + 10, 220 + 31 + windowOffset + 10);
DrawRectangle(ballPosition.x - 50, ballPosition.y - 50, 100, 100, Fade(MAROON, 0.5f));
DrawRectangleRec(GetCollisionRec((Rectangle){ 520 + 8 + windowOffset - 1, 220 + 31 + windowOffset - 1, 640 + 2, 360 + 2 }, (Rectangle){ (int)ballPosition.x - 50, (int)ballPosition.y - 50, 100, 100 }), MAROON);
if (framesCounter > 140)
{
DrawTextEx(fontMecha, "MOVE ME", (Vector2){ ballPosition.x - 26, ballPosition.y - 20 }, GetFontBaseSize(fontMecha), 2, BLACK);
DrawTextEx(fontMecha, "[ W A S D ]", (Vector2){ ballPosition.x - 36, ballPosition.y }, GetFontBaseSize(fontMecha), 2, BLACK);
}
} break;
case SHAPES:
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0xcd5757ff));
DrawTextEx(fontRomulus, "Draw Basic Shapes", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0xcd5757ff));
DrawTextEx(fontRomulus, "Basic Collision Detection", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0xcd5757ff));
DrawCircle(screenWidth/4, 120 + 240, 35, DARKBLUE);
DrawCircleGradient(screenWidth/4, 220 + 240, 60, GREEN, SKYBLUE);
DrawCircleLines(screenWidth/4, 340 + 240, 80, DARKBLUE);
DrawRectangle(screenWidth/4*2 - 110, 100 + 180, 220, 100, LIME);
DrawRectangleGradient(screenWidth/4*2 - 90, 170 + 240, 180, 130, MAROON, GOLD);
DrawRectangleLines(screenWidth/4*2 - 80, 320 + 240, 160, 80, ORANGE);
DrawTriangle((Vector2){screenWidth/4*3, 60 + 220}, (Vector2){screenWidth/4*3 - 60, 160 + 220}, (Vector2){screenWidth/4*3 + 60, 160 + 220}, VIOLET);
DrawTriangleLines((Vector2){screenWidth/4*3, 140 + 220}, (Vector2){screenWidth/4*3 - 60, 210 + 260}, (Vector2){screenWidth/4*3 + 60, 210 + 260}, SKYBLUE);
DrawPoly((Vector2){screenWidth/4*3, 320 + 240}, 6, 80, 0, BROWN);
} break;
case TEXTURES:
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x60815aff));
DrawTextEx(fontRomulus, "Load Images and Textures", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x60815aff));
DrawTextEx(fontRomulus, "Draw Textures", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x60815aff));
DrawRectangle(138, 348, 260, 260, GRAY);
DrawTexturePro(lena, (Rectangle){ 0, 0, lena.width, lena.height }, (Rectangle){ 140 + 128, 350 + 128, lena.width/2*scaleFactor, lena.height/2*scaleFactor }, (Vector2){ lena.width/4*scaleFactor, lena.height/4*scaleFactor }, 0.0f, WHITE);
DrawTexture(lena, 600, 180, Fade(WHITE, 0.3f));
DrawTextureRec(lena, (Rectangle){ 225, 240, 155, 50 }, (Vector2){ 600 + 256 - 82 + 50, 180 + 241 }, PINK);
DrawTexturePro(mandrill, (Rectangle){ 0, 0, mandrill.width, mandrill.height }, (Rectangle){ screenWidth/2 - 40, 350 + 128, mandrill.width/2, mandrill.height/2 },
(Vector2){ mandrill.width/4, mandrill.height/4 }, framesCounter, GOLD);
} break;
case TEXT:
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x377764ff));
DrawTextEx(fontRomulus, "Load SpriteFonts", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x377764ff));
DrawTextEx(fontRomulus, "Draw Text", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x377764ff));
DrawTextEx(fontRomulus, "Text Formatting", (Vector2){ 48, 290 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x377764ff));
DrawTexture(texAlagard, 60, 360, WHITE);
DrawTextEx(fontMechaC, msg1, (Vector2){ 540 + 168, 210 }, GetFontBaseSize(fontMechaC), -3, WHITE);
DrawTextEx(fontAlagardC, msg2, (Vector2){ 460 + 140, 260 }, GetFontBaseSize(fontAlagardC), -2, WHITE);
DrawTextEx(fontJupiterC, msg3, (Vector2){ 640 + 70, 300 }, GetFontBaseSize(fontJupiterC), 2, WHITE);
DrawTextEx(fontAlagard, "It also includes some...", (Vector2){ 650 + 70, 400 }, GetFontBaseSize(fontAlagard)*2, 2, MAROON);
DrawTextEx(fontPixelplay, "...free fonts in rBMF format...", (Vector2){ 705 - 26, 450 }, GetFontBaseSize(fontPixelplay)*2, 4, ORANGE);
DrawTextEx(fontMecha, "...to be used even in...", (Vector2){ 700 + 40, 500 }, GetFontBaseSize(fontMecha)*2, 4, DARKGREEN);
DrawTextEx(fontSetback, "...comercial projects...", (Vector2){ 710, 550 }, GetFontBaseSize(fontSetback)*2, 4, DARKBLUE);
DrawTextEx(fontRomulus, "...completely for free!", (Vector2){ 710 + 17, 600 }, GetFontBaseSize(fontRomulus)*2, 3, DARKPURPLE);
DrawText("This is a custom font spritesheet, raylib can load it automatically!", 228, 360 + 295, 10, GRAY);
} break;
case MODELS:
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x417794ff));
DrawTextEx(fontRomulus, "Draw Geometric Models", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x417794ff));
DrawTextEx(fontRomulus, "Load 3D Models", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x417794ff));
DrawTextEx(fontRomulus, "Draw 3D Models", (Vector2){ 48, 290 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x417794ff));
Begin3dMode(camera);
DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED);
DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD);
DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON);
DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME);
DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE);
DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE);
DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN);
DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD);
DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK);
DrawModelEx(cat, (Vector3){ 8.0f, 0.0f, 2.0f }, (Vector3){ 0.0f, 0.5f*framesCounter, 0.0f }, (Vector3){ 0.1f, 0.1f, 0.1f }, WHITE);
DrawGizmo((Vector3){ 8.0f, 0.0f, 2.0f });
DrawGrid(10.0, 1.0); // Draw a grid
End3dMode();
DrawFPS(900, 220);
} break;
case AUDIO:
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x8c7539ff));
DrawTextEx(fontRomulus, "Load and Play Sounds", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x8c7539ff));
DrawTextEx(fontRomulus, "Play Music (streaming)", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x8c7539ff));
DrawText("PRESS SPACE to START PLAYING MUSIC", 135, 350, 20, GRAY);
DrawRectangle(150, 390, 400, 12, LIGHTGRAY);
DrawRectangle(150, 390, (int)timePlayed, 12, MAROON);
if (MusicIsPlaying())
{
DrawText("PRESS 'S' to STOP PLAYING MUSIC", 165, 425, 20, GRAY);
for (int i = 0; i < MAX_BALLS; i++)
{
if (soundBallsActive[i]) DrawPoly(soundBallsPosition[i], 18, soundBallsRadius[i], 0.0f, Fade(soundBallsColor[i], soundBallsAlpha[i]));
}
}
DrawText("PRESS 'N' to PLAY a SOUND", 200, 540, 20, VIOLET);
if ((framesCounter/30)%2) DrawText("PRESS ENTER to CONTINUE", 930, 650, 20, GRAY);
} break;
default: break;
}
// Draw modules menu
DrawRectangle(128 + 40 + 30, 128 + 40 - 70 - 8, 150, 70, GetColor(0x898888ff));
DrawRectangle(128 + 40 + 30 + 8, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xe1e1e1ff));
DrawText("CORE", 128 + 40 + 30 + 8 + 38, 128 + 40 - 50, 20, GetColor(0x5c5a5aff));
DrawRectangle(128 + 40 + 30 + 175, 128 + 40 - 70 - 8, 150, 70, GetColor(0xe66666ff));
DrawRectangle(128 + 40 + 30 + 8 + 175, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xf0d6d6ff));
DrawText("SHAPES", 128 + 40 + 30 + 8 + 175 + 28, 128 + 40 - 50, 20, GetColor(0xcd5757ff));
DrawRectangle(128 + 40 + 30 + 175*2, 128 + 40 - 70 - 8, 150, 70, GetColor(0x75a06dff));
DrawRectangle(128 + 40 + 30 + 8 + 175*2, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xc8eabfff));
DrawText("TEXTURES", 128 + 40 + 30 + 175*2 + 8 + 9, 128 + 40 - 50, 20, GetColor(0x60815aff));
DrawRectangle(128 + 40 + 30 + 175*3, 128 + 40 - 70 - 8, 150, 70, GetColor(0x52b296ff));
DrawRectangle(128 + 40 + 30 + 8 + 175*3, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xbef0ddff));
DrawText("TEXT", 128 + 40 + 30 + 8 + 175*3 + 38, 128 + 40 - 50, 20, GetColor(0x377764ff));
DrawRectangle(128 + 40 + 30 + 175*4, 128 + 40 - 70 - 8, 150, 70, GetColor(0x5d9cbdff));
DrawRectangle(128 + 40 + 30 + 8 + 175*4, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xbedce8ff));
DrawText("MODELS", 128 + 40 + 30 + 8 + 175*4 + 28, 128 + 40 - 50, 20, GetColor(0x417794ff));
DrawRectangle(128 + 40 + 30 + 175*5, 128 + 40 - 70 - 8, 150, 70, GetColor(0xd3b157ff));
DrawRectangle(128 + 40 + 30 + 8 + 175*5, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xebddaeff));
DrawText("AUDIO", 128 + 40 + 30 + 8 + 175*5 + 36, 128 + 40 - 50, 20, GetColor(0x8c7539ff));
} break;
case ENDING:
{
// Draw ENDING screen
DrawTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", (Vector2){ screenWidth/2 - MeasureTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", GetFontBaseSize(fontAlagard)*4, 4).x/2, 80 }, GetFontBaseSize(fontAlagard)*4, 4, MAROON);
DrawTexture(raylibLogoA, logoPositionX, logoPositionY - 40, WHITE);
DrawText(msgWeb, screenWidth/2 - MeasureText(msgWeb, 40)/2, 470, 40, DARKGRAY);
if (framesCounter > 60) DrawText(msgCredits, screenWidth/2 - MeasureText(msgCredits, 30)/2, 550, 30, GRAY);
if (framesCounter > 120) if ((framesCounter/30)%2) DrawText("PRESS ENTER to CONTINUE", screenWidth/2 - MeasureText("PRESS ENTER to CONTINUE", 20)/2, 640, 20, LIGHTGRAY);
} break;
case PONG:
{
// Pong
DrawCircleV(pongBallPosition, 10, LIGHTGRAY);
DrawRectangleRec(pongPlayerRec, GRAY);
DrawRectangleRec(pongEnemyRec, GRAY);
DrawText(FormatText("%02i", pongScorePlayer), 150, 10, 80, LIGHTGRAY);
DrawText(FormatText("%02i", pongScoreEnemy), screenWidth - MeasureText("00", 80) - 150, 10, 80, LIGHTGRAY);
if (pongPaused) if ((framesCounter/30)%2) DrawText("GAME PAUSED [P]", screenWidth/2 - 100, 40, 20, MAROON);
} break;
default: break;
}
if (currentScreen != LOADING) DrawRectangle(0, screenHeight - 10, ((float)timeCounter/(float)totalTime)*screenWidth, 10, LIGHTGRAY);
if (onTransition) DrawTransition();
EndDrawing();
//----------------------------------------------------------------------------------
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Some files were not shown because too many files have changed in this diff Show more