aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2017-03-26 23:06:17 +0200
committerGitHub <noreply@github.com>2017-03-26 23:06:17 +0200
commit5338bbf70d3e2c71fcbd0db54e14b6cf2d5616c3 (patch)
treec3a808940096983ca9753ad0d546d1567be2120b
parent2c0604aa29c720de03797ed102dfa3fe7f05f9b5 (diff)
parent90b36bd274d523eb54700f71069558b15731adb0 (diff)
downloadraylib-5338bbf70d3e2c71fcbd0db54e14b6cf2d5616c3.tar.gz
raylib-5338bbf70d3e2c71fcbd0db54e14b6cf2d5616c3.zip
Merge pull request #250 from raysan5/develop
Integrate develop branch
-rw-r--r--.gitignore13
-rw-r--r--HELPME.md2
-rw-r--r--README.md2
-rw-r--r--ROADMAP.md2
-rw-r--r--docs/examples/src/text_ttf_loading.c2
-rw-r--r--docs/helpme.html2
-rw-r--r--docs/images/rres_file_format_v1.0b.pngbin0 -> 19743 bytes
-rw-r--r--docs/images/wave_collector_gameplay.pngbin0 -> 1004094 bytes
-rw-r--r--docs/images/wave_collector_title.pngbin0 -> 1093734 bytes
-rw-r--r--docs/index.html17
-rw-r--r--examples/Makefile85
-rw-r--r--examples/audio_standalone.c2
-rw-r--r--examples/core_oculus_rift.c469
-rw-r--r--examples/text_ttf_loading.c2
-rw-r--r--games/drturtle/00_drturtle_screens.c2
-rw-r--r--games/drturtle/01_drturtle_scrolling.c2
-rw-r--r--games/drturtle/02_drturtle_player.c2
-rw-r--r--games/drturtle/03_drturtle_enemies.c2
-rw-r--r--games/drturtle/04_drturtle_gui.c22
-rw-r--r--games/drturtle/05_drturtle_audio.c22
-rw-r--r--games/drturtle/06_drturtle_final.c22
-rw-r--r--games/drturtle/drturtle_final_web.c22
-rw-r--r--games/drturtle/makefile6
-rw-r--r--games/just_do/just_do.c2
-rw-r--r--games/just_do/makefile4
-rw-r--r--games/just_do/screens/screen_level00.c2
-rw-r--r--games/just_do/screens/screen_level01.c2
-rw-r--r--games/just_do/screens/screen_level02.c2
-rw-r--r--games/just_do/screens/screen_level03.c2
-rw-r--r--games/just_do/screens/screen_level04.c2
-rw-r--r--games/just_do/screens/screen_level05.c2
-rw-r--r--games/just_do/screens/screen_level06.c2
-rw-r--r--games/just_do/screens/screen_level07.c2
-rw-r--r--games/just_do/screens/screen_level08.c2
-rw-r--r--games/just_do/screens/screen_level09.c2
-rw-r--r--games/just_do/screens/screen_level10.c2
-rw-r--r--games/just_do/screens/screen_logo.c2
-rw-r--r--games/just_do/screens/screens.h2
-rw-r--r--games/light_my_ritual/light_my_ritual.c2
-rw-r--r--games/light_my_ritual/makefile9
-rw-r--r--games/light_my_ritual/screens/screen_gameplay.c8
-rw-r--r--games/light_my_ritual/screens/screen_logo_raylib.c2
-rw-r--r--games/light_my_ritual/screens/screen_title.c6
-rw-r--r--games/light_my_ritual/screens/screens.h2
-rw-r--r--games/raylib_demo/makefile4
-rw-r--r--games/raylib_demo/raylib_demo.c60
-rw-r--r--games/skully_escape/makefile4
-rw-r--r--games/skully_escape/monster.c2
-rw-r--r--games/skully_escape/monster.h2
-rw-r--r--games/skully_escape/player.c2
-rw-r--r--games/skully_escape/screens/screen_aisle01.c10
-rw-r--r--games/skully_escape/screens/screen_aisle02.c10
-rw-r--r--games/skully_escape/screens/screen_armory.c10
-rw-r--r--games/skully_escape/screens/screen_attic.c10
-rw-r--r--games/skully_escape/screens/screen_bathroom.c10
-rw-r--r--games/skully_escape/screens/screen_ending.c8
-rw-r--r--games/skully_escape/screens/screen_kitchen.c10
-rw-r--r--games/skully_escape/screens/screen_livingroom.c10
-rw-r--r--games/skully_escape/screens/screen_logo.c2
-rw-r--r--games/skully_escape/screens/screen_logo_raylib.c2
-rw-r--r--games/skully_escape/screens/screen_title.c2
-rw-r--r--games/skully_escape/screens/screens.h2
-rw-r--r--games/skully_escape/skully_escape.c2
-rw-r--r--games/wave_collector/Makefile2
-rw-r--r--games/wave_collector/screens/screen_ending.c8
-rw-r--r--games/wave_collector/screens/screen_gameplay.c14
-rw-r--r--games/wave_collector/screens/screen_logo.c2
-rw-r--r--games/wave_collector/screens/screen_title.c4
-rw-r--r--games/wave_collector/screens/screens.h2
-rw-r--r--games/wave_collector/wave_collector.c2
-rw-r--r--src/Makefile36
-rw-r--r--src/audio.c131
-rw-r--r--src/audio.h40
-rw-r--r--src/camera.h4
-rw-r--r--src/core.c77
-rw-r--r--src/easings.h2
-rw-r--r--src/gestures.h8
-rw-r--r--src/models.c32
-rw-r--r--src/physac.h6
-rw-r--r--src/raylib.h81
-rw-r--r--src/raymath.h2
-rw-r--r--src/rlgl.c765
-rw-r--r--src/rlgl.h60
-rw-r--r--src/rres.h4
-rw-r--r--src/shapes.c44
-rw-r--r--src/text.c62
-rw-r--r--src/textures.c347
-rw-r--r--src/utils.c64
-rw-r--r--src/utils.h13
-rw-r--r--templates/advance_game/Makefile2
-rw-r--r--templates/advance_game/advance_game.c2
-rw-r--r--templates/advance_game/screens/screen_ending.c2
-rw-r--r--templates/advance_game/screens/screen_gameplay.c2
-rw-r--r--templates/advance_game/screens/screen_logo.c2
-rw-r--r--templates/advance_game/screens/screen_options.c2
-rw-r--r--templates/advance_game/screens/screen_title.c2
-rw-r--r--templates/advance_game/screens/screens.h2
-rw-r--r--templates/android_project/jni/basic_game.c2
-rw-r--r--templates/basic_game/Makefile2
-rw-r--r--templates/basic_test/Makefile2
-rw-r--r--templates/basic_test/basic_test.c2
-rw-r--r--templates/simple_game/Makefile2
-rw-r--r--templates/simple_game/screens.c2
-rw-r--r--templates/simple_game/screens.h2
-rw-r--r--templates/simple_game/simple_game.c2
-rw-r--r--templates/standard_game/Makefile2
-rw-r--r--templates/standard_game/screens/screen_ending.c2
-rw-r--r--templates/standard_game/screens/screen_gameplay.c2
-rw-r--r--templates/standard_game/screens/screen_logo.c2
-rw-r--r--templates/standard_game/screens/screen_options.c2
-rw-r--r--templates/standard_game/screens/screen_title.c2
-rw-r--r--templates/standard_game/screens/screens.h2
-rw-r--r--templates/standard_game/standard_game.c2
113 files changed, 1568 insertions, 1215 deletions
diff --git a/.gitignore b/.gitignore
index a41d3741..827d3764 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@
# Ignore VIM's backup generated files
*.swp
+*.swo
+*~
# Ignore Android generated files and folders
src_android/obj/
@@ -62,6 +64,17 @@ examples/*
# Unignore examples Makefile
!examples/Makefile
+# Ignore all games files
+games/*
+# Unignore all games dirs
+!games/*/
+# Unignore all games files with extension
+!games/*.c
+!games/*.lua
+!games/*.png
+# Unignore games makefile
+!games/makefile
+
# Ignore files build by xcode
*.mode*v*
*.pbxuser
diff --git a/HELPME.md b/HELPME.md
index a58dca55..85f60c45 100644
--- a/HELPME.md
+++ b/HELPME.md
@@ -34,4 +34,4 @@ contact
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
-[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
+[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
diff --git a/README.md b/README.md
index 85ad7943..b868172e 100644
--- a/README.md
+++ b/README.md
@@ -278,4 +278,4 @@ contributing (in some way or another) to make raylib project better. Huge thanks
Please, if I forget someone in this list, excuse me and write me an email to remind me to add you!
-[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
+[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
diff --git a/ROADMAP.md b/ROADMAP.md
index a7d51f0d..d0682f4a 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -44,5 +44,5 @@ raylib 1.4
Any feature missing? Do you have a request? [Let me know!][raysan5]
-[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
+[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
[isssues]: https://github.com/raysan5/raylib/issues
diff --git a/docs/examples/src/text_ttf_loading.c b/docs/examples/src/text_ttf_loading.c
index 918209dd..33cda7f5 100644
--- a/docs/examples/src/text_ttf_loading.c
+++ b/docs/examples/src/text_ttf_loading.c
@@ -5,7 +5,7 @@
* This example has been created using raylib 1.3.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* Copyright (c) 2015 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/docs/helpme.html b/docs/helpme.html
index c692077b..1948c623 100644
--- a/docs/helpme.html
+++ b/docs/helpme.html
@@ -53,7 +53,7 @@
<div class="content">
<p>I’m working hard on raylib but my resources are quite limited.
- If you enjoy raylib and want to help / contribute, please, <a class="simplelink" href="mailto:raysan@raysanweb.com?subject=Hey! I want to help/contribute!"><strong>let me know</strong></a>.</p>
+ If you enjoy raylib and want to help / contribute, please, <a class="simplelink" href="mailto:ray@raylib.com?subject=Hey! I want to help/contribute!"><strong>let me know</strong></a>.</p>
<br>
<p>The following help is highly appreciated:</p>
<br>
diff --git a/docs/images/rres_file_format_v1.0b.png b/docs/images/rres_file_format_v1.0b.png
new file mode 100644
index 00000000..a70af68c
--- /dev/null
+++ b/docs/images/rres_file_format_v1.0b.png
Binary files differ
diff --git a/docs/images/wave_collector_gameplay.png b/docs/images/wave_collector_gameplay.png
new file mode 100644
index 00000000..c74ad744
--- /dev/null
+++ b/docs/images/wave_collector_gameplay.png
Binary files differ
diff --git a/docs/images/wave_collector_title.png b/docs/images/wave_collector_title.png
new file mode 100644
index 00000000..3456caca
--- /dev/null
+++ b/docs/images/wave_collector_title.png
Binary files differ
diff --git a/docs/index.html b/docs/index.html
index d177dca2..847e4346 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -108,7 +108,7 @@
- Multiplatform support: Android, Raspberry Pi, HTML5, Oculus Rift CV1<br>
- Custom color palette for fancy visuals on raywhite background<br>
- Minimal external dependencies (GLFW3, OpenGL, OpenAL)<br>
- - Complete binding to Lua: [<a class="simplelink" href="https://github.com/raysan5/raylib/blob/master/src/rlua.h" target="_blank">rlua</a>]<br>
+ - Complete binding to <a class="simplelink" href="https://github.com/raysan5/raylib-lua" target="_blank">Lua</a>, <a class="simplelink" href="https://github.com/gen2brain/raylib-go" target="_blank">Go</a> and Pascal.<br>
</div>
<br>
<a href="images/raylib_architecture.png"><img src="images/raylib_architecture.png" alt="raylib architechture" width="800" height="450"/></a>
@@ -120,16 +120,21 @@
<strong>raylib supporters on patreon</strong>
<p>The following people is supporting raylib project on <a class="simplelink" href="https://www.patreon.com/raysan5" target="_blank">patreon</a>. Many thanks to all of them for believing in the project and contributing to it.</p>
<br>
+ <p> - Jarrod - 2drealms (<a class="simplelink" href="https://twitter.com/2drealms" target="_blank">@2drealms</a>)</p>
+ <p> - Kovay Hatfield</p>
<p> - Pau Fernandez (<a class="simplelink" href="https://twitter.com/pauek" target="_blank">@pauek</a>)</p>
- <p> - Marcelo Paez (<a class="simplelink" href="https://twitter.com/paezao" target="_blank">@paezao</a>)</p>
+ <p> - Chris Johnson</p>
+ <p> - Joel Davis (<a class="simplelink" href="https://twitter.com/joeld42" target="_blank">@joeld42</a>)</p>
+ <p> - Charles Nicosia</p>
<p> - Rajasekaran Senthil (<a class="simplelink" href="https://twitter.com/rskgames" target="_blank">@rskgames</a>)</p>
<p> - Adrian Guerrero</p>
<p> - Dani Gómez</p>
- <p> - Marc Agüera</p>
- <p> - Sergio Martínez</p>
- <p> - Evan</p>
+ <p> - Justin Hamilton</p>
+ <p> - Antonio Radovcic</p>
+ <p> - James W. Bohnke</p>
+ <p> - Evan Sirchuk</p>
<br>
- <p>And a very special thanks to <strong>Ilya Zarembsky</strong> for his generous contribution. Many thanks Ilya! Hope your students enjoy raylib! :D</p>
+ <p>And a very special thanks to <strong>Ilya Zarembsky</strong> (<a class="simplelink" href="https://twitter.com/wly_cdgr" target="_blank">@wly_cdgr</a>) for his generous contribution. Many thanks Ilya! Hope your students are enjoying raylib! :D</p>
</div>
<div class="footer">
diff --git a/examples/Makefile b/examples/Makefile
index 98129990..22438f2f 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -5,15 +5,15 @@
# NOTE: By default examples are compiled using raylib static library and OpenAL Soft shared library
#
# Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
-#
-# This software is provided "as-is", without any express or implied warranty. In no event
+#
+# 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
+# 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
+# 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
@@ -66,21 +66,34 @@ endif
endif
# define compiler flags:
-# -O2 defines optimization level
-# -s strip unnecessary data from build
-# -Wall turns on most, but not all, compiler warnings
-# -std=c99 use standard C from 1999 revision
-ifeq ($(PLATFORM),PLATFORM_RPI)
- CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
-else
- CFLAGS = -O2 -s -Wall -std=c99
+# -O2 defines optimization level
+# -Og enable debugging
+# -s strip unnecessary data from build
+# -Wall turns on most, but not all, compiler warnings
+# -std=c99 defines C language mode (standard C from 1999 revision)
+# -std=gnu99 defines C language mode (GNU C from 1999 revision)
+# -fgnu89-inline declaring inline functions support (GCC optimized)
+# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
+# -D_DEFAULT_SOURCE use with -std=c99 on Linux to enable timespec and drflac
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(PLATFORM_OS),WINDOWS)
+ CFLAGS = -O2 -s -Wall -std=c99
+ endif
+ ifeq ($(PLATFORM_OS),LINUX)
+ CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
+ endif
+ ifeq ($(PLATFORM_OS),OSX)
+ CFLAGS = -O2 -s -Wall -std=c99
+ endif
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
-
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
+endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define raylib release directory for compiled library
@@ -110,9 +123,7 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux
- ifeq ($(PLATFORM_OS),LINUX)
- INCLUDES += -I/usr/local/include/raylib/
- else ifeq ($(PLATFORM_OS),WINDOWS)
+ ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries headers
# GLFW3
INCLUDES += -I../src/external/glfw3/include
@@ -207,7 +218,6 @@ EXAMPLES = \
core_3d_camera_first_person \
core_2d_camera \
core_world_screen \
- core_oculus_rift \
shapes_logo_raylib \
shapes_basic_shapes \
shapes_colors_palette \
@@ -327,19 +337,19 @@ core_3d_camera_free: core_3d_camera_free.c
# compile [core] example - 3d camera first person
core_3d_camera_first_person: core_3d_camera_first_person.c
- $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
+ $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - 2d camera
core_2d_camera: core_2d_camera.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [core] example - world screen
core_world_screen: core_world_screen.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [core] example - oculus rift
-core_oculus_rift: core_oculus_rift.c
- $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
+#core_oculus_rift: core_oculus_rift.c
+# $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# compile [shapes] example - raylib logo (with basic shapes)
shapes_logo_raylib: shapes_logo_raylib.c
@@ -376,31 +386,31 @@ textures_srcrec_dstrec: textures_srcrec_dstrec.c
# compile [textures] example - texture to image
textures_to_image: textures_to_image.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [textures] example - texture raw data
textures_raw_data: textures_raw_data.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [textures] example - texture formats loading
textures_formats_loading: textures_formats_loading.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [textures] example - texture particles trail blending
textures_particles_trail_blending: textures_particles_trail_blending.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [textures] example - texture image processing
textures_image_processing: textures_image_processing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [textures] example - texture image drawing
textures_image_drawing: textures_image_drawing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [text] example - sprite fonts loading
text_sprite_fonts: text_sprite_fonts.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [text] example - bmfonts and ttf loading
text_bmfont_ttf: text_bmfont_ttf.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
@@ -436,7 +446,7 @@ models_geometric_shapes: models_geometric_shapes.c
# compile [models] example - box collisions
models_box_collisions: models_box_collisions.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [models] example - basic window
models_planes: models_planes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
@@ -464,15 +474,15 @@ models_ray_picking: models_ray_picking.c
# compile [shaders] example - model shader
shaders_model_shader: shaders_model_shader.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [shaders] example - shapes texture shader
shaders_shapes_textures: shaders_shapes_textures.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [shaders] example - custom uniform in shader
shaders_custom_uniform: shaders_custom_uniform.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-
+
# compile [shaders] example - postprocessing shader
shaders_postprocessing: shaders_postprocessing.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
@@ -497,13 +507,6 @@ audio_module_playing: audio_module_playing.c
audio_raw_stream: audio_raw_stream.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
-# Linux Fix to timespect from
-ifeq ($(PLATFORM),PLATFORM_DESKTOP)
- ifeq ($(PLATFORM_OS),LINUX)
- CFLAGS += -D_POSIX_C_SOURCE=199309L
- endif
-endif
-
# compile [physac] example - physics demo
physics_demo: physics_demo.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
@@ -523,7 +526,7 @@ physics_restitution: physics_restitution.c
# compile [physac] example - physics shatter
physics_shatter: physics_shatter.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -lpthread -D$(PLATFORM) $(WINFLAGS)
-
+
# fix dylib install path name for each executable (MAC)
fix_dylib:
ifeq ($(PLATFORM_OS),OSX)
diff --git a/examples/audio_standalone.c b/examples/audio_standalone.c
index d090bb83..3edf8895 100644
--- a/examples/audio_standalone.c
+++ b/examples/audio_standalone.c
@@ -29,7 +29,7 @@
#endif
#include "audio.h"
-#if defined(__linux)
+#if defined(__linux__)
#include <stdio.h>
#include <termios.h>
diff --git a/examples/core_oculus_rift.c b/examples/core_oculus_rift.c
index eb628cd7..f1b0bd3b 100644
--- a/examples/core_oculus_rift.c
+++ b/examples/core_oculus_rift.c
@@ -3,7 +3,12 @@
* raylib [core] example - Oculus Rift CV1
*
* Compile example using:
-* gcc -o $(NAME_PART).exe $(FILE_NAME) -L. -L..\src\external\OculusSDK\LibOVR -lLibOVRRT32_1 -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99
+* gcc -o $(NAME_PART).exe $(FILE_NAME) -I..\src\external -I..\src\external\OculusSDK\LibOVR\Include /
+* -L. -L..\src\external\OculusSDK\LibOVR -lLibOVRRT32_1 -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99 /
+* -Wl,-allow-multiple-definition
+*
+* #define SUPPORT_OCULUS_RIFT_CV1 / RLGL_OCULUS_SUPPORT
+* Enable Oculus Rift CV1 functionality
*
* This example has been created using raylib 1.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@@ -14,6 +19,95 @@
#include "raylib.h"
+#include "glad.h" // Required for: OpenGL types and functions declarations
+#include "raymath.h" // Required for: Vector3, Quaternion and Matrix functionality
+
+#include <string.h> // Required for: memset()
+#include <stdlib.h> // Required for: exit()
+#include <stdio.h> // required for: vfprintf()
+#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
+
+#define RLGL_OCULUS_SUPPORT // Enable Oculus Rift code
+#if defined(RLGL_OCULUS_SUPPORT)
+ #include "OVR_CAPI_GL.h" // Oculus SDK for OpenGL
+#endif
+
+//----------------------------------------------------------------------------------
+// Defines and Macros
+//----------------------------------------------------------------------------------
+// ...
+
+//----------------------------------------------------------------------------------
+// Types and Structures Definition
+//----------------------------------------------------------------------------------
+
+// TraceLog message types
+typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
+
+#if defined(RLGL_OCULUS_SUPPORT)
+// Oculus buffer type
+typedef struct OculusBuffer {
+ ovrTextureSwapChain textureChain;
+ GLuint depthId;
+ GLuint fboId;
+ int width;
+ int height;
+} OculusBuffer;
+
+// Oculus mirror texture type
+typedef struct OculusMirror {
+ ovrMirrorTexture texture;
+ GLuint fboId;
+ int width;
+ int height;
+} OculusMirror;
+
+// Oculus layer type
+typedef struct OculusLayer {
+ ovrViewScaleDesc viewScaleDesc;
+ ovrLayerEyeFov eyeLayer; // layer 0
+ //ovrLayerQuad quadLayer; // TODO: layer 1: '2D' quad for GUI
+ Matrix eyeProjections[2];
+ int width;
+ int height;
+} OculusLayer;
+#endif
+
+//----------------------------------------------------------------------------------
+// Global Variables Definition
+//----------------------------------------------------------------------------------
+#if defined(RLGL_OCULUS_SUPPORT)
+// OVR device variables
+static ovrSession session; // Oculus session (pointer to ovrHmdStruct)
+static ovrHmdDesc hmdDesc; // Oculus device descriptor parameters
+static ovrGraphicsLuid luid; // Oculus locally unique identifier for the program (64 bit)
+static OculusLayer layer; // Oculus drawing layer (similar to photoshop)
+static OculusBuffer buffer; // Oculus internal buffers (texture chain and fbo)
+static OculusMirror mirror; // Oculus mirror texture and fbo
+static unsigned int frameIndex = 0; // Oculus frames counter, used to discard frames from chain
+#endif
+
+//----------------------------------------------------------------------------------
+// Module specific Functions Declaration
+//----------------------------------------------------------------------------------
+#if defined(RLGL_OCULUS_SUPPORT)
+static bool InitOculusDevice(void); // Initialize Oculus device (returns true if success)
+static void CloseOculusDevice(void); // Close Oculus device
+static void UpdateOculusTracking(Camera *camera); // Update Oculus head position-orientation tracking
+static void BeginOculusDrawing(void); // Setup Oculus buffers for drawing
+static void EndOculusDrawing(void); // Finish Oculus drawing and blit framebuffer to mirror
+
+static OculusBuffer LoadOculusBuffer(ovrSession session, int width, int height); // Load Oculus required buffers
+static void UnloadOculusBuffer(ovrSession session, OculusBuffer buffer); // Unload texture required buffers
+static OculusMirror LoadOculusMirror(ovrSession session, int width, int height); // Load Oculus mirror buffers
+static void UnloadOculusMirror(ovrSession session, OculusMirror mirror); // Unload Oculus mirror buffers
+static void BlitOculusMirror(ovrSession session, OculusMirror mirror); // Copy Oculus screen buffer to mirror texture
+static OculusLayer InitOculusLayer(ovrSession session); // Init Oculus layer (similar to photoshop)
+static Matrix FromOvrMatrix(ovrMatrix4f ovrM); // Convert from Oculus ovrMatrix4f struct to raymath Matrix struct
+#endif
+
+static void TraceLog(int msgType, const char *text, ...);
+
int main()
{
// Initialization
@@ -25,8 +119,9 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
- // NOTE: If device is not available, it fallbacks to default device (simulator)
- InitVrDevice(HMD_OCULUS_RIFT_CV1); // Init VR device (Oculus Rift CV1)
+ bool vrDeviceReady = InitOculusDevice(); // Init VR device Oculus Rift CV1
+
+ if (!vrDeviceReady) InitVrSimulator(HMD_OCULUS_RIFT_CV1); // Init VR simulator if device fails
// Define the camera to look into our 3d world
Camera camera;
@@ -47,10 +142,10 @@ int main()
{
// Update
//----------------------------------------------------------------------------------
- if (IsVrSimulator()) UpdateCamera(&camera); // Update camera (simulator mode)
- else if (IsVrDeviceReady()) UpdateVrTracking(&camera); // Update camera with device tracking data
-
- if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
+ if (!vrDeviceReady) UpdateCamera(&camera); // Update camera (simulator mode)
+ else UpdateOculusTracking(&camera); // Update camera with device tracking data
+
+ if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
//----------------------------------------------------------------------------------
// Draw
@@ -58,6 +153,9 @@ int main()
BeginDrawing();
ClearBackground(RAYWHITE);
+
+ if (vrDeviceReady) BeginOculusDrawing();
+ else BeginVrDrawing();
Begin3dMode(camera);
@@ -67,6 +165,9 @@ int main()
DrawGrid(40, 1.0f);
End3dMode();
+
+ if (vrDeviceReady) EndOculusDrawing();
+ else EndVrDrawing();
DrawFPS(10, 10);
@@ -76,10 +177,362 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
- CloseVrDevice(); // Close VR device
+ if (vrDeviceReady) CloseOculusDevice();
+ else CloseVrSimulator();
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
+
+//----------------------------------------------------------------------------------
+// Module specific Functions Definition
+//----------------------------------------------------------------------------------
+
+#if defined(RLGL_OCULUS_SUPPORT)
+// Set internal projection and modelview matrix depending on eyes tracking data
+static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView)
+{
+ Matrix eyeProjection = matProjection;
+ Matrix eyeModelView = matModelView;
+
+ glViewport(layer.eyeLayer.Viewport[eye].Pos.x, layer.eyeLayer.Viewport[eye].Pos.y,
+ layer.eyeLayer.Viewport[eye].Size.w, layer.eyeLayer.Viewport[eye].Size.h);
+
+ Quaternion eyeRenderPose = (Quaternion){ layer.eyeLayer.RenderPose[eye].Orientation.x,
+ layer.eyeLayer.RenderPose[eye].Orientation.y,
+ layer.eyeLayer.RenderPose[eye].Orientation.z,
+ layer.eyeLayer.RenderPose[eye].Orientation.w };
+ QuaternionInvert(&eyeRenderPose);
+ Matrix eyeOrientation = QuaternionToMatrix(eyeRenderPose);
+ Matrix eyeTranslation = MatrixTranslate(-layer.eyeLayer.RenderPose[eye].Position.x,
+ -layer.eyeLayer.RenderPose[eye].Position.y,
+ -layer.eyeLayer.RenderPose[eye].Position.z);
+
+ Matrix eyeView = MatrixMultiply(eyeTranslation, eyeOrientation); // Matrix containing eye-head movement
+ eyeModelView = MatrixMultiply(matModelView, eyeView); // Combine internal camera matrix (modelview) wih eye-head movement
+
+ eyeProjection = layer.eyeProjections[eye];
+}
+
+// Initialize Oculus device (returns true if success)
+static bool InitOculusDevice(void)
+{
+ bool oculusReady = false;
+
+ ovrResult result = ovr_Initialize(NULL);
+
+ if (OVR_FAILURE(result)) TraceLog(WARNING, "OVR: Could not initialize Oculus device");
+ else
+ {
+ result = ovr_Create(&session, &luid);
+ if (OVR_FAILURE(result))
+ {
+ TraceLog(WARNING, "OVR: Could not create Oculus session");
+ ovr_Shutdown();
+ }
+ else
+ {
+ hmdDesc = ovr_GetHmdDesc(session);
+
+ TraceLog(INFO, "OVR: Product Name: %s", hmdDesc.ProductName);
+ TraceLog(INFO, "OVR: Manufacturer: %s", hmdDesc.Manufacturer);
+ TraceLog(INFO, "OVR: Product ID: %i", hmdDesc.ProductId);
+ TraceLog(INFO, "OVR: Product Type: %i", hmdDesc.Type);
+ //TraceLog(INFO, "OVR: Serial Number: %s", hmdDesc.SerialNumber);
+ TraceLog(INFO, "OVR: Resolution: %ix%i", hmdDesc.Resolution.w, hmdDesc.Resolution.h);
+
+ // NOTE: Oculus mirror is set to defined screenWidth and screenHeight...
+ // ...ideally, it should be (hmdDesc.Resolution.w/2, hmdDesc.Resolution.h/2)
+
+ // Initialize Oculus Buffers
+ layer = InitOculusLayer(session);
+ buffer = LoadOculusBuffer(session, layer.width, layer.height);
+ mirror = LoadOculusMirror(session, hmdDesc.Resolution.w/2, hmdDesc.Resolution.h/2); // NOTE: hardcoded...
+ layer.eyeLayer.ColorTexture[0] = buffer.textureChain; //SetOculusLayerTexture(eyeLayer, buffer.textureChain);
+
+ // Recenter OVR tracking origin
+ ovr_RecenterTrackingOrigin(session);
+
+ oculusReady = true;
+ }
+ }
+
+ return oculusReady;
+}
+
+// Close Oculus device (and unload buffers)
+static void CloseOculusDevice(void)
+{
+ UnloadOculusMirror(session, mirror); // Unload Oculus mirror buffer
+ UnloadOculusBuffer(session, buffer); // Unload Oculus texture buffers
+
+ ovr_Destroy(session); // Free Oculus session data
+ ovr_Shutdown(); // Close Oculus device connection
+}
+
+// Update Oculus head position-orientation tracking
+static void UpdateOculusTracking(Camera *camera)
+{
+ frameIndex++;
+
+ ovrPosef eyePoses[2];
+ ovr_GetEyePoses(session, frameIndex, ovrTrue, layer.viewScaleDesc.HmdToEyeOffset, eyePoses, &layer.eyeLayer.SensorSampleTime);
+
+ layer.eyeLayer.RenderPose[0] = eyePoses[0];
+ layer.eyeLayer.RenderPose[1] = eyePoses[1];
+
+ // TODO: Update external camera with eyePoses data (position, orientation)
+ // NOTE: We can simplify to simple camera if we consider IPD and HMD device configuration again later
+ // it will be useful for the user to draw, lets say, billboards oriented to camera
+
+ // Get session status information
+ ovrSessionStatus sessionStatus;
+ ovr_GetSessionStatus(session, &sessionStatus);
+
+ if (sessionStatus.ShouldQuit) TraceLog(WARNING, "OVR: Session should quit...");
+ if (sessionStatus.ShouldRecenter) ovr_RecenterTrackingOrigin(session);
+ //if (sessionStatus.HmdPresent) // HMD is present.
+ //if (sessionStatus.DisplayLost) // HMD was unplugged or the display driver was manually disabled or encountered a TDR.
+ //if (sessionStatus.HmdMounted) // HMD is on the user's head.
+ //if (sessionStatus.IsVisible) // the game or experience has VR focus and is visible in the HMD.
+}
+
+// Setup Oculus buffers for drawing
+static void BeginOculusDrawing(void)
+{
+ GLuint currentTexId;
+ int currentIndex;
+
+ ovr_GetTextureSwapChainCurrentIndex(session, buffer.textureChain, &currentIndex);
+ ovr_GetTextureSwapChainBufferGL(session, buffer.textureChain, currentIndex, &currentTexId);
+
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, buffer.fboId);
+ glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, currentTexId, 0);
+ //glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, buffer.depthId, 0); // Already binded
+}
+
+// Finish Oculus drawing and blit framebuffer to mirror
+static void EndOculusDrawing(void)
+{
+ // Unbind current framebuffer (Oculus buffer)
+ glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+
+ ovr_CommitTextureSwapChain(session, buffer.textureChain);
+
+ ovrLayerHeader *layers = &layer.eyeLayer.Header;
+ ovr_SubmitFrame(session, frameIndex, &layer.viewScaleDesc, &layers, 1);
+
+ // Blit mirror texture to back buffer
+ BlitOculusMirror(session, mirror);
+}
+
+// Load Oculus required buffers: texture-swap-chain, fbo, texture-depth
+static OculusBuffer LoadOculusBuffer(ovrSession session, int width, int height)
+{
+ OculusBuffer buffer;
+ buffer.width = width;
+ buffer.height = height;
+
+ // Create OVR texture chain
+ ovrTextureSwapChainDesc desc = {};
+ desc.Type = ovrTexture_2D;
+ desc.ArraySize = 1;
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = 1;
+ desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; // Requires glEnable(GL_FRAMEBUFFER_SRGB);
+ desc.SampleCount = 1;
+ desc.StaticImage = ovrFalse;
+
+ ovrResult result = ovr_CreateTextureSwapChainGL(session, &desc, &buffer.textureChain);
+
+ if (!OVR_SUCCESS(result)) TraceLog(WARNING, "OVR: Failed to create swap textures buffer");
+
+ int textureCount = 0;
+ ovr_GetTextureSwapChainLength(session, buffer.textureChain, &textureCount);
+
+ if (!OVR_SUCCESS(result) || !textureCount) TraceLog(WARNING, "OVR: Unable to count swap chain textures");
+
+ for (int i = 0; i < textureCount; ++i)
+ {
+ GLuint chainTexId;
+ ovr_GetTextureSwapChainBufferGL(session, buffer.textureChain, i, &chainTexId);
+ glBindTexture(GL_TEXTURE_2D, chainTexId);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ }
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ /*
+ // Setup framebuffer object (using depth texture)
+ glGenFramebuffers(1, &buffer.fboId);
+ glGenTextures(1, &buffer.depthId);
+ glBindTexture(GL_TEXTURE_2D, buffer.depthId);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, buffer.width, buffer.height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
+ */
+
+ // Setup framebuffer object (using depth renderbuffer)
+ glGenFramebuffers(1, &buffer.fboId);
+ glGenRenderbuffers(1, &buffer.depthId);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, buffer.fboId);
+ glBindRenderbuffer(GL_RENDERBUFFER, buffer.depthId);
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, buffer.width, buffer.height);
+ glBindRenderbuffer(GL_RENDERBUFFER, 0);
+ glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, buffer.depthId);
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
+
+ return buffer;
+}
+
+// Unload texture required buffers
+static void UnloadOculusBuffer(ovrSession session, OculusBuffer buffer)
+{
+ if (buffer.textureChain)
+ {
+ ovr_DestroyTextureSwapChain(session, buffer.textureChain);
+ buffer.textureChain = NULL;
+ }
+
+ if (buffer.depthId != 0) glDeleteTextures(1, &buffer.depthId);
+ if (buffer.fboId != 0) glDeleteFramebuffers(1, &buffer.fboId);
+}
+
+// Load Oculus mirror buffers
+static OculusMirror LoadOculusMirror(ovrSession session, int width, int height)
+{
+ OculusMirror mirror;
+ mirror.width = width;
+ mirror.height = height;
+
+ ovrMirrorTextureDesc mirrorDesc;
+ memset(&mirrorDesc, 0, sizeof(mirrorDesc));
+ mirrorDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
+ mirrorDesc.Width = mirror.width;
+ mirrorDesc.Height = mirror.height;
+
+ if (!OVR_SUCCESS(ovr_CreateMirrorTextureGL(session, &mirrorDesc, &mirror.texture))) TraceLog(WARNING, "Could not create mirror texture");
+
+ glGenFramebuffers(1, &mirror.fboId);
+
+ return mirror;
+}
+
+// Unload Oculus mirror buffers
+static void UnloadOculusMirror(ovrSession session, OculusMirror mirror)
+{
+ if (mirror.fboId != 0) glDeleteFramebuffers(1, &mirror.fboId);
+ if (mirror.texture) ovr_DestroyMirrorTexture(session, mirror.texture);
+}
+
+// Copy Oculus screen buffer to mirror texture
+static void BlitOculusMirror(ovrSession session, OculusMirror mirror)
+{
+ GLuint mirrorTextureId;
+
+ ovr_GetMirrorTextureBufferGL(session, mirror.texture, &mirrorTextureId);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, mirror.fboId);
+ glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mirrorTextureId, 0);
+#if defined(GRAPHICS_API_OPENGL_33)
+ // NOTE: glBlitFramebuffer() requires extension: GL_EXT_framebuffer_blit (not available in OpenGL ES 2.0)
+ glBlitFramebuffer(0, 0, mirror.width, mirror.height, 0, mirror.height, mirror.width, 0, GL_COLOR_BUFFER_BIT, GL_NEAREST);
+#endif
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+}
+
+// Init Oculus layer (similar to photoshop)
+static OculusLayer InitOculusLayer(ovrSession session)
+{
+ OculusLayer layer = { 0 };
+
+ layer.viewScaleDesc.HmdSpaceToWorldScaleInMeters = 1.0f;
+
+ memset(&layer.eyeLayer, 0, sizeof(ovrLayerEyeFov));
+ layer.eyeLayer.Header.Type = ovrLayerType_EyeFov;
+ layer.eyeLayer.Header.Flags = ovrLayerFlag_TextureOriginAtBottomLeft;
+
+ ovrEyeRenderDesc eyeRenderDescs[2];
+
+ for (int eye = 0; eye < 2; eye++)
+ {
+ eyeRenderDescs[eye] = ovr_GetRenderDesc(session, eye, hmdDesc.DefaultEyeFov[eye]);
+ ovrMatrix4f ovrPerspectiveProjection = ovrMatrix4f_Projection(eyeRenderDescs[eye].Fov, 0.01f, 10000.0f, ovrProjection_None); //ovrProjection_ClipRangeOpenGL);
+ layer.eyeProjections[eye] = FromOvrMatrix(ovrPerspectiveProjection); // NOTE: struct ovrMatrix4f { float M[4][4] } --> struct Matrix
+
+ layer.viewScaleDesc.HmdToEyeOffset[eye] = eyeRenderDescs[eye].HmdToEyeOffset;
+ layer.eyeLayer.Fov[eye] = eyeRenderDescs[eye].Fov;
+
+ ovrSizei eyeSize = ovr_GetFovTextureSize(session, eye, layer.eyeLayer.Fov[eye], 1.0f);
+ layer.eyeLayer.Viewport[eye].Size = eyeSize;
+ layer.eyeLayer.Viewport[eye].Pos.x = layer.width;
+ layer.eyeLayer.Viewport[eye].Pos.y = 0;
+
+ layer.height = eyeSize.h; //std::max(renderTargetSize.y, (uint32_t)eyeSize.h);
+ layer.width += eyeSize.w;
+ }
+
+ return layer;
+}
+
+// Convert from Oculus ovrMatrix4f struct to raymath Matrix struct
+static Matrix FromOvrMatrix(ovrMatrix4f ovrmat)
+{
+ Matrix rmat;
+
+ rmat.m0 = ovrmat.M[0][0];
+ rmat.m1 = ovrmat.M[1][0];
+ rmat.m2 = ovrmat.M[2][0];
+ rmat.m3 = ovrmat.M[3][0];
+ rmat.m4 = ovrmat.M[0][1];
+ rmat.m5 = ovrmat.M[1][1];
+ rmat.m6 = ovrmat.M[2][1];
+ rmat.m7 = ovrmat.M[3][1];
+ rmat.m8 = ovrmat.M[0][2];
+ rmat.m9 = ovrmat.M[1][2];
+ rmat.m10 = ovrmat.M[2][2];
+ rmat.m11 = ovrmat.M[3][2];
+ rmat.m12 = ovrmat.M[0][3];
+ rmat.m13 = ovrmat.M[1][3];
+ rmat.m14 = ovrmat.M[2][3];
+ rmat.m15 = ovrmat.M[3][3];
+
+ MatrixTranspose(&rmat);
+
+ return rmat;
+}
+#endif
+
+// Output a trace log message
+// NOTE: Expected msgType: (0)Info, (1)Error, (2)Warning
+static void TraceLog(int msgType, const char *text, ...)
+{
+ va_list args;
+ va_start(args, text);
+
+ switch (msgType)
+ {
+ case INFO: fprintf(stdout, "INFO: "); break;
+ case ERROR: fprintf(stdout, "ERROR: "); break;
+ case WARNING: fprintf(stdout, "WARNING: "); break;
+ case DEBUG: fprintf(stdout, "DEBUG: "); break;
+ default: break;
+ }
+
+ vfprintf(stdout, text, args);
+ fprintf(stdout, "\n");
+
+ va_end(args);
+
+ if (msgType == ERROR) exit(1);
+}
+
diff --git a/examples/text_ttf_loading.c b/examples/text_ttf_loading.c
index 10025c2f..4aa0bef4 100644
--- a/examples/text_ttf_loading.c
+++ b/examples/text_ttf_loading.c
@@ -5,7 +5,7 @@
* This example has been created using raylib 1.3.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* Copyright (c) 2015 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/drturtle/00_drturtle_screens.c b/games/drturtle/00_drturtle_screens.c
index 16ae5c3c..fd9b3dad 100644
--- a/games/drturtle/00_drturtle_screens.c
+++ b/games/drturtle/00_drturtle_screens.c
@@ -15,7 +15,7 @@
* 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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/drturtle/01_drturtle_scrolling.c b/games/drturtle/01_drturtle_scrolling.c
index e3215b20..b8a091de 100644
--- a/games/drturtle/01_drturtle_scrolling.c
+++ b/games/drturtle/01_drturtle_scrolling.c
@@ -15,7 +15,7 @@
* 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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/drturtle/02_drturtle_player.c b/games/drturtle/02_drturtle_player.c
index 0d8defa2..bf49abe5 100644
--- a/games/drturtle/02_drturtle_player.c
+++ b/games/drturtle/02_drturtle_player.c
@@ -15,7 +15,7 @@
* 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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/drturtle/03_drturtle_enemies.c b/games/drturtle/03_drturtle_enemies.c
index de67ee82..f659a19a 100644
--- a/games/drturtle/03_drturtle_enemies.c
+++ b/games/drturtle/03_drturtle_enemies.c
@@ -15,7 +15,7 @@
* 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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/drturtle/04_drturtle_gui.c b/games/drturtle/04_drturtle_gui.c
index bbfd3492..5be8f1f1 100644
--- a/games/drturtle/04_drturtle_gui.c
+++ b/games/drturtle/04_drturtle_gui.c
@@ -15,7 +15,7 @@
* 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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -338,7 +338,7 @@ int main()
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.size, 0, WHITE);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, WHITE);
} break;
case GAMEPLAY:
@@ -388,8 +388,8 @@ int main()
DrawRectangle(20, 20, foodBar, 40, ORANGE);
DrawRectangleLines(20, 20, 400, 40, BLACK);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
if (gameraMode)
{
@@ -403,15 +403,15 @@ int main()
// Draw a transparent black rectangle that covers all screen
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
- DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.size*3, -2, MAROON);
+ DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.size, -2, LIGHTGRAY);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
} break;
default: break;
@@ -444,4 +444,4 @@ int main()
//--------------------------------------------------------------------------------------
return 0;
-} \ No newline at end of file
+}
diff --git a/games/drturtle/05_drturtle_audio.c b/games/drturtle/05_drturtle_audio.c
index b94de106..3645c657 100644
--- a/games/drturtle/05_drturtle_audio.c
+++ b/games/drturtle/05_drturtle_audio.c
@@ -15,7 +15,7 @@
* 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) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -354,7 +354,7 @@ int main()
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.size, 0, WHITE);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, WHITE);
} break;
case GAMEPLAY:
@@ -404,8 +404,8 @@ int main()
DrawRectangle(20, 20, foodBar, 40, ORANGE);
DrawRectangleLines(20, 20, 400, 40, BLACK);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
if (gameraMode)
{
@@ -419,15 +419,15 @@ int main()
// Draw a transparent black rectangle that covers all screen
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
- DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.size*3, -2, MAROON);
+ DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.size, -2, LIGHTGRAY);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
} break;
default: break;
@@ -468,4 +468,4 @@ int main()
//--------------------------------------------------------------------------------------
return 0;
-} \ No newline at end of file
+}
diff --git a/games/drturtle/06_drturtle_final.c b/games/drturtle/06_drturtle_final.c
index 48708094..2edebe87 100644
--- a/games/drturtle/06_drturtle_final.c
+++ b/games/drturtle/06_drturtle_final.c
@@ -15,7 +15,7 @@
* 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) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -379,7 +379,7 @@ int main()
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.size, 0, WHITE);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 0, WHITE);
} break;
case GAMEPLAY:
@@ -429,8 +429,8 @@ int main()
DrawRectangle(20, 20, foodBar, 40, ORANGE);
DrawRectangleLines(20, 20, 400, 40, BLACK);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
if (gameraMode)
{
@@ -444,15 +444,15 @@ int main()
// Draw a transparent black rectangle that covers all screen
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
- DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.size*3, -2, MAROON);
+ DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.size, -2, LIGHTGRAY);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
} break;
default: break;
@@ -493,4 +493,4 @@ int main()
//--------------------------------------------------------------------------------------
return 0;
-} \ No newline at end of file
+}
diff --git a/games/drturtle/drturtle_final_web.c b/games/drturtle/drturtle_final_web.c
index bec7ebd0..84f3b1c2 100644
--- a/games/drturtle/drturtle_final_web.c
+++ b/games/drturtle/drturtle_final_web.c
@@ -15,7 +15,7 @@
* 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) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -460,7 +460,7 @@ void UpdateDrawFrame(void)
DrawTexture(title, screenWidth/2 - title.width/2, screenHeight/2 - title.height/2 - 80, WHITE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.size, 1, WHITE);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER", (Vector2){ screenWidth/2 - 150, 480 }, font.baseSize, 1, WHITE);
} break;
case GAMEPLAY:
@@ -510,8 +510,8 @@ void UpdateDrawFrame(void)
DrawRectangle(20, 20, foodBar, 40, ORANGE);
DrawRectangleLines(20, 20, 400, 40, BLACK);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ screenWidth - 300, 20 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 550, 20 }, font.baseSize, -2, ORANGE);
if (gameraMode)
{
@@ -525,15 +525,15 @@ void UpdateDrawFrame(void)
// Draw a transparent black rectangle that covers all screen
DrawRectangle(0, 0, screenWidth, screenHeight, Fade(BLACK, 0.4f));
- DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.size*3, -2, MAROON);
+ DrawTextEx(font, "GAME OVER", (Vector2){ 300, 160 }, font.baseSize*3, -2, MAROON);
- DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.size, -2, GOLD);
- DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.size, -2, ORANGE);
- DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.size, -2, ORANGE);
+ DrawTextEx(font, FormatText("SCORE: %04i", score), (Vector2){ 680, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("DISTANCE: %04i", (int)distance), (Vector2){ 290, 350 }, font.baseSize, -2, GOLD);
+ DrawTextEx(font, FormatText("HISCORE: %04i", hiscore), (Vector2){ 665, 400 }, font.baseSize, -2, ORANGE);
+ DrawTextEx(font, FormatText("HIDISTANCE: %04i", (int)hidistance), (Vector2){ 270, 400 }, font.baseSize, -2, ORANGE);
// Draw blinking text
- if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.size, -2, LIGHTGRAY);
+ if ((framesCounter/30) % 2) DrawTextEx(font, "PRESS ENTER to REPLAY", (Vector2){ screenWidth/2 - 250, 520 }, font.baseSize, -2, LIGHTGRAY);
} break;
default: break;
@@ -541,4 +541,4 @@ void UpdateDrawFrame(void)
EndDrawing();
//----------------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/games/drturtle/makefile b/games/drturtle/makefile
index 0a45e18a..ab7fd206 100644
--- a/games/drturtle/makefile
+++ b/games/drturtle/makefile
@@ -2,7 +2,7 @@
#
# raylib - makefile to compile Dr.Turtle game
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
@@ -66,7 +66,7 @@ endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline
else
- CFLAGS = -O2 -Wall -std=c99
+ CFLAGS = -O2 -Wall -std=c99
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --preload-file resources -s ALLOW_MEMORY_GROWTH=1 --shell-file ../../templates/web_shell/shell.html
@@ -114,7 +114,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl
# on XWindow could require also below libraries, just uncomment
- #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
+ LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
diff --git a/games/just_do/just_do.c b/games/just_do/just_do.c
index 811150d3..2ec178a4 100644
--- a/games/just_do/just_do.c
+++ b/games/just_do/just_do.c
@@ -9,7 +9,7 @@
* 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)
*
-* raylib - Copyright (c) 2015 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* raylib - Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/just_do/makefile b/games/just_do/makefile
index 1a971081..6bb973c0 100644
--- a/games/just_do/makefile
+++ b/games/just_do/makefile
@@ -4,7 +4,7 @@
#
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
@@ -119,7 +119,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl
# on XWindow could require also below libraries, just uncomment
- #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
+ LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
diff --git a/games/just_do/screens/screen_level00.c b/games/just_do/screens/screen_level00.c
index 99f29849..e72e3812 100644
--- a/games/just_do/screens/screen_level00.c
+++ b/games/just_do/screens/screen_level00.c
@@ -4,7 +4,7 @@
*
* Level00 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level01.c b/games/just_do/screens/screen_level01.c
index cedcb2e0..8cb76bf1 100644
--- a/games/just_do/screens/screen_level01.c
+++ b/games/just_do/screens/screen_level01.c
@@ -4,7 +4,7 @@
*
* Level01 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level02.c b/games/just_do/screens/screen_level02.c
index ccfa355e..a2d5e562 100644
--- a/games/just_do/screens/screen_level02.c
+++ b/games/just_do/screens/screen_level02.c
@@ -4,7 +4,7 @@
*
* Level02 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level03.c b/games/just_do/screens/screen_level03.c
index e8732414..7c3aa286 100644
--- a/games/just_do/screens/screen_level03.c
+++ b/games/just_do/screens/screen_level03.c
@@ -4,7 +4,7 @@
*
* Level03 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level04.c b/games/just_do/screens/screen_level04.c
index c4e4e2c0..7a8a21f1 100644
--- a/games/just_do/screens/screen_level04.c
+++ b/games/just_do/screens/screen_level04.c
@@ -4,7 +4,7 @@
*
* Level04 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level05.c b/games/just_do/screens/screen_level05.c
index f2e4d852..5d5d23d6 100644
--- a/games/just_do/screens/screen_level05.c
+++ b/games/just_do/screens/screen_level05.c
@@ -4,7 +4,7 @@
*
* Level05 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level06.c b/games/just_do/screens/screen_level06.c
index b5881db4..a5536aa4 100644
--- a/games/just_do/screens/screen_level06.c
+++ b/games/just_do/screens/screen_level06.c
@@ -4,7 +4,7 @@
*
* Level06 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level07.c b/games/just_do/screens/screen_level07.c
index d305b025..2ed4f944 100644
--- a/games/just_do/screens/screen_level07.c
+++ b/games/just_do/screens/screen_level07.c
@@ -4,7 +4,7 @@
*
* Level07 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level08.c b/games/just_do/screens/screen_level08.c
index 4cb0443b..1caced49 100644
--- a/games/just_do/screens/screen_level08.c
+++ b/games/just_do/screens/screen_level08.c
@@ -4,7 +4,7 @@
*
* Level08 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level09.c b/games/just_do/screens/screen_level09.c
index d20f4bfb..91b0a6f7 100644
--- a/games/just_do/screens/screen_level09.c
+++ b/games/just_do/screens/screen_level09.c
@@ -4,7 +4,7 @@
*
* Level09 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_level10.c b/games/just_do/screens/screen_level10.c
index 33806006..f42b1e66 100644
--- a/games/just_do/screens/screen_level10.c
+++ b/games/just_do/screens/screen_level10.c
@@ -4,7 +4,7 @@
*
* Level10 Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screen_logo.c b/games/just_do/screens/screen_logo.c
index 9639602d..ab078289 100644
--- a/games/just_do/screens/screen_logo.c
+++ b/games/just_do/screens/screen_logo.c
@@ -4,7 +4,7 @@
*
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/just_do/screens/screens.h b/games/just_do/screens/screens.h
index 7fa59405..13bd8d72 100644
--- a/games/just_do/screens/screens.h
+++ b/games/just_do/screens/screens.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/light_my_ritual/light_my_ritual.c b/games/light_my_ritual/light_my_ritual.c
index 000eca36..152bdeb6 100644
--- a/games/light_my_ritual/light_my_ritual.c
+++ b/games/light_my_ritual/light_my_ritual.c
@@ -10,7 +10,7 @@
* This game has been created using raylib (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* Copyright (c) 2015 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/light_my_ritual/makefile b/games/light_my_ritual/makefile
index 84d7e994..5cd4ee6b 100644
--- a/games/light_my_ritual/makefile
+++ b/games/light_my_ritual/makefile
@@ -4,7 +4,7 @@
#
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
@@ -114,14 +114,17 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libraries for Debian GNU/Linux desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
- LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal
+ LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -lpthread -ldl
+ # on XWindow could require also below libraries, just uncomment
+ LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
- else
+ endif
+ ifeq ($(PLATFORM_OS),WINDOWS)
# libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
diff --git a/games/light_my_ritual/screens/screen_gameplay.c b/games/light_my_ritual/screens/screen_gameplay.c
index c1779f73..6e3bd1c2 100644
--- a/games/light_my_ritual/screens/screen_gameplay.c
+++ b/games/light_my_ritual/screens/screen_gameplay.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -687,7 +687,7 @@ void DrawGameplayScreen(void)
}
// Draw time left for ritual
- DrawTextEx(font, FormatText("%02.2f", (99.0f - ritualTime)), (Vector2){ 560, 20 }, font.size, 0, WHITE);
+ DrawTextEx(font, FormatText("%02.2f", (99.0f - ritualTime)), (Vector2){ 560, 20 }, font.baseSize, 0, WHITE);
// Draw light energy bar
DrawRectangle(20, 30, 400, 20, GRAY);
@@ -703,7 +703,7 @@ void DrawGameplayScreen(void)
// Show message: "You run out of light!!!" if player.lightEnergy <= 0
if (player.lightEnergy < 2)
{
- if ((framesCounter/20)%2) DrawTextEx(font, "YOU'RE RUNNING OUT OF LIGHT!", (Vector2){ 20, 60 }, font.size/2, 0, WHITE);
+ if ((framesCounter/20)%2) DrawTextEx(font, "YOU'RE RUNNING OUT OF LIGHT!", (Vector2){ 20, 60 }, font.baseSize/2, 0, WHITE);
}
}
else if (!timeOver) // LEVEL_FINISHED
@@ -846,4 +846,4 @@ static void EnemyReset(Enemy *enemy)
enemy->speed = (float)GetRandomValue(8, 18)/10.0f;
enemy->awakeFramesDelay = GetRandomValue(180, 1200);
}
-} \ No newline at end of file
+}
diff --git a/games/light_my_ritual/screens/screen_logo_raylib.c b/games/light_my_ritual/screens/screen_logo_raylib.c
index f21055d7..87a2282e 100644
--- a/games/light_my_ritual/screens/screen_logo_raylib.c
+++ b/games/light_my_ritual/screens/screen_logo_raylib.c
@@ -4,7 +4,7 @@
*
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/light_my_ritual/screens/screen_title.c b/games/light_my_ritual/screens/screen_title.c
index c1ecaf12..bcf53f51 100644
--- a/games/light_my_ritual/screens/screen_title.c
+++ b/games/light_my_ritual/screens/screen_title.c
@@ -4,7 +4,7 @@
*
* Title Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -85,7 +85,7 @@ void DrawTitleScreen(void)
DrawText("(c) Developed by Ramon Santamaria (@raysan5)", 20, GetScreenHeight() - 40, 20, LIGHTGRAY);
- if ((framesCounter > 180) && ((framesCounter/40)%2)) DrawTextEx(font, "PRESS ENTER to START LIGHTING", (Vector2){ 230, 450 }, font.size, -2, WHITE);
+ if ((framesCounter > 180) && ((framesCounter/40)%2)) DrawTextEx(font, "PRESS ENTER to START LIGHTING", (Vector2){ 230, 450 }, font.baseSize, -2, WHITE);
}
// Title Screen Unload logic
@@ -102,4 +102,4 @@ void UnloadTitleScreen(void)
int FinishTitleScreen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/light_my_ritual/screens/screens.h b/games/light_my_ritual/screens/screens.h
index 8fee5274..ff12a01c 100644
--- a/games/light_my_ritual/screens/screens.h
+++ b/games/light_my_ritual/screens/screens.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/raylib_demo/makefile b/games/raylib_demo/makefile
index 0c22261c..4e8a9b1c 100644
--- a/games/raylib_demo/makefile
+++ b/games/raylib_demo/makefile
@@ -4,7 +4,7 @@
#
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
@@ -119,7 +119,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl
# on XWindow could require also below libraries, just uncomment
- #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
+ LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
diff --git a/games/raylib_demo/raylib_demo.c b/games/raylib_demo/raylib_demo.c
index 722d8ce6..62f26c3f 100644
--- a/games/raylib_demo/raylib_demo.c
+++ b/games/raylib_demo/raylib_demo.c
@@ -5,7 +5,7 @@
* This show has been created using raylib v1.4 (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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -709,11 +709,11 @@ void UpdateDrawOneFrame(void)
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x5c5a5aff));
- DrawTextEx(fontRomulus, "Open-Close Window", (Vector2){ 48, 230 }, fontRomulus.size*2, 4, GetColor(0x5c5a5aff));
- DrawTextEx(fontRomulus, "Manage Drawing Area", (Vector2){ 48, 260 }, fontRomulus.size*2, 4, GetColor(0x5c5a5aff));
- DrawTextEx(fontRomulus, "Manage Inputs", (Vector2){ 48, 290 }, fontRomulus.size*2, 4, GetColor(0x5c5a5aff));
- DrawTextEx(fontRomulus, "Manage Timming", (Vector2){ 48, 320 }, fontRomulus.size*2, 4, GetColor(0x5c5a5aff));
- DrawTextEx(fontRomulus, "Auxiliar Functions", (Vector2){ 48, 350 }, fontRomulus.size*2, 4, GetColor(0x5c5a5aff));
+ DrawTextEx(fontRomulus, "Open-Close Window", (Vector2){ 48, 230 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
+ DrawTextEx(fontRomulus, "Manage Drawing Area", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
+ DrawTextEx(fontRomulus, "Manage Inputs", (Vector2){ 48, 290 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
+ DrawTextEx(fontRomulus, "Manage Timming", (Vector2){ 48, 320 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
+ DrawTextEx(fontRomulus, "Auxiliar Functions", (Vector2){ 48, 350 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
switch (coreWindow)
{
@@ -739,16 +739,16 @@ void UpdateDrawOneFrame(void)
if (framesCounter > 140)
{
- DrawTextEx(fontMecha, "MOVE ME", (Vector2){ ballPosition.x - 26, ballPosition.y - 20 }, fontMecha.size, 2, BLACK);
- DrawTextEx(fontMecha, "[ W A S D ]", (Vector2){ ballPosition.x - 36, ballPosition.y }, fontMecha.size, 2, BLACK);
+ DrawTextEx(fontMecha, "MOVE ME", (Vector2){ ballPosition.x - 26, ballPosition.y - 20 }, fontMecha.baseSize, 2, BLACK);
+ DrawTextEx(fontMecha, "[ W A S D ]", (Vector2){ ballPosition.x - 36, ballPosition.y }, fontMecha.baseSize, 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 }, fontRomulus.size*2, 4, GetColor(0xcd5757ff));
- DrawTextEx(fontRomulus, "Basic Collision Detection", (Vector2){ 48, 260 }, fontRomulus.size*2, 4, GetColor(0xcd5757ff));
+ DrawTextEx(fontRomulus, "Draw Basic Shapes", (Vector2){ 48, 230 }, fontRomulus.baseSize*2, 4, GetColor(0xcd5757ff));
+ DrawTextEx(fontRomulus, "Basic Collision Detection", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0xcd5757ff));
DrawCircle(screenWidth/4, 120 + 240, 35, DARKBLUE);
DrawCircleGradient(screenWidth/4, 220 + 240, 60, GREEN, SKYBLUE);
@@ -769,8 +769,8 @@ void UpdateDrawOneFrame(void)
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x60815aff));
- DrawTextEx(fontRomulus, "Load Images and Textures", (Vector2){ 48, 230 }, fontRomulus.size*2, 4, GetColor(0x60815aff));
- DrawTextEx(fontRomulus, "Draw Textures", (Vector2){ 48, 260 }, fontRomulus.size*2, 4, GetColor(0x60815aff));
+ DrawTextEx(fontRomulus, "Load Images and Textures", (Vector2){ 48, 230 }, fontRomulus.baseSize*2, 4, GetColor(0x60815aff));
+ DrawTextEx(fontRomulus, "Draw Textures", (Vector2){ 48, 260 }, fontRomulus.baseSize*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);
@@ -786,21 +786,21 @@ void UpdateDrawOneFrame(void)
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x377764ff));
- DrawTextEx(fontRomulus, "Load SpriteFonts", (Vector2){ 48, 230 }, fontRomulus.size*2, 4, GetColor(0x377764ff));
- DrawTextEx(fontRomulus, "Draw Text", (Vector2){ 48, 260 }, fontRomulus.size*2, 4, GetColor(0x377764ff));
- DrawTextEx(fontRomulus, "Text Formatting", (Vector2){ 48, 290 }, fontRomulus.size*2, 4, GetColor(0x377764ff));
+ DrawTextEx(fontRomulus, "Load SpriteFonts", (Vector2){ 48, 230 }, fontRomulus.baseSize*2, 4, GetColor(0x377764ff));
+ DrawTextEx(fontRomulus, "Draw Text", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0x377764ff));
+ DrawTextEx(fontRomulus, "Text Formatting", (Vector2){ 48, 290 }, fontRomulus.baseSize*2, 4, GetColor(0x377764ff));
DrawTexture(texAlagard, 60, 360, WHITE);
- DrawTextEx(fontMechaC, msg1, (Vector2){ 540 + 168, 210 }, fontMechaC.size, -3, WHITE);
- DrawTextEx(fontAlagardC, msg2, (Vector2){ 460 + 140, 260 }, fontAlagardC.size, -2, WHITE);
- DrawTextEx(fontJupiterC, msg3, (Vector2){ 640 + 70, 300 }, fontJupiterC.size, 2, WHITE);
+ DrawTextEx(fontMechaC, msg1, (Vector2){ 540 + 168, 210 }, fontMechaC.baseSize, -3, WHITE);
+ DrawTextEx(fontAlagardC, msg2, (Vector2){ 460 + 140, 260 }, fontAlagardC.baseSize, -2, WHITE);
+ DrawTextEx(fontJupiterC, msg3, (Vector2){ 640 + 70, 300 }, fontJupiterC.baseSize, 2, WHITE);
- DrawTextEx(fontAlagard, "It also includes some...", (Vector2){ 650 + 70, 400 }, fontAlagard.size*2, 2, MAROON);
- DrawTextEx(fontPixelplay, "...free fonts in rBMF format...", (Vector2){ 705 - 26, 450 }, fontPixelplay.size*2, 4, ORANGE);
- DrawTextEx(fontMecha, "...to be used even in...", (Vector2){ 700 + 40, 500 }, fontMecha.size*2, 4, DARKGREEN);
- DrawTextEx(fontSetback, "...comercial projects...", (Vector2){ 710, 550 }, fontSetback.size*2, 4, DARKBLUE);
- DrawTextEx(fontRomulus, "...completely for free!", (Vector2){ 710 + 17, 600 }, fontRomulus.size*2, 3, DARKPURPLE);
+ DrawTextEx(fontAlagard, "It also includes some...", (Vector2){ 650 + 70, 400 }, fontAlagard.baseSize*2, 2, MAROON);
+ DrawTextEx(fontPixelplay, "...free fonts in rBMF format...", (Vector2){ 705 - 26, 450 }, fontPixelplay.baseSize*2, 4, ORANGE);
+ DrawTextEx(fontMecha, "...to be used even in...", (Vector2){ 700 + 40, 500 }, fontMecha.baseSize*2, 4, DARKGREEN);
+ DrawTextEx(fontSetback, "...commercial projects...", (Vector2){ 710, 550 }, fontSetback.baseSize*2, 4, DARKBLUE);
+ DrawTextEx(fontRomulus, "...completely for free!", (Vector2){ 710 + 17, 600 }, fontRomulus.baseSize*2, 3, DARKPURPLE);
DrawText("This is a custom font spritesheet, raylib can load it automatically!", 228, 360 + 295, 10, GRAY);
@@ -809,9 +809,9 @@ void UpdateDrawOneFrame(void)
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x417794ff));
- DrawTextEx(fontRomulus, "Draw Geometric Models", (Vector2){ 48, 230 }, fontRomulus.size*2, 4, GetColor(0x417794ff));
- DrawTextEx(fontRomulus, "Load 3D Models", (Vector2){ 48, 260 }, fontRomulus.size*2, 4, GetColor(0x417794ff));
- DrawTextEx(fontRomulus, "Draw 3D Models", (Vector2){ 48, 290 }, fontRomulus.size*2, 4, GetColor(0x417794ff));
+ DrawTextEx(fontRomulus, "Draw Geometric Models", (Vector2){ 48, 230 }, fontRomulus.baseSize*2, 4, GetColor(0x417794ff));
+ DrawTextEx(fontRomulus, "Load 3D Models", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0x417794ff));
+ DrawTextEx(fontRomulus, "Draw 3D Models", (Vector2){ 48, 290 }, fontRomulus.baseSize*2, 4, GetColor(0x417794ff));
Begin3dMode(camera);
@@ -843,8 +843,8 @@ void UpdateDrawOneFrame(void)
{
DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x8c7539ff));
- DrawTextEx(fontRomulus, "Load and Play Sounds", (Vector2){ 48, 230 }, fontRomulus.size*2, 4, GetColor(0x8c7539ff));
- DrawTextEx(fontRomulus, "Play Music (streaming)", (Vector2){ 48, 260 }, fontRomulus.size*2, 4, GetColor(0x8c7539ff));
+ DrawTextEx(fontRomulus, "Load and Play Sounds", (Vector2){ 48, 230 }, fontRomulus.baseSize*2, 4, GetColor(0x8c7539ff));
+ DrawTextEx(fontRomulus, "Play Music (streaming)", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0x8c7539ff));
DrawText("PRESS SPACE to START PLAYING MUSIC", 135, 350, 20, GRAY);
DrawRectangle(150, 390, 400, 12, LIGHTGRAY);
@@ -897,7 +897,7 @@ void UpdateDrawOneFrame(void)
case ENDING:
{
// Draw ENDING screen
- DrawTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", (Vector2){ screenWidth/2 - MeasureTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", fontAlagard.size*4, 4).x/2, 80 }, fontAlagard.size*4, 4, MAROON);
+ DrawTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", (Vector2){ screenWidth/2 - MeasureTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", fontAlagard.baseSize*4, 4).x/2, 80 }, fontAlagard.baseSize*4, 4, MAROON);
DrawTexture(raylibLogoA, logoPositionX, logoPositionY - 40, WHITE);
@@ -929,4 +929,4 @@ void UpdateDrawOneFrame(void)
EndDrawing();
//----------------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/makefile b/games/skully_escape/makefile
index 967c3da7..7cfd3190 100644
--- a/games/skully_escape/makefile
+++ b/games/skully_escape/makefile
@@ -4,7 +4,7 @@
#
# makefile to compile advance game
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
@@ -116,7 +116,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl
# on XWindow could require also below libraries, just uncomment
- #LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
+ LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
diff --git a/games/skully_escape/monster.c b/games/skully_escape/monster.c
index 643d0a73..469cd9ca 100644
--- a/games/skully_escape/monster.c
+++ b/games/skully_escape/monster.c
@@ -8,7 +8,7 @@
* This game has been created using raylib (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
************************************************************************************/
diff --git a/games/skully_escape/monster.h b/games/skully_escape/monster.h
index e7e01856..2ef4eb6a 100644
--- a/games/skully_escape/monster.h
+++ b/games/skully_escape/monster.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/skully_escape/player.c b/games/skully_escape/player.c
index 11006f65..857ff538 100644
--- a/games/skully_escape/player.c
+++ b/games/skully_escape/player.c
@@ -8,7 +8,7 @@
* This game has been created using raylib (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
************************************************************************************/
diff --git a/games/skully_escape/screens/screen_aisle01.c b/games/skully_escape/screens/screen_aisle01.c
index 17d25058..78bb20c4 100644
--- a/games/skully_escape/screens/screen_aisle01.c
+++ b/games/skully_escape/screens/screen_aisle01.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -362,11 +362,11 @@ void DrawAisle01Screen(void)
if (msgState == 0)
{
- DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
- DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
@@ -374,7 +374,7 @@ void DrawAisle01Screen(void)
{
if ((msgCounter/30)%2)
{
- DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.size*2, 2, WHITE);
+ DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(lamp.bounds, Fade(RED, 0.6f));
DrawRectangleRec(picture.bounds, Fade(RED, 0.6f));
@@ -406,4 +406,4 @@ void UnloadAisle01Screen(void)
int FinishAisle01Screen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_aisle02.c b/games/skully_escape/screens/screen_aisle02.c
index 6186a1fc..9dc02d37 100644
--- a/games/skully_escape/screens/screen_aisle02.c
+++ b/games/skully_escape/screens/screen_aisle02.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -393,11 +393,11 @@ void DrawAisle02Screen(void)
if (msgState == 0)
{
- DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
- DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
@@ -405,7 +405,7 @@ void DrawAisle02Screen(void)
{
if ((msgCounter/30)%2)
{
- DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.size*2, 2, WHITE);
+ DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(lamp.bounds, Fade(RED, 0.6f));
DrawRectangleRec(arc.bounds, Fade(RED, 0.6f));
@@ -441,4 +441,4 @@ void UnloadAisle02Screen(void)
int FinishAisle02Screen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_armory.c b/games/skully_escape/screens/screen_armory.c
index 622299f0..e05ca4e7 100644
--- a/games/skully_escape/screens/screen_armory.c
+++ b/games/skully_escape/screens/screen_armory.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -355,11 +355,11 @@ void DrawArmoryScreen(void)
if (msgState == 0)
{
- DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
- DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
@@ -367,7 +367,7 @@ void DrawArmoryScreen(void)
{
if ((msgCounter/30)%2)
{
- DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.size*2, 2, WHITE);
+ DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(blazon01.bounds, Fade(RED, 0.6f));
DrawRectangleRec(blazon02.bounds, Fade(RED, 0.6f));
@@ -401,4 +401,4 @@ void UnloadArmoryScreen(void)
int FinishArmoryScreen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_attic.c b/games/skully_escape/screens/screen_attic.c
index a8bc0a6b..87bffaa2 100644
--- a/games/skully_escape/screens/screen_attic.c
+++ b/games/skully_escape/screens/screen_attic.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -285,11 +285,11 @@ void DrawAtticScreen(void)
if (msgState == 0)
{
- DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
- DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
@@ -297,7 +297,7 @@ void DrawAtticScreen(void)
{
if ((msgCounter/30)%2)
{
- DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.size*2, 2, WHITE);
+ DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(lamp.bounds, Fade(RED, 0.6f));
DrawRectangleRec(arc.bounds, Fade(RED, 0.6f));
@@ -329,4 +329,4 @@ void UnloadAtticScreen(void)
int FinishAtticScreen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_bathroom.c b/games/skully_escape/screens/screen_bathroom.c
index 176967a7..1f228803 100644
--- a/games/skully_escape/screens/screen_bathroom.c
+++ b/games/skully_escape/screens/screen_bathroom.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -334,11 +334,11 @@ void DrawBathroomScreen(void)
if (msgState == 0)
{
- DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
- DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
@@ -346,7 +346,7 @@ void DrawBathroomScreen(void)
{
if ((msgCounter/30)%2)
{
- DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.size*2, 2, WHITE);
+ DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(lamp.bounds, Fade(RED, 0.6f));
DrawRectangleRec(mirror.bounds, Fade(RED, 0.6f));
@@ -380,4 +380,4 @@ void UnloadBathroomScreen(void)
int FinishBathroomScreen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_ending.c b/games/skully_escape/screens/screen_ending.c
index 120d9071..deffbb82 100644
--- a/games/skully_escape/screens/screen_ending.c
+++ b/games/skully_escape/screens/screen_ending.c
@@ -4,7 +4,7 @@
*
* Ending Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -71,8 +71,8 @@ void DrawEndingScreen(void)
{
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), DARKGRAY);
- DrawTextEx(font, "CONGRATULATIONS!", (Vector2){ 50, 160 }, font.size*3, 2, Fade(WHITE, alpha));
- DrawTextEx(font, "SKULLY ESCAPED!", (Vector2){ 100, 300 }, font.size*3, 2, Fade(WHITE, alpha));
+ DrawTextEx(font, "CONGRATULATIONS!", (Vector2){ 50, 160 }, font.baseSize*3, 2, Fade(WHITE, alpha));
+ DrawTextEx(font, "SKULLY ESCAPED!", (Vector2){ 100, 300 }, font.baseSize*3, 2, Fade(WHITE, alpha));
if ((framesCounter > 180) && ((framesCounter/40)%2)) DrawText("PRESS ENTER or CLICK", 380, 545, 40, BLACK);
}
@@ -87,4 +87,4 @@ void UnloadEndingScreen(void)
int FinishEndingScreen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_kitchen.c b/games/skully_escape/screens/screen_kitchen.c
index a6b8924d..01ce326a 100644
--- a/games/skully_escape/screens/screen_kitchen.c
+++ b/games/skully_escape/screens/screen_kitchen.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -354,11 +354,11 @@ void DrawKitchenScreen(void)
if (msgState == 0)
{
- DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
- DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
@@ -366,7 +366,7 @@ void DrawKitchenScreen(void)
{
if ((msgCounter/30)%2)
{
- DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.size*2, 2, WHITE);
+ DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(closet.bounds, Fade(RED, 0.6f));
DrawRectangleRec(window.bounds, Fade(RED, 0.6f));
@@ -400,4 +400,4 @@ void UnloadKitchenScreen(void)
int FinishKitchenScreen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_livingroom.c b/games/skully_escape/screens/screen_livingroom.c
index b2b09d9a..fa465bfa 100644
--- a/games/skully_escape/screens/screen_livingroom.c
+++ b/games/skully_escape/screens/screen_livingroom.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -354,11 +354,11 @@ void DrawLivingroomScreen(void)
if (msgState == 0)
{
- DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
}
else if (msgState == 1)
{
- DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.size, 2, WHITE);
+ DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);
if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);
}
@@ -366,7 +366,7 @@ void DrawLivingroomScreen(void)
{
if ((msgCounter/30)%2)
{
- DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.size*2, 2, WHITE);
+ DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);
DrawRectangleRec(candle.bounds, Fade(RED, 0.6f));
DrawRectangleRec(phone.bounds, Fade(RED, 0.6f));
@@ -400,4 +400,4 @@ void UnloadLivingroomScreen(void)
int FinishLivingroomScreen(void)
{
return finishScreen;
-} \ No newline at end of file
+}
diff --git a/games/skully_escape/screens/screen_logo.c b/games/skully_escape/screens/screen_logo.c
index f07f5f54..3e5e311d 100644
--- a/games/skully_escape/screens/screen_logo.c
+++ b/games/skully_escape/screens/screen_logo.c
@@ -4,7 +4,7 @@
*
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/skully_escape/screens/screen_logo_raylib.c b/games/skully_escape/screens/screen_logo_raylib.c
index e5efe843..1eb6cca4 100644
--- a/games/skully_escape/screens/screen_logo_raylib.c
+++ b/games/skully_escape/screens/screen_logo_raylib.c
@@ -4,7 +4,7 @@
*
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/skully_escape/screens/screen_title.c b/games/skully_escape/screens/screen_title.c
index 837b5112..ad231dcd 100644
--- a/games/skully_escape/screens/screen_title.c
+++ b/games/skully_escape/screens/screen_title.c
@@ -4,7 +4,7 @@
*
* Title Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/skully_escape/screens/screens.h b/games/skully_escape/screens/screens.h
index 790df9ff..ce35ae70 100644
--- a/games/skully_escape/screens/screens.h
+++ b/games/skully_escape/screens/screens.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/skully_escape/skully_escape.c b/games/skully_escape/skully_escape.c
index 83f9732b..fb872955 100644
--- a/games/skully_escape/skully_escape.c
+++ b/games/skully_escape/skully_escape.c
@@ -5,7 +5,7 @@
* 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) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/games/wave_collector/Makefile b/games/wave_collector/Makefile
index bac51ef1..5b4ee0bf 100644
--- a/games/wave_collector/Makefile
+++ b/games/wave_collector/Makefile
@@ -4,7 +4,7 @@
#
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
diff --git a/games/wave_collector/screens/screen_ending.c b/games/wave_collector/screens/screen_ending.c
index d246005c..7dc21965 100644
--- a/games/wave_collector/screens/screen_ending.c
+++ b/games/wave_collector/screens/screen_ending.c
@@ -4,7 +4,7 @@
*
* Ending Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -77,12 +77,12 @@ void DrawEndingScreen(void)
if (endingStatus == 1) // Win
{
DrawTexture(texWin, GetScreenWidth()/2 - texWin.width/2, 90, WHITE);
- DrawTextEx(font, "congrats, you got the wave!", (Vector2){ 200, 335 }, font.size, 0, WHITE);
+ DrawTextEx(font, "congrats, you got the wave!", (Vector2){ 200, 335 }, font.baseSize, 0, WHITE);
}
else if (endingStatus == 2) // Lose
{
DrawTexture(texLose, GetScreenWidth()/2 - texWin.width/2, 90, WHITE);
- DrawTextEx(font, "it seems you lose the wave...", (Vector2){ 205, 335 }, font.size, 0, WHITE);
+ DrawTextEx(font, "it seems you lose the wave...", (Vector2){ 205, 335 }, font.baseSize, 0, WHITE);
}
DrawRectangle(0, GetScreenHeight() - 70, 560, 40, Fade(RAYWHITE, 0.8f));
@@ -91,7 +91,7 @@ void DrawEndingScreen(void)
DrawText("powered by", GetScreenWidth() - 162, GetScreenHeight() - 190, 20, DARKGRAY);
DrawTexture(texLogo, GetScreenWidth() - 128 - 34, GetScreenHeight() - 128 - 36, WHITE);
- if ((framesCounter > 80) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to return", (Vector2){ 300, 464 }, font.size, 0, SKYBLUE);
+ if ((framesCounter > 80) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to return", (Vector2){ 300, 464 }, font.baseSize, 0, SKYBLUE);
}
// Ending Screen Unload logic
diff --git a/games/wave_collector/screens/screen_gameplay.c b/games/wave_collector/screens/screen_gameplay.c
index c35ccad6..4019e64c 100644
--- a/games/wave_collector/screens/screen_gameplay.c
+++ b/games/wave_collector/screens/screen_gameplay.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -399,15 +399,15 @@ void DrawGameplayScreen(void)
DrawTexture(texPlayer, player.position.x - 32, player.position.y - 24, WHITE);
// Draw pause message
- if (pause) DrawTextEx(font, "WAVE PAUSED", (Vector2){ 235, 400 }, font.size*2, 0, WHITE);
+ if (pause) DrawTextEx(font, "WAVE PAUSED", (Vector2){ 235, 400 }, font.baseSize*2, 0, WHITE);
// Draw number of samples
//DrawText(FormatText("%05i", collectedSamples), 900, 200, 40, GRAY);
//DrawText(FormatText("%05i", totalSamples), 900, 250, 40, GRAY);
- DrawTextEx(font, FormatText("%05i / %05i", collectedSamples, totalSamples), (Vector2){810, 170}, font.size, -2, SKYBLUE);
+ DrawTextEx(font, FormatText("%05i / %05i", collectedSamples, totalSamples), (Vector2){810, 170}, font.baseSize, -2, SKYBLUE);
// Draw combo
- DrawTextEx(font, FormatText("Combo: %02i [max: %02i]", combo, maxCombo), (Vector2){200, 170}, font.size/2, -2, SKYBLUE);
+ DrawTextEx(font, FormatText("Combo: %02i [max: %02i]", combo, maxCombo), (Vector2){200, 170}, font.baseSize/2, -2, SKYBLUE);
// Draw synchonicity level
DrawRectangle(99, 622, 395, 32, Fade(RAYWHITE, 0.8f));
@@ -419,15 +419,15 @@ void DrawGameplayScreen(void)
DrawRectangleLines(99, 622, 395, 32, MAROON);
- if (synchro == 1.0f) DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.size, -2, GREEN);
- else DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.size, -2, SKYBLUE);
+ if (synchro == 1.0f) DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.baseSize, -2, GREEN);
+ else DrawTextEx(font, FormatText("%02i%%", (int)(synchro*100)), (Vector2){99 + 390, 600}, font.baseSize, -2, SKYBLUE);
// Draw time warp coool-down bar
DrawRectangle(754, 622, 395, 32, Fade(RAYWHITE, 0.8f));
DrawRectangle(754, 622, warpCounter, 32, Fade(SKYBLUE, 0.8f));
DrawRectangleLines(754, 622, 395, 32, DARKGRAY);
//DrawText(FormatText("%02i%%", (int)(synchro*100)), 754 + 410, 628, 20, DARKGRAY);
- DrawTextEx(font, FormatText("%02i%%", (int)((float)warpCounter/395.0f*100.0f)), (Vector2){754 + 390, 600}, font.size, -2, SKYBLUE);
+ DrawTextEx(font, FormatText("%02i%%", (int)((float)warpCounter/395.0f*100.0f)), (Vector2){754 + 390, 600}, font.baseSize, -2, SKYBLUE);
// Draw wave
// NOTE: Old drawing method, replaced by rendertarget
diff --git a/games/wave_collector/screens/screen_logo.c b/games/wave_collector/screens/screen_logo.c
index e855752e..5f18a321 100644
--- a/games/wave_collector/screens/screen_logo.c
+++ b/games/wave_collector/screens/screen_logo.c
@@ -4,7 +4,7 @@
*
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/wave_collector/screens/screen_title.c b/games/wave_collector/screens/screen_title.c
index 1d33e3ba..5c414f4f 100644
--- a/games/wave_collector/screens/screen_title.c
+++ b/games/wave_collector/screens/screen_title.c
@@ -4,7 +4,7 @@
*
* Title Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
@@ -91,7 +91,7 @@ void DrawTitleScreen(void)
DrawText("powered by", GetScreenWidth() - 162, GetScreenHeight() - 190, 20, DARKGRAY);
DrawTexture(texLogo, GetScreenWidth() - 128 - 34, GetScreenHeight() - 128 - 36, WHITE);
- if ((framesCounter > 160) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to start", (Vector2){ 325, 500 }, font.size, 0, SKYBLUE);
+ if ((framesCounter > 160) && ((framesCounter/40)%2)) DrawTextEx(font, "mouse click to start", (Vector2){ 325, 500 }, font.baseSize, 0, SKYBLUE);
}
// Title Screen Unload logic
diff --git a/games/wave_collector/screens/screens.h b/games/wave_collector/screens/screens.h
index 9c9c5175..1bbcf0fe 100644
--- a/games/wave_collector/screens/screens.h
+++ b/games/wave_collector/screens/screens.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/games/wave_collector/wave_collector.c b/games/wave_collector/wave_collector.c
index 76370319..53b4b713 100644
--- a/games/wave_collector/wave_collector.c
+++ b/games/wave_collector/wave_collector.c
@@ -7,7 +7,7 @@
* The level is actually the wave and the wave is the level!
* Be fast! Be smart! Be the best wave collector!
*
-* This game has been created using raylib (www.raylib.com)
+* This game has been created using raylib v1.7 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
diff --git a/src/Makefile b/src/Makefile
index 4c2278f5..598a9be4 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,7 +1,7 @@
#******************************************************************************
#
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
-#
+#
# Many Thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline.
#
# Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
@@ -153,12 +153,34 @@ endif
# define compiler flags:
# -O1 defines optimization level
+# -Og enable debugging
# -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)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
-CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
+# -D_DEFAULT_SOURCE use with -std=c99 on Linux to enable timespec and drflac
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(PLATFORM_OS),WINDOWS)
+ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
+ endif
+ ifeq ($(PLATFORM_OS),LINUX)
+ CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE
+ endif
+ ifeq ($(PLATFORM_OS),OSX)
+ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
+ endif
+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
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
+endif
+
+#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# if shared library required, make sure code is compiled as position independent
ifeq ($(SHARED),YES)
@@ -243,7 +265,7 @@ OBJS += external/stb_vorbis.o
# typing 'make' will invoke the default target entry called 'all',
# in this case, the 'default' target entry is raylib
-all: toolchain raylib
+all: toolchain raylib
# make standalone Android toolchain
toolchain:
@@ -266,7 +288,7 @@ else
ifeq ($(SHARED),YES)
ifeq ($(PLATFORM_OS),LINUX)
# compile raylib to shared library version for GNU/Linux.
- # WARNING: you should type "make clean" before doing this target
+ # WARNING: you should type "make clean" before doing this target
$(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS)
@echo "raylib shared library (libraylib.so) generated!"
endif
@@ -299,11 +321,11 @@ core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h
# compile rlgl module
rlgl.o : rlgl.c rlgl.h raymath.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(GRAPHICS)
-
+
# compile shapes module
shapes.o : shapes.c raylib.h rlgl.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(SHAREDFLAG)
-
+
# compile textures module
textures.o : textures.c rlgl.h utils.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) -D$(SHAREDFLAG)
@@ -319,7 +341,7 @@ models.o : models.c raylib.h rlgl.h raymath.h
# compile audio module
audio.o : audio.c raylib.h
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) -D$(SHAREDOPENALFLAG)
-
+
# compile stb_vorbis library
external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h
$(CC) -c -o $@ $< -O1 $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
diff --git a/src/audio.c b/src/audio.c
index 659ead0f..5edabf41 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -1,26 +1,22 @@
/**********************************************************************************************
*
-* raylib.audio
+* raylib.audio - Basic funtionality to work with audio
*
-* This module provides basic functionality to work with audio:
-* Manage audio device (init/close)
-* Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
-* Play/Stop/Pause/Resume loaded audio
-* Manage mixing channels
-* Manage raw audio context
-*
-* NOTES:
-*
-* Only up to two channels supported: MONO and STEREO (for additional channels, use AL_EXT_MCFORMATS)
-* Only the following sample sizes supported: 8bit PCM, 16bit PCM, 32-bit float PCM (using AL_EXT_FLOAT32)
+* FEATURES:
+* - Manage audio device (init/close)
+* - Load and unload audio files
+* - Format wave data (sample rate, size, channels)
+* - Play/Stop/Pause/Resume loaded audio
+* - Manage mixing channels
+* - Manage raw audio context
*
* CONFIGURATION:
*
* #define AUDIO_STANDALONE
-* If defined, the module can be used as standalone library (independently of raylib).
+* Define to use the module as standalone library (independently of raylib).
* Required types and functions are defined in the same module.
*
-* #define SUPPORT_FILEFORMAT_WAV / SUPPORT_LOAD_WAV / ENABLE_LOAD_WAV
+* #define SUPPORT_FILEFORMAT_WAV
* #define SUPPORT_FILEFORMAT_OGG
* #define SUPPORT_FILEFORMAT_XM
* #define SUPPORT_FILEFORMAT_MOD
@@ -28,7 +24,10 @@
* Selected desired fileformats to be supported for loading. Some of those formats are
* supported by default, to remove support, just comment unrequired #define in this module
*
-* #define SUPPORT_RAW_AUDIO_BUFFERS
+*
+* LIMITATIONS:
+* Only up to two channels supported: MONO and STEREO (for additional channels, use AL_EXT_MCFORMATS)
+* Only the following sample sizes supported: 8bit PCM, 16bit PCM, 32-bit float PCM (using AL_EXT_FLOAT32)
*
* DEPENDENCIES:
* OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
@@ -38,17 +37,16 @@
* dr_flac - FLAC audio file loading
*
* CONTRIBUTORS:
-*
-* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
-* XM audio module support (jar_xm)
-* MOD audio module support (jar_mod)
-* Mixing channels support
-* Raw audio context support
+* Joshua Reisenauer (github: @kd7tck):
+* - XM audio module support (jar_xm)
+* - MOD audio module support (jar_mod)
+* - Mixing channels support
+* - Raw audio context support
*
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -69,6 +67,12 @@
//#define AUDIO_STANDALONE // NOTE: To use the audio module as standalone lib, just uncomment this line
+// Default configuration flags (supported features)
+//-------------------------------------------------
+#define SUPPORT_FILEFORMAT_WAV
+#define SUPPORT_FILEFORMAT_OGG
+//-------------------------------------------------
+
#if defined(AUDIO_STANDALONE)
#include "audio.h"
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
@@ -93,18 +97,26 @@
#include <string.h> // Required for: strcmp(), strncmp()
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fread()
-//#define STB_VORBIS_HEADER_ONLY
-#include "external/stb_vorbis.h" // OGG loading functions
+#if defined(SUPPORT_FILEFORMAT_OGG)
+ //#define STB_VORBIS_HEADER_ONLY
+ #include "external/stb_vorbis.h" // OGG loading functions
+#endif
-#define JAR_XM_IMPLEMENTATION
-#include "external/jar_xm.h" // XM loading functions
+#if defined(SUPPORT_FILEFORMAT_XM)
+ #define JAR_XM_IMPLEMENTATION
+ #include "external/jar_xm.h" // XM loading functions
+#endif
-#define JAR_MOD_IMPLEMENTATION
-#include "external/jar_mod.h" // MOD loading functions
+#if defined(SUPPORT_FILEFORMAT_MOD)
+ #define JAR_MOD_IMPLEMENTATION
+ #include "external/jar_mod.h" // MOD loading functions
+#endif
-#define DR_FLAC_IMPLEMENTATION
-#define DR_FLAC_NO_WIN32_IO
-#include "external/dr_flac.h" // FLAC loading functions
+#if defined(SUPPORT_FILEFORMAT_FLAC)
+ #define DR_FLAC_IMPLEMENTATION
+ #define DR_FLAC_NO_WIN32_IO
+ #include "external/dr_flac.h" // FLAC loading functions
+#endif
#ifdef _MSC_VER
#undef bool
@@ -139,10 +151,18 @@ typedef enum { MUSIC_AUDIO_OGG = 0, MUSIC_AUDIO_FLAC, MUSIC_MODULE_XM, MUSIC_MOD
// Music type (file streaming from memory)
typedef struct MusicData {
MusicContextType ctxType; // Type of music context (OGG, XM, MOD)
+#if defined(SUPPORT_FILEFORMAT_OGG)
stb_vorbis *ctxOgg; // OGG audio context
+#endif
+#if defined(SUPPORT_FILEFORMAT_FLAC)
drflac *ctxFlac; // FLAC audio context
+#endif
+#if defined(SUPPORT_FILEFORMAT_XM)
jar_xm_context_t *ctxXm; // XM chiptune context
+#endif
+#if defined(SUPPORT_FILEFORMAT_MOD)
jar_mod_context_t ctxMod; // MOD chiptune context
+#endif
AudioStream stream; // Audio stream (double buffering)
@@ -163,9 +183,15 @@ typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
//----------------------------------------------------------------------------------
// Module specific Functions Declaration
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_FILEFORMAT_WAV)
static Wave LoadWAV(const char *fileName); // Load WAV file
+#endif
+#if defined(SUPPORT_FILEFORMAT_OGG)
static Wave LoadOGG(const char *fileName); // Load OGG file
+#endif
+#if defined(SUPPORT_FILEFORMAT_FLAC)
static Wave LoadFLAC(const char *fileName); // Load FLAC file
+#endif
#if defined(AUDIO_STANDALONE)
const char *GetExtension(const char *fileName); // Get the extension for a filename
@@ -260,8 +286,13 @@ Wave LoadWave(const char *fileName)
Wave wave = { 0 };
if (strcmp(GetExtension(fileName), "wav") == 0) wave = LoadWAV(fileName);
+#if defined(SUPPORT_FILEFORMAT_OGG)
else if (strcmp(GetExtension(fileName), "ogg") == 0) wave = LoadOGG(fileName);
+#endif
+#if defined(SUPPORT_FILEFORMAT_FLAC)
else if (strcmp(GetExtension(fileName), "flac") == 0) wave = LoadFLAC(fileName);
+#endif
+#if !defined(AUDIO_STANDALONE)
else if (strcmp(GetExtension(fileName),"rres") == 0)
{
RRES rres = LoadResource(fileName, 0);
@@ -273,7 +304,8 @@ Wave LoadWave(const char *fileName)
UnloadResource(rres);
}
- else TraceLog(WARNING, "[%s] File extension not recognized, it can't be loaded", fileName);
+#endif
+ else TraceLog(WARNING, "[%s] Audio fileformat not supported, it can't be loaded", fileName);
return wave;
}
@@ -663,6 +695,7 @@ Music LoadMusicStream(const char *fileName)
TraceLog(DEBUG, "[%s] OGG memory required: %i", fileName, info.temp_memory_required);
}
}
+#if defined(SUPPORT_FILEFORMAT_FLAC)
else if (strcmp(GetExtension(fileName), "flac") == 0)
{
music->ctxFlac = drflac_open_file(fileName);
@@ -682,6 +715,8 @@ Music LoadMusicStream(const char *fileName)
TraceLog(DEBUG, "[%s] FLAC channels: %i", fileName, music->ctxFlac->channels);
}
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_XM)
else if (strcmp(GetExtension(fileName), "xm") == 0)
{
int result = jar_xm_create_context_from_file(&music->ctxXm, 48000, fileName);
@@ -702,6 +737,8 @@ Music LoadMusicStream(const char *fileName)
}
else TraceLog(WARNING, "[%s] XM file could not be opened", fileName);
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_MOD)
else if (strcmp(GetExtension(fileName), "mod") == 0)
{
jar_mod_init(&music->ctxMod);
@@ -719,7 +756,8 @@ Music LoadMusicStream(const char *fileName)
}
else TraceLog(WARNING, "[%s] MOD file could not be opened", fileName);
}
- else TraceLog(WARNING, "[%s] Music extension not recognized, it can't be loaded", fileName);
+#endif
+ else TraceLog(WARNING, "[%s] Audio fileformat not supported, it can't be loaded", fileName);
return music;
}
@@ -730,9 +768,15 @@ void UnloadMusicStream(Music music)
CloseAudioStream(music->stream);
if (music->ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close(music->ctxOgg);
+#if defined(SUPPORT_FILEFORMAT_FLAC)
else if (music->ctxType == MUSIC_AUDIO_FLAC) drflac_free(music->ctxFlac);
+#endif
+#if defined(SUPPORT_FILEFORMAT_XM)
else if (music->ctxType == MUSIC_MODULE_XM) jar_xm_free_context(music->ctxXm);
+#endif
+#if defined(SUPPORT_FILEFORMAT_MOD)
else if (music->ctxType == MUSIC_MODULE_MOD) jar_mod_unload(&music->ctxMod);
+#endif
free(music);
}
@@ -777,8 +821,15 @@ void StopMusicStream(Music music)
switch (music->ctxType)
{
case MUSIC_AUDIO_OGG: stb_vorbis_seek_start(music->ctxOgg); break;
+#if defined(SUPPORT_FILEFORMAT_FLAC)
+ case MUSIC_MODULE_FLAC: /* TODO: Restart FLAC context */ break;
+#endif
+#if defined(SUPPORT_FILEFORMAT_XM)
case MUSIC_MODULE_XM: /* TODO: Restart XM context */ break;
+#endif
+#if defined(SUPPORT_FILEFORMAT_MOD)
case MUSIC_MODULE_MOD: jar_mod_seek_start(&music->ctxMod); break;
+#endif
default: break;
}
@@ -820,14 +871,20 @@ void UpdateMusicStream(Music music)
int numSamplesOgg = stb_vorbis_get_samples_short_interleaved(music->ctxOgg, music->stream.channels, (short *)pcm, samplesCount*music->stream.channels);
} break;
+ #if defined(SUPPORT_FILEFORMAT_FLAC)
case MUSIC_AUDIO_FLAC:
{
// NOTE: Returns the number of samples to process
unsigned int numSamplesFlac = (unsigned int)drflac_read_s16(music->ctxFlac, samplesCount*music->stream.channels, (short *)pcm);
} break;
+ #endif
+ #if defined(SUPPORT_FILEFORMAT_XM)
case MUSIC_MODULE_XM: jar_xm_generate_samples_16bit(music->ctxXm, pcm, samplesCount); break;
+ #endif
+ #if defined(SUPPORT_FILEFORMAT_MOD)
case MUSIC_MODULE_MOD: jar_mod_fillbuffer(&music->ctxMod, pcm, samplesCount, 0); break;
+ #endif
default: break;
}
@@ -1066,6 +1123,7 @@ void StopAudioStream(AudioStream stream)
// Module specific Functions Definition
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_FILEFORMAT_WAV)
// Load WAV file into Wave structure
static Wave LoadWAV(const char *fileName)
{
@@ -1182,7 +1240,9 @@ static Wave LoadWAV(const char *fileName)
return wave;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_OGG)
// Load OGG file into Wave structure
// NOTE: Using stb_vorbis library
static Wave LoadOGG(const char *fileName)
@@ -1206,7 +1266,7 @@ static Wave LoadOGG(const char *fileName)
wave.sampleCount = (int)stb_vorbis_stream_length_in_samples(oggFile);
float totalSeconds = stb_vorbis_stream_length_in_seconds(oggFile);
- if (totalSeconds > 10) TraceLog(WARNING, "[%s] Ogg audio lenght is larger than 10 seconds (%f), that's a big file in memory, consider music streaming", fileName, totalSeconds);
+ if (totalSeconds > 10) TraceLog(WARNING, "[%s] Ogg audio length is larger than 10 seconds (%f), that's a big file in memory, consider music streaming", fileName, totalSeconds);
wave.data = (short *)malloc(wave.sampleCount*wave.channels*sizeof(short));
@@ -1222,7 +1282,9 @@ static Wave LoadOGG(const char *fileName)
return wave;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_FLAC)
// Load FLAC file into Wave structure
// NOTE: Using dr_flac library
static Wave LoadFLAC(const char *fileName)
@@ -1244,6 +1306,7 @@ static Wave LoadFLAC(const char *fileName)
return wave;
}
+#endif
// Some required functions for audio standalone module version
#if defined(AUDIO_STANDALONE)
diff --git a/src/audio.h b/src/audio.h
index 01ed9f72..51f858da 100644
--- a/src/audio.h
+++ b/src/audio.h
@@ -1,31 +1,37 @@
/**********************************************************************************************
*
-* raylib.audio
+* raylib.audio - Basic funtionality to work with audio
*
-* This module provides basic functionality to work with audio:
-* Manage audio device (init/close)
-* Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
-* Play/Stop/Pause/Resume loaded audio
-* Manage mixing channels
-* Manage raw audio context
+* FEATURES:
+* - Manage audio device (init/close)
+* - Load and unload audio files
+* - Format wave data (sample rate, size, channels)
+* - Play/Stop/Pause/Resume loaded audio
+* - Manage mixing channels
+* - Manage raw audio context
+*
+* LIMITATIONS:
+* Only up to two channels supported: MONO and STEREO (for additional channels, use AL_EXT_MCFORMATS)
+* Only the following sample sizes supported: 8bit PCM, 16bit PCM, 32-bit float PCM (using AL_EXT_FLOAT32)
*
* DEPENDENCIES:
* OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
* stb_vorbis - OGG audio files loading (http://www.nothings.org/stb_vorbis/)
-* jar_xm - XM module file loading
-* jar_mod - MOD audio file loading
-* dr_flac - FLAC audio file loading
+* jar_xm - XM module file loading (#define SUPPORT_FILEFORMAT_XM)
+* jar_mod - MOD audio file loading (#define SUPPORT_FILEFORMAT_MOD)
+* dr_flac - FLAC audio file loading (#define SUPPORT_FILEFORMAT_FLAC)
*
-* Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
-* XM audio module support (jar_xm)
-* MOD audio module support (jar_mod)
-* Mixing channels support
-* Raw audio context support
+* CONTRIBUTORS:
+* Joshua Reisenauer (github: @kd7tck):
+* - XM audio module support (jar_xm)
+* - MOD audio module support (jar_mod)
+* - Mixing channels support
+* - Raw audio context support
*
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -148,7 +154,7 @@ float GetMusicTimePlayed(Music music); // Get current m
AudioStream InitAudioStream(unsigned int sampleRate,
unsigned int sampleSize,
unsigned int channels); // Init audio stream (to stream raw audio pcm data)
-void UpdateAudioStream(AudioStream stream, void *data, int samplesCount); // Update audio stream buffers with data
+void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount); // Update audio stream buffers with data
void CloseAudioStream(AudioStream stream); // Close audio stream and free memory
bool IsAudioBufferProcessed(AudioStream stream); // Check if any audio stream buffers requires refill
void PlayAudioStream(AudioStream stream); // Play audio stream
diff --git a/src/camera.h b/src/camera.h
index 87ba1942..e1b00ac2 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -1,6 +1,6 @@
/*******************************************************************************************
*
-* raylib Camera System - Camera Modes Setup and Control Functions
+* raylib.camera - Camera system with multiple modes support
*
* NOTE: Memory footprint of this library is aproximately 52 bytes (global variables)
*
@@ -22,7 +22,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2015-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2015-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.
diff --git a/src/core.c b/src/core.c
index c0f5be83..5a1ab77f 100644
--- a/src/core.c
+++ b/src/core.c
@@ -2,7 +2,14 @@
*
* raylib.core - Basic functions to manage windows, OpenGL context and input on multiple platforms
*
-* The following platforms are supported: Windows, Linux, Mac (OSX), Android, Raspberry Pi, HTML5, Oculus Rift CV1
+* PLATFORMS SUPPORTED:
+* - Windows (win32/Win64)
+* - Linux (tested on Ubuntu)
+* - Mac (OSX)
+* - Android (API Level 9 or greater)
+* - Raspberry Pi (Raspbian)
+* - HTML5 (Chrome, Firefox)
+* - Oculus Rift CV1
*
* CONFIGURATION:
*
@@ -22,13 +29,15 @@
* Windowing and input system configured for HTML5 (run on browser), code converted from C to asm.js
* using emscripten compiler. OpenGL ES 2.0 required for direct translation to WebGL equivalent code.
*
-* #define LOAD_DEFAULT_FONT (defined by default)
+* #define SUPPORT_DEFAULT_FONT (default)
* Default font is loaded on window initialization to be available for the user to render simple text.
* NOTE: If enabled, uses external module functions to load default raylib font (module: text)
*
-* #define INCLUDE_CAMERA_SYSTEM / SUPPORT_CAMERA_SYSTEM
+* #define SUPPORT_CAMERA_SYSTEM
+* Camera module is included (camera.h) and multiple predefined cameras are available: free, 1st/3rd person, orbital
*
-* #define INCLUDE_GESTURES_SYSTEM / SUPPORT_GESTURES_SYSTEM
+* #define SUPPORT_GESTURES_SYSTEM
+* Gestures module is included (gestures.h) to support gestures detection: tap, hold, swipe, drag
*
* #define SUPPORT_MOUSE_GESTURES
* Mouse gestures are directly mapped like touches and processed by gestures system.
@@ -42,7 +51,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -61,6 +70,14 @@
*
**********************************************************************************************/
+// Default configuration flags (supported features)
+//-------------------------------------------------
+#define SUPPORT_DEFAULT_FONT
+#define SUPPORT_MOUSE_GESTURES
+#define SUPPORT_CAMERA_SYSTEM
+#define SUPPORT_GESTURES_SYSTEM
+//-------------------------------------------------
+
#include "raylib.h"
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
@@ -70,10 +87,12 @@
#define RAYMATH_EXTERN_INLINE // Compile raymath functions as static inline (remember, it's a compiler hint)
#include "raymath.h" // Required for: Vector3 and Matrix functions
-#define GESTURES_IMPLEMENTATION
-#include "gestures.h" // Gestures detection functionality
+#if defined(SUPPORT_GESTURES_SYSTEM)
+ #define GESTURES_IMPLEMENTATION
+ #include "gestures.h" // Gestures detection functionality
+#endif
-#if !defined(PLATFORM_ANDROID)
+#if defined(SUPPORT_CAMERA_SYSTEM) && !defined(PLATFORM_ANDROID)
#define CAMERA_IMPLEMENTATION
#include "camera.h" // Camera system functionality
#endif
@@ -86,7 +105,7 @@
#include <string.h> // Required for: strcmp()
//#include <errno.h> // Macros for reporting and retrieving error conditions through error codes
-#if defined __linux || defined(PLATFORM_WEB)
+#if defined __linux__ || defined(PLATFORM_WEB)
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
#elif defined __APPLE__
#include <unistd.h> // Required for: usleep()
@@ -96,7 +115,7 @@
//#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
- #ifdef __linux
+ #ifdef __linux__
#define GLFW_EXPOSE_NATIVE_X11 // Linux specific definitions for getting
#define GLFW_EXPOSE_NATIVE_GLX // native functions like glfwGetX11Window
#include <GLFW/glfw3native.h> // which are required for hiding mouse
@@ -140,8 +159,6 @@
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
-#define STORAGE_FILENAME "storage.data"
-
#if defined(PLATFORM_RPI)
// Old device inputs system
#define DEFAULT_KEYBOARD_DEV STDIN_FILENO // Standard input
@@ -161,7 +178,7 @@
#define MAX_GAMEPAD_BUTTONS 32 // Max bumber of buttons supported (per gamepad)
#define MAX_GAMEPAD_AXIS 8 // Max number of axis supported (per gamepad)
-#define LOAD_DEFAULT_FONT // Load default font on window initialization (module: text)
+#define STORAGE_FILENAME "storage.data"
//----------------------------------------------------------------------------------
// Types and Structures Definition
@@ -259,7 +276,10 @@ static int lastGamepadButtonPressed = -1; // Register last gamepad button pres
static int gamepadAxisCount = 0; // Register number of available gamepad axis
static Vector2 mousePosition; // Mouse position on screen
+
+#if defined(SUPPORT_GESTURES_SYSTEM)
static Vector2 touchPosition[MAX_TOUCH_POINTS]; // Touch position on screen
+#endif
#if defined(PLATFORM_DESKTOP)
static char **dropFilesPath; // Store dropped files paths as strings
@@ -277,7 +297,7 @@ static bool showLogo = false; // Track if showing logo at init is
//----------------------------------------------------------------------------------
// Other Modules Functions Declaration (required by core)
//----------------------------------------------------------------------------------
-#if defined(LOAD_DEFAULT_FONT)
+#if defined(SUPPORT_DEFAULT_FONT)
extern void LoadDefaultFont(void); // [Module: text] Loads default font on InitWindow()
extern void UnloadDefaultFont(void); // [Module: text] Unloads default font from GPU memory
#endif
@@ -359,7 +379,7 @@ void InitWindow(int width, int height, const char *title)
// Init graphics device (display device and OpenGL context)
InitGraphicsDevice(width, height);
-#if defined(LOAD_DEFAULT_FONT)
+#if defined(SUPPORT_DEFAULT_FONT)
// Load default font
// NOTE: External function (defined in module: text)
LoadDefaultFont();
@@ -471,7 +491,7 @@ void InitWindow(int width, int height, void *state)
// Close Window and Terminate Context
void CloseWindow(void)
{
-#if defined(LOAD_DEFAULT_FONT)
+#if defined(SUPPORT_DEFAULT_FONT)
UnloadDefaultFont();
#endif
@@ -621,7 +641,7 @@ int GetScreenHeight(void)
void ShowCursor()
{
#if defined(PLATFORM_DESKTOP)
- #ifdef __linux
+ #ifdef __linux__
XUndefineCursor(glfwGetX11Display(), glfwGetX11Window(window));
#else
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
@@ -634,7 +654,7 @@ void ShowCursor()
void HideCursor()
{
#if defined(PLATFORM_DESKTOP)
- #ifdef __linux
+ #ifdef __linux__
XColor col;
const char nil[] = {0};
@@ -755,11 +775,8 @@ void End2dMode(void)
void Begin3dMode(Camera camera)
{
rlglDraw(); // Draw Buffers (Only OpenGL 3+ and ES2)
-
- if (IsVrDeviceReady() || IsVrSimulator()) BeginVrDrawing();
-
+
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
-
rlPushMatrix(); // Save previous matrix, which contains the settings for the 2d ortho projection
rlLoadIdentity(); // Reset current matrix (PROJECTION)
@@ -786,8 +803,6 @@ void End3dMode(void)
{
rlglDraw(); // Process internal buffers (update + draw)
- if (IsVrDeviceReady() || IsVrSimulator()) EndVrDrawing();
-
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
rlPopMatrix(); // Restore previous matrix (PROJECTION) from matrix stack
@@ -2011,7 +2026,7 @@ static double GetTime(void)
// Wait for some milliseconds (stop program execution)
static void Wait(float ms)
{
-#define SUPPORT_BUSY_WAIT_LOOP
+//#define SUPPORT_BUSY_WAIT_LOOP
#if defined(SUPPORT_BUSY_WAIT_LOOP)
double prevTime = GetTime();
double nextTime = 0.0;
@@ -2021,7 +2036,7 @@ static void Wait(float ms)
#else
#if defined _WIN32
Sleep(ms);
- #elif defined __linux || defined(PLATFORM_WEB)
+ #elif defined __linux__ || defined(PLATFORM_WEB)
struct timespec req = { 0 };
time_t sec = (int)(ms/1000.0f);
ms -= (sec*1000);
@@ -2069,9 +2084,11 @@ static bool GetMouseButtonStatus(int button)
// Poll (store) all input events
static void PollInputEvents(void)
{
+#if defined(SUPPORT_GESTURES_SYSTEM)
// NOTE: Gestures update must be called every frame to reset gestures correctly
// because ProcessGestureEvent() is just called on an event, not every frame
UpdateGestures();
+#endif
// Reset last key pressed registered
lastKeyPressed = -1;
@@ -2301,8 +2318,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
{
currentMouseState[button] = action;
-#define ENABLE_MOUSE_GESTURES
-#if defined(ENABLE_MOUSE_GESTURES)
+#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES)
// Process mouse events as touches to be able to use mouse-gestures
GestureEvent gestureEvent;
@@ -2333,8 +2349,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
// GLFW3 Cursor Position Callback, runs on mouse move
static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
{
-#define ENABLE_MOUSE_GESTURES
-#if defined(ENABLE_MOUSE_GESTURES)
+#if defined(SUPPORT_GESTURES_SYSTEM) && defined(SUPPORT_MOUSE_GESTURES)
// Process mouse events as touches to be able to use mouse-gestures
GestureEvent gestureEvent;
@@ -2464,7 +2479,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
// Init graphics device (display device and OpenGL context)
InitGraphicsDevice(screenWidth, screenHeight);
- #if defined(LOAD_DEFAULT_FONT)
+ #if defined(SUPPORT_DEFAULT_FONT)
// Load default font
// NOTE: External function (defined in module: text)
LoadDefaultFont();
diff --git a/src/easings.h b/src/easings.h
index 527970ab..9ad27313 100644
--- a/src/easings.h
+++ b/src/easings.h
@@ -122,7 +122,7 @@ EASEDEF float EaseCubicOut(float t, float b, float c, float d) { return (c*((t=t
EASEDEF float EaseCubicInOut(float t, float b, float c, float d)
{
if ((t/=d/2) < 1) return (c/2*t*t*t + b);
- return (c/2*((t-=2)*t*t + 2) + b);
+ return (c/2*((t-=2)*t*t + 2) + b);
}
// Quadratic Easing functions
diff --git a/src/gestures.h b/src/gestures.h
index 99f49d2a..c97871e5 100644
--- a/src/gestures.h
+++ b/src/gestures.h
@@ -1,6 +1,6 @@
/**********************************************************************************************
*
-* raylib Gestures System - Gestures Processing based on input gesture events (touch/mouse)
+* raylib.gestures - Gestures system, gestures processing based on input events (touch/mouse)
*
* NOTE: Memory footprint of this library is aproximately 128 bytes (global variables)
*
@@ -24,7 +24,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -147,7 +147,7 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang
// Functions required to query time on Windows
int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
-#elif defined(__linux)
+#elif defined(__linux__)
#include <sys/time.h> // Required for: timespec
#include <time.h> // Required for: clock_gettime()
#endif
@@ -517,7 +517,7 @@ static double GetCurrentTime(void)
time = (double)currentTime/clockFrequency*1000.0f; // Time in miliseconds
#endif
-#if defined(__linux)
+#if defined(__linux__)
// NOTE: Only for Linux-based systems
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
diff --git a/src/models.c b/src/models.c
index bef19e10..6aff59c4 100644
--- a/src/models.c
+++ b/src/models.c
@@ -1,17 +1,19 @@
/**********************************************************************************************
*
-* raylib.models - Basic functions to draw 3d shapes and 3d models
+* raylib.models - Basic functions to deal with 3d shapes and 3d models
*
* CONFIGURATION:
*
-* #define SUPPORT_FILEFORMAT_OBJ / SUPPORT_LOAD_OBJ
+* #define SUPPORT_FILEFORMAT_OBJ
+* Selected desired fileformats to be supported for loading.
*
* #define SUPPORT_FILEFORMAT_MTL
+* Selected desired fileformats to be supported for loading.
*
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -30,6 +32,12 @@
*
**********************************************************************************************/
+// Default configuration flags (supported features)
+//-------------------------------------------------
+#define SUPPORT_FILEFORMAT_OBJ
+#define SUPPORT_FILEFORMAT_MTL
+//-------------------------------------------------
+
#include "raylib.h"
#if defined(PLATFORM_ANDROID)
@@ -61,8 +69,12 @@
//----------------------------------------------------------------------------------
// Module specific Functions Declaration
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_FILEFORMAT_OBJ)
static Mesh LoadOBJ(const char *fileName); // Load OBJ mesh data
+#endif
+#if defined(SUPPORT_FILEFORMAT_MTL)
static Material LoadMTL(const char *fileName); // Load MTL material data
+#endif
static Mesh GenMeshHeightmap(Image image, Vector3 size);
static Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
@@ -580,8 +592,11 @@ Mesh LoadMesh(const char *fileName)
{
Mesh mesh = { 0 };
+#if defined(SUPPORT_FILEFORMAT_OBJ)
if (strcmp(GetExtension(fileName), "obj") == 0) mesh = LoadOBJ(fileName);
- else TraceLog(WARNING, "[%s] Mesh extension not recognized, it can't be loaded", fileName);
+#else
+ TraceLog(WARNING, "[%s] Mesh fileformat not supported, it can't be loaded", fileName);
+#endif
if (mesh.vertexCount == 0) TraceLog(WARNING, "Mesh could not be loaded");
else rlglLoadMesh(&mesh, false); // Upload vertex data to GPU (static mesh)
@@ -690,8 +705,11 @@ Material LoadMaterial(const char *fileName)
{
Material material = { 0 };
+#if defined(SUPPORT_FILEFORMAT_MTL)
if (strcmp(GetExtension(fileName), "mtl") == 0) material = LoadMTL(fileName);
- else TraceLog(WARNING, "[%s] Material extension not recognized, it can't be loaded", fileName);
+#else
+ TraceLog(WARNING, "[%s] Material fileformat not supported, it can't be loaded", fileName);
+#endif
return material;
}
@@ -1588,6 +1606,7 @@ BoundingBox CalculateBoundingBox(Mesh mesh)
// Module specific Functions Definition
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_FILEFORMAT_OBJ)
// Load OBJ mesh data
static Mesh LoadOBJ(const char *fileName)
{
@@ -1836,7 +1855,9 @@ static Mesh LoadOBJ(const char *fileName)
return mesh;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_MTL)
// Load MTL material data (specs: http://paulbourke.net/dataformats/mtl/)
// NOTE: Texture map parameters are not supported
static Material LoadMTL(const char *fileName)
@@ -2000,3 +2021,4 @@ static Material LoadMTL(const char *fileName)
return material;
}
+#endif
diff --git a/src/physac.h b/src/physac.h
index ff56615d..1aa0adee 100644
--- a/src/physac.h
+++ b/src/physac.h
@@ -249,7 +249,7 @@ PHYSACDEF void ClosePhysics(void);
// Functions required to query time on Windows
int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
-#elif defined(__linux) || defined(PLATFORM_WEB)
+#elif defined(__linux__) || defined(PLATFORM_WEB)
#include <sys/time.h> // Required for: timespec
#include <time.h> // Required for: clock_gettime()
#include <stdint.h>
@@ -277,7 +277,7 @@ PHYSACDEF void ClosePhysics(void);
static unsigned int usedMemory = 0; // Total allocated dynamic memory
static bool physicsThreadEnabled = false; // Physics thread enabled state
static double currentTime = 0; // Current time in milliseconds
-#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux) || defined(PLATFORM_WEB)
+#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux__) || defined(PLATFORM_WEB)
static double baseTime = 0; // Android and RPI platforms base time
#endif
static double startTime = 0; // Start time in milliseconds
@@ -1906,7 +1906,7 @@ static double GetCurrentTime(void)
time = (double)((double)currentTime/clockFrequency)*1000;
#endif
- #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux) || defined(PLATFORM_WEB)
+ #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(__linux__) || defined(PLATFORM_WEB)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
uint64_t temp = (uint64_t)ts.tv_sec*1000000000LLU + (uint64_t)ts.tv_nsec;
diff --git a/src/raylib.h b/src/raylib.h
index b0f03bbe..24d6e1fd 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1,43 +1,45 @@
/**********************************************************************************************
*
-* raylib v1.7.0 (www.raylib.com)
+* raylib v1.7.0
*
-* A simple and easy-to-use library to learn videogames programming
+* A simple and easy-to-use library to learn videogames programming (www.raylib.com)
*
* FEATURES:
-* Library written in plain C code (C99)
-* Uses PascalCase/camelCase notation
-* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
-* Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
-* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
-* Multiple textures support, including compressed formats and mipmaps generation
-* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
-* Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
-* Audio loading and playing with streaming support and mixing channels [audio]
-* VR stereo rendering support with configurable HMD device parameters
-* Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
-* Custom color palette for fancy visuals on raywhite background
-* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
-* Complete binding for Lua [rlua]
+* - Library written in plain C code (C99)
+* - Uses PascalCase/camelCase notation
+* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
+* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
+* - Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF)
+* - Multiple textures support, including compressed formats and mipmaps generation
+* - Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
+* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
+* - Audio loading and playing with streaming support and mixing channels: [audio]
+* - VR stereo rendering support with configurable HMD device parameters
+* - Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1
+* - Custom color palette for fancy visuals on raywhite background
+* - Minimal external dependencies (GLFW3, OpenGL, OpenAL)
+* - Complete bindings for Lua, Go and Pascal
*
* NOTES:
-* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
-* One custom default font could be loaded automatically when InitWindow() [core]
-* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
-* If using OpenGL 3.3 or ES2, two default shaders could be loaded automatically (internally defined)
+* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
+* One custom default font could be loaded automatically when InitWindow() [core]
+* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
+* If using OpenGL 3.3 or ES2, two default shaders could be loaded automatically (internally defined)
*
* DEPENDENCIES:
-* GLFW3 (www.glfw.org) for window/context management and input [core]
-* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
-* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
-* stb_image_write (Sean Barret) for image writting (PNG) [utils]
-* stb_truetype (Sean Barret) for ttf fonts loading [text]
-* stb_vorbis (Sean Barret) for ogg audio loading [audio]
-* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
-* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
-* dr_flac (David Reid) for FLAC audio file loading [audio]
-* OpenAL Soft for audio device/context management [audio]
-* tinfl for data decompression (DEFLATE algorithm) [utils]
+* GLFW3 (www.glfw.org) for window/context management and input [core]
+* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
+* OpenAL Soft for audio device/context management [audio]
+*
+* OPTIONAL DEPENDENCIES:
+* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
+* stb_image_write (Sean Barret) for image writting (PNG) [utils]
+* stb_truetype (Sean Barret) for ttf fonts loading [text]
+* stb_vorbis (Sean Barret) for ogg audio loading [audio]
+* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
+* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
+* dr_flac (David Reid) for FLAC audio file loading [audio]
+* tinfl for data decompression (DEFLATE algorithm) [rres]
*
*
* LICENSE: zlib/libpng
@@ -45,7 +47,7 @@
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software:
*
-* Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
+* 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.
@@ -687,6 +689,7 @@ RLAPI Color Fade(Color color, float alpha); // Color fade-
RLAPI void SetConfigFlags(char flags); // Setup some window configuration flags
RLAPI void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
+//RLAPI void TraceLog(int logType, const char *text, ...); // Trace log messages showing (INFO, WARNING, ERROR, DEBUG)
RLAPI bool IsFileDropped(void); // Check if a file have been dropped into window
RLAPI char **GetDroppedFiles(int *count); // Retrieve dropped files into window
@@ -764,6 +767,7 @@ RLAPI void DrawPixelV(Vector2 position, Color color);
RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw a line
RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version)
RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line defining thickness
+RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line using cubic-bezier curves in-out
RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle
RLAPI void DrawCircleGradient(int centerX, int centerY, float radius, Color color1, Color color2); // Draw a gradient-filled circle
RLAPI void DrawCircleV(Vector2 center, float radius, Color color); // Draw a color-filled circle (Vector version)
@@ -943,12 +947,13 @@ RLAPI void EndBlendMode(void); // End
// VR experience Functions (Module: rlgl)
// NOTE: This functions are useless when using OpenGL 1.1
//------------------------------------------------------------------------------------
-RLAPI void InitVrDevice(int vdDevice); // Init VR device
-RLAPI void CloseVrDevice(void); // Close VR device
-RLAPI bool IsVrDeviceReady(void); // Detect if VR device is ready
-RLAPI bool IsVrSimulator(void); // Detect if VR simulator is running
-RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
-RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
+RLAPI void InitVrSimulator(int vrDevice); // Init VR simulator for selected device
+RLAPI void CloseVrSimulator(void); // Close VR simulator for current device
+RLAPI bool IsVrSimulatorReady(void); // Detect if VR device is ready
+RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
+RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
+RLAPI void BeginVrDrawing(void); // Begin VR simulator stereo rendering
+RLAPI void EndVrDrawing(void); // End VR simulator stereo rendering
//------------------------------------------------------------------------------------
// Audio Loading and Playing Functions (Module: audio)
diff --git a/src/raymath.h b/src/raymath.h
index a2263f19..7e760957 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -1,6 +1,6 @@
/**********************************************************************************************
*
-* raymath v1.0 - Some useful functions to work with Vector3, Matrix and Quaternions
+* raymath v1.0 - Math functions to work with Vector3, Matrix and Quaternions
*
* CONFIGURATION:
*
diff --git a/src/rlgl.c b/src/rlgl.c
index ffc9d741..546fbe6e 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -2,10 +2,8 @@
*
* rlgl - raylib OpenGL abstraction layer
*
-* DESCRIPTION:
-*
-* rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
-* selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
+* rlgl is a wrapper for multiple OpenGL versions (1.1, 2.1, 3.3 Core, ES 2.0) to
+* pseudo-OpenGL 1.1 style functions (rlVertex, rlTranslate, rlRotate...).
*
* When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal
* VBO buffers (and VAOs if available). It requires calling 3 functions:
@@ -16,34 +14,19 @@
* CONFIGURATION:
*
* #define GRAPHICS_API_OPENGL_11
-* Use OpenGL 1.1 backend
-*
* #define GRAPHICS_API_OPENGL_21
-* Use OpenGL 2.1 backend
-*
* #define GRAPHICS_API_OPENGL_33
-* Use OpenGL 3.3 Core profile backend
-*
* #define GRAPHICS_API_OPENGL_ES2
-* Use OpenGL ES 2.0 backend
+* Use selected OpenGL backend
*
* #define RLGL_STANDALONE
* Use rlgl as standalone library (no raylib dependency)
*
-* #define RLGL_NO_DISTORTION_SHADER
-* Avoid stereo rendering distortion sahder (shader_distortion.h) inclusion
-*
-* #define SUPPORT_SHADER_DEFAULT / ENABLE_SHADER_DEFAULT
-*
-* #define SUPPORT_SHADER_DISTORTION
-*
+* #define SUPPORT_VR_SIMULATION / SUPPORT_STEREO_RENDERING
+* Support VR simulation functionality (stereo rendering)
*
-* #define SUPPORT_OCULUS_RIFT_CV1 / RLGL_OCULUS_SUPPORT
-* Enable Oculus Rift CV1 functionality
-*
-* #define SUPPORT_STEREO_RENDERING
-*
-* #define RLGL_NO_DEFAULT_SHADER
+* #define SUPPORT_DISTORTION_SHADER
+* Include stereo rendering distortion shader (shader_distortion.h)
*
* DEPENDENCIES:
* raymath - 3D math functionality (Vector3, Matrix, Quaternion)
@@ -52,7 +35,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -71,6 +54,11 @@
*
**********************************************************************************************/
+// Default configuration flags (supported features)
+//-------------------------------------------------
+#define SUPPORT_VR_SIMULATION
+//-------------------------------------------------
+
#include "rlgl.h"
#include <stdio.h> // Required for: fopen(), fclose(), fread()... [Used only on LoadText()]
@@ -117,21 +105,10 @@
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [Used only on TraceLog()]
#endif
-#if !defined(GRAPHICS_API_OPENGL_11) && !defined(RLGL_NO_DISTORTION_SHADER)
+#if !defined(GRAPHICS_API_OPENGL_11) && defined(SUPPORT_DISTORTION_SHADER)
#include "shader_distortion.h" // Distortion shader to be embedded
#endif
-//#define RLGL_OCULUS_SUPPORT // Enable Oculus Rift code
-#if defined(RLGL_OCULUS_SUPPORT)
- #include "external/OculusSDK/LibOVR/Include/OVR_CAPI_GL.h" // Oculus SDK for OpenGL
-#endif
-
-#if defined(RLGL_STANDALONE)
- #define OCULUSAPI
-#else
- #define OCULUSAPI static
-#endif
-
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
@@ -187,15 +164,15 @@
#endif
#if defined(GRAPHICS_API_OPENGL_11)
- #define GL_UNSIGNED_SHORT_5_6_5 0x8363
- #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
- #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+ #define GL_UNSIGNED_SHORT_5_6_5 0x8363
+ #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+ #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
#endif
#if defined(GRAPHICS_API_OPENGL_ES2)
- #define glClearDepth glClearDepthf
- #define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
- #define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
+ #define glClearDepth glClearDepthf
+ #define GL_READ_FRAMEBUFFER GL_FRAMEBUFFER
+ #define GL_DRAW_FRAMEBUFFER GL_FRAMEBUFFER
#endif
// Default vertex attribute names on shader to set location points
@@ -267,32 +244,6 @@ typedef struct VrStereoConfig {
Matrix eyesViewOffset[2]; // VR stereo rendering eyes view offset matrices
} VrStereoConfig;
-#if defined(RLGL_OCULUS_SUPPORT)
-typedef struct OculusBuffer {
- ovrTextureSwapChain textureChain;
- GLuint depthId;
- GLuint fboId;
- int width;
- int height;
-} OculusBuffer;
-
-typedef struct OculusMirror {
- ovrMirrorTexture texture;
- GLuint fboId;
- int width;
- int height;
-} OculusMirror;
-
-typedef struct OculusLayer {
- ovrViewScaleDesc viewScaleDesc;
- ovrLayerEyeFov eyeLayer; // layer 0
- //ovrLayerQuad quadLayer; // TODO: layer 1: '2D' quad for GUI
- Matrix eyeProjections[2];
- int width;
- int height;
-} OculusLayer;
-#endif
-
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
@@ -305,7 +256,7 @@ static Matrix projection;
static Matrix *currentMatrix;
static int currentMatrixMode;
-static DrawMode currentDrawMode;
+static int currentDrawMode;
static float currentDepth = -1.0f;
@@ -334,6 +285,13 @@ static bool texCompETC1Supported = false; // ETC1 texture compression support
static bool texCompETC2Supported = false; // ETC2/EAC texture compression support
static bool texCompPVRTSupported = false; // PVR texture compression support
static bool texCompASTCSupported = false; // ASTC texture compression support
+
+// VR global variables
+static VrDeviceInfo hmd; // Current VR device info
+static VrStereoConfig vrConfig; // VR stereo configuration for simulator
+static bool vrSimulatorReady = false; // VR simulator ready flag
+static bool vrStereoRender = false; // VR stereo rendering enabled/disabled flag
+ // NOTE: This flag is useful to render data over stereo image (i.e. FPS)
#endif
// Extension supported flag: Anisotropic filtering
@@ -343,26 +301,6 @@ static float maxAnisotropicLevel = 0.0f; // Maximum anisotropy level supp
// Extension supported flag: Clamp mirror wrap mode
static bool texClampMirrorSupported = false; // Clamp mirror wrap mode supported
-#if defined(RLGL_OCULUS_SUPPORT)
-// OVR device variables
-static ovrSession session; // Oculus session (pointer to ovrHmdStruct)
-static ovrHmdDesc hmdDesc; // Oculus device descriptor parameters
-static ovrGraphicsLuid luid; // Oculus locally unique identifier for the program (64 bit)
-static OculusLayer layer; // Oculus drawing layer (similar to photoshop)
-static OculusBuffer buffer; // Oculus internal buffers (texture chain and fbo)
-static OculusMirror mirror; // Oculus mirror texture and fbo
-static unsigned int frameIndex = 0; // Oculus frames counter, used to discard frames from chain
-#endif
-
-// VR global variables
-static VrDeviceInfo hmd; // Current VR device info
-static VrStereoConfig vrConfig; // VR stereo configuration for simulator
-static bool vrDeviceReady = false; // VR device ready flag
-static bool vrSimulator = false; // VR simulator enabled flag
-static bool vrEnabled = false; // VR experience enabled (device or simulator)
-static bool vrRendering = true; // VR stereo rendering enabled/disabled flag
- // NOTE: This flag is useful to render data over stereo image (i.e. FPS)
-
#if defined(GRAPHICS_API_OPENGL_ES2)
// NOTE: VAO functionality is exposed through extensions (OES)
static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
@@ -380,7 +318,7 @@ static int blendMode = 0; // Track current blending mode
// White texture useful for plain color polys (required by shader)
static unsigned int whiteTexture;
-// Default framebuffer size (required by Oculus device)
+// Default framebuffer size
static int screenWidth; // Default framebuffer width
static int screenHeight; // Default framebuffer height
@@ -397,7 +335,7 @@ static void UnloadDefaultShader(void); // Unload default shader
static void LoadDefaultBuffers(void); // Load default internal buffers (lines, triangles, quads)
static void UpdateDefaultBuffers(void); // Update default internal buffers (VAOs/VBOs) with vertex data
-static void DrawDefaultBuffers(int eyesCount); // Draw default internal buffers vertex data
+static void DrawDefaultBuffers(void); // Draw default internal buffers vertex data
static void UnloadDefaultBuffers(void); // Unload default internal buffers vertex data from CPU and GPU
// Configure stereo rendering (including distortion shader) with HMD device parameters
@@ -407,26 +345,6 @@ static void SetStereoConfig(VrDeviceInfo info);
static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView);
#endif
-#if defined(RLGL_OCULUS_SUPPORT)
-#if !defined(RLGL_STANDALONE)
-static bool InitOculusDevice(void); // Initialize Oculus device (returns true if success)
-static void CloseOculusDevice(void); // Close Oculus device
-static void UpdateOculusTracking(Camera *camera); // Update Oculus head position-orientation tracking
-static void BeginOculusDrawing(void); // Setup Oculus buffers for drawing
-static void EndOculusDrawing(void); // Finish Oculus drawing and blit framebuffer to mirror
-#endif
-
-static OculusBuffer LoadOculusBuffer(ovrSession session, int width, int height); // Load Oculus required buffers
-static void UnloadOculusBuffer(ovrSession session, OculusBuffer buffer); // Unload texture required buffers
-static OculusMirror LoadOculusMirror(ovrSession session, int width, int height); // Load Oculus mirror buffers
-static void UnloadOculusMirror(ovrSession session, OculusMirror mirror); // Unload Oculus mirror buffers
-static void BlitOculusMirror(ovrSession session, OculusMirror mirror); // Copy Oculus screen buffer to mirror texture
-static OculusLayer InitOculusLayer(ovrSession session); // Init Oculus layer (similar to photoshop)
-static Matrix FromOvrMatrix(ovrMatrix4f ovrM); // Convert from Oculus ovrMatrix4f struct to raymath Matrix struct
-#endif
-
-
-
#if defined(GRAPHICS_API_OPENGL_11)
static int GenerateMipmaps(unsigned char *data, int baseWidth, int baseHeight);
static Color *GenNextMipmap(Color *srcData, int srcWidth, int srcHeight);
@@ -1352,9 +1270,7 @@ void rlglDraw(void)
// NOTE: Default buffers upload and draw
UpdateDefaultBuffers();
-
- if (vrEnabled && vrRendering) DrawDefaultBuffers(2);
- else DrawDefaultBuffers(1);
+ DrawDefaultBuffers(); // NOTE: Stereo rendering is checked inside
#endif
}
@@ -2018,9 +1934,6 @@ void rlglDrawMesh(Mesh mesh, Material material, Matrix transform)
#endif
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- int eyesCount = 1;
- if (vrEnabled) eyesCount = 2;
-
glUseProgram(material.shader.id);
// Upload to shader material.colDiffuse
@@ -2153,6 +2066,9 @@ void rlglDrawMesh(Mesh mesh, Material material, Matrix transform)
if (mesh.indices != NULL) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quads.vboId[3]);
}
+ int eyesCount = 1;
+ if (vrStereoRender) eyesCount = 2;
+
for (int eye = 0; eye < eyesCount; eye++)
{
if (eyesCount == 2) SetStereoView(eye, matProjection, matModelView);
@@ -2617,146 +2533,127 @@ void EndBlendMode(void)
BeginBlendMode(BLEND_ALPHA);
}
-// Init VR device (or simulator)
-// NOTE: If device is not available, it fallbacks to default device (simulator)
+// Init VR simulator for selected device
// NOTE: It modifies the global variable: VrDeviceInfo hmd
-void InitVrDevice(int vrDevice)
+void InitVrSimulator(int vrDevice)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- switch (vrDevice)
- {
- case HMD_DEFAULT_DEVICE: TraceLog(INFO, "Initializing default VR Device (Oculus Rift CV1)");
- case HMD_OCULUS_RIFT_DK2:
- case HMD_OCULUS_RIFT_CV1:
- {
-#if defined(RLGL_OCULUS_SUPPORT)
- vrDeviceReady = InitOculusDevice();
-#else
- TraceLog(WARNING, "Oculus Rift not supported by default, recompile raylib with Oculus support");
-#endif
- } break;
- case HMD_VALVE_HTC_VIVE:
- case HMD_SAMSUNG_GEAR_VR:
- case HMD_GOOGLE_CARDBOARD:
- case HMD_SONY_PLAYSTATION_VR:
- case HMD_RAZER_OSVR:
- case HMD_FOVE_VR: TraceLog(WARNING, "VR Device not supported");
- default: break;
- }
-
- if (!vrDeviceReady)
- {
- TraceLog(WARNING, "VR Device not found: Initializing VR Simulator (Oculus Rift CV1)");
-
- if (vrDevice == HMD_OCULUS_RIFT_DK2)
- {
- // Oculus Rift DK2 parameters
- hmd.hResolution = 1280; // HMD horizontal resolution in pixels
- hmd.vResolution = 800; // HMD vertical resolution in pixels
- hmd.hScreenSize = 0.14976f; // HMD horizontal size in meters
- hmd.vScreenSize = 0.09356f; // HMD vertical size in meters
- hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
- hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
- hmd.lensSeparationDistance = 0.0635f; // HMD lens separation distance in meters
- hmd.interpupillaryDistance = 0.064f; // HMD IPD (distance between pupils) in meters
- hmd.distortionK[0] = 1.0f; // HMD lens distortion constant parameter 0
- hmd.distortionK[1] = 0.22f; // HMD lens distortion constant parameter 1
- hmd.distortionK[2] = 0.24f; // HMD lens distortion constant parameter 2
- hmd.distortionK[3] = 0.0f; // HMD lens distortion constant parameter 3
- hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
- hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
- hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
- hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
- }
- else if ((vrDevice == HMD_DEFAULT_DEVICE) || (vrDevice == HMD_OCULUS_RIFT_CV1))
- {
- // Oculus Rift CV1 parameters
- // NOTE: CV1 represents a complete HMD redesign compared to previous versions,
- // new Fresnel-hybrid-asymmetric lenses have been added and, consequently,
- // previous parameters (DK2) and distortion shader (DK2) doesn't work any more.
- // I just defined a set of parameters for simulator that approximate to CV1 stereo rendering
- // but result is not the same obtained with Oculus PC SDK.
- hmd.hResolution = 2160; // HMD horizontal resolution in pixels
- hmd.vResolution = 1200; // HMD vertical resolution in pixels
- hmd.hScreenSize = 0.133793f; // HMD horizontal size in meters
- hmd.vScreenSize = 0.0669f; // HMD vertical size in meters
- hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
- hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
- hmd.lensSeparationDistance = 0.07f; // HMD lens separation distance in meters
- hmd.interpupillaryDistance = 0.07f; // HMD IPD (distance between pupils) in meters
- hmd.distortionK[0] = 1.0f; // HMD lens distortion constant parameter 0
- hmd.distortionK[1] = 0.22f; // HMD lens distortion constant parameter 1
- hmd.distortionK[2] = 0.24f; // HMD lens distortion constant parameter 2
- hmd.distortionK[3] = 0.0f; // HMD lens distortion constant parameter 3
- hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
- hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
- hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
- hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
- }
-
- // Initialize framebuffer and textures for stereo rendering
- // NOTE: screen size should match HMD aspect ratio
- vrConfig.stereoFbo = rlglLoadRenderTexture(screenWidth, screenHeight);
-
- // Load distortion shader (initialized by default with Oculus Rift CV1 parameters)
- vrConfig.distortionShader.id = LoadShaderProgram(vDistortionShaderStr, fDistortionShaderStr);
- if (vrConfig.distortionShader.id != 0) LoadDefaultShaderLocations(&vrConfig.distortionShader);
-
- SetStereoConfig(hmd);
-
- vrSimulator = true;
- vrEnabled = true;
- }
+ if (vrDevice == HMD_OCULUS_RIFT_DK2)
+ {
+ // Oculus Rift DK2 parameters
+ hmd.hResolution = 1280; // HMD horizontal resolution in pixels
+ hmd.vResolution = 800; // HMD vertical resolution in pixels
+ hmd.hScreenSize = 0.14976f; // HMD horizontal size in meters
+ hmd.vScreenSize = 0.09356f; // HMD vertical size in meters
+ hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
+ hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
+ hmd.lensSeparationDistance = 0.0635f; // HMD lens separation distance in meters
+ hmd.interpupillaryDistance = 0.064f; // HMD IPD (distance between pupils) in meters
+ hmd.distortionK[0] = 1.0f; // HMD lens distortion constant parameter 0
+ hmd.distortionK[1] = 0.22f; // HMD lens distortion constant parameter 1
+ hmd.distortionK[2] = 0.24f; // HMD lens distortion constant parameter 2
+ hmd.distortionK[3] = 0.0f; // HMD lens distortion constant parameter 3
+ hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
+ hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
+ hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
+ hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
+
+ TraceLog(WARNING, "Initializing VR Simulator (Oculus Rift DK2)");
+ }
+ else if ((vrDevice == HMD_DEFAULT_DEVICE) || (vrDevice == HMD_OCULUS_RIFT_CV1))
+ {
+ // Oculus Rift CV1 parameters
+ // NOTE: CV1 represents a complete HMD redesign compared to previous versions,
+ // new Fresnel-hybrid-asymmetric lenses have been added and, consequently,
+ // previous parameters (DK2) and distortion shader (DK2) doesn't work any more.
+ // I just defined a set of parameters for simulator that approximate to CV1 stereo rendering
+ // but result is not the same obtained with Oculus PC SDK.
+ hmd.hResolution = 2160; // HMD horizontal resolution in pixels
+ hmd.vResolution = 1200; // HMD vertical resolution in pixels
+ hmd.hScreenSize = 0.133793f; // HMD horizontal size in meters
+ hmd.vScreenSize = 0.0669f; // HMD vertical size in meters
+ hmd.vScreenCenter = 0.04678f; // HMD screen center in meters
+ hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
+ hmd.lensSeparationDistance = 0.07f; // HMD lens separation distance in meters
+ hmd.interpupillaryDistance = 0.07f; // HMD IPD (distance between pupils) in meters
+ hmd.distortionK[0] = 1.0f; // HMD lens distortion constant parameter 0
+ hmd.distortionK[1] = 0.22f; // HMD lens distortion constant parameter 1
+ hmd.distortionK[2] = 0.24f; // HMD lens distortion constant parameter 2
+ hmd.distortionK[3] = 0.0f; // HMD lens distortion constant parameter 3
+ hmd.chromaAbCorrection[0] = 0.996f; // HMD chromatic aberration correction parameter 0
+ hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
+ hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
+ hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
+
+ TraceLog(WARNING, "Initializing VR Simulator (Oculus Rift CV1)");
+ }
+ else
+ {
+ TraceLog(WARNING, "VR Simulator doesn't support current device yet,");
+ TraceLog(WARNING, "using default VR Simulator parameters");
+ }
+
+ // Initialize framebuffer and textures for stereo rendering
+ // NOTE: screen size should match HMD aspect ratio
+ vrConfig.stereoFbo = rlglLoadRenderTexture(screenWidth, screenHeight);
+
+#if defined(SUPPORT_DISTORTION_SHADER)
+ // Load distortion shader (initialized by default with Oculus Rift CV1 parameters)
+ vrConfig.distortionShader.id = LoadShaderProgram(vDistortionShaderStr, fDistortionShaderStr);
+ if (vrConfig.distortionShader.id != 0) LoadDefaultShaderLocations(&vrConfig.distortionShader);
+#endif
+
+ SetStereoConfig(hmd);
+
+ vrSimulatorReady = true;
#endif
#if defined(GRAPHICS_API_OPENGL_11)
- TraceLog(WARNING, "VR device or simulator not supported on OpenGL 1.1");
+ TraceLog(WARNING, "VR Simulator not supported on OpenGL 1.1");
#endif
}
-// Close VR device (or simulator)
-void CloseVrDevice(void)
+// Close VR simulator for current device
+void CloseVrSimulator(void)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
-#if defined(RLGL_OCULUS_SUPPORT)
- if (vrDeviceReady) CloseOculusDevice();
- else
-#endif
+ if (vrSimulatorReady)
{
rlDeleteRenderTextures(vrConfig.stereoFbo); // Unload stereo framebuffer and texture
+ #if defined(SUPPORT_DISTORTION_SHADER)
UnloadShader(vrConfig.distortionShader); // Unload distortion shader
+ #endif
}
#endif
- vrDeviceReady = false;
-}
-
-// Detect if VR device is available
-bool IsVrDeviceReady(void)
-{
- return (vrDeviceReady && vrEnabled);
}
// Detect if VR simulator is running
-bool IsVrSimulator(void)
+bool IsVrSimulatorReady(void)
{
- return (vrSimulator && vrEnabled);
+#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
+ return vrSimulatorReady;
+#else
+ return false;
+#endif
}
// Enable/Disable VR experience (device or simulator)
void ToggleVrMode(void)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- if (vrDeviceReady || vrSimulator) vrEnabled = !vrEnabled;
- else vrEnabled = false;
+ vrSimulatorReady = !vrSimulatorReady;
- if (!vrEnabled)
+ if (!vrSimulatorReady)
{
+ vrStereoRender = false;
+
// Reset viewport and default projection-modelview matrices
rlViewport(0, 0, screenWidth, screenHeight);
projection = MatrixOrtho(0, screenWidth, screenHeight, 0, 0.0f, 1.0f);
MatrixTranspose(&projection);
modelview = MatrixIdentity();
}
+ else vrStereoRender = true;
#endif
}
@@ -2764,37 +2661,29 @@ void ToggleVrMode(void)
// NOTE: Camera (position, target, up) gets update with head tracking information
void UpdateVrTracking(Camera *camera)
{
-#if defined(RLGL_OCULUS_SUPPORT)
- if (vrDeviceReady) UpdateOculusTracking(camera);
-#endif
+ // TODO: Simulate 1st person camera system
}
// Begin Oculus drawing configuration
void BeginVrDrawing(void)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
-#if defined(RLGL_OCULUS_SUPPORT)
- if (vrDeviceReady)
- {
- BeginOculusDrawing();
- }
- else
-#endif
+ if (vrSimulatorReady)
{
// Setup framebuffer for stereo rendering
rlEnableRenderTexture(vrConfig.stereoFbo.id);
- }
-
- // NOTE: If your application is configured to treat the texture as a linear format (e.g. GL_RGBA)
- // and performs linear-to-gamma conversion in GLSL or does not care about gamma-correction, then:
- // - Require OculusBuffer format to be OVR_FORMAT_R8G8B8A8_UNORM_SRGB
- // - Do NOT enable GL_FRAMEBUFFER_SRGB
- //glEnable(GL_FRAMEBUFFER_SRGB);
- //glViewport(0, 0, buffer.width, buffer.height); // Useful if rendering to separate framebuffers (every eye)
- rlClearScreenBuffers(); // Clear current framebuffer(s)
+ // NOTE: If your application is configured to treat the texture as a linear format (e.g. GL_RGBA)
+ // and performs linear-to-gamma conversion in GLSL or does not care about gamma-correction, then:
+ // - Require OculusBuffer format to be OVR_FORMAT_R8G8B8A8_UNORM_SRGB
+ // - Do NOT enable GL_FRAMEBUFFER_SRGB
+ //glEnable(GL_FRAMEBUFFER_SRGB);
- vrRendering = true;
+ //glViewport(0, 0, buffer.width, buffer.height); // Useful if rendering to separate framebuffers (every eye)
+ rlClearScreenBuffers(); // Clear current framebuffer(s)
+
+ vrStereoRender = true;
+ }
#endif
}
@@ -2802,18 +2691,13 @@ void BeginVrDrawing(void)
void EndVrDrawing(void)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
-#if defined(RLGL_OCULUS_SUPPORT)
- if (vrDeviceReady)
+ if (vrSimulatorReady)
{
- EndOculusDrawing();
- }
- else
-#endif
- {
- // Unbind current framebuffer
- rlDisableRenderTexture();
+ vrStereoRender = false; // Disable stereo render
+
+ rlDisableRenderTexture(); // Unbind current framebuffer
- rlClearScreenBuffers(); // Clear current framebuffer
+ rlClearScreenBuffers(); // Clear current framebuffer
// Set viewport to default framebuffer size (screen size)
rlViewport(0, 0, screenWidth, screenHeight);
@@ -2825,8 +2709,12 @@ void EndVrDrawing(void)
rlMatrixMode(RL_MODELVIEW); // Enable internal modelview matrix
rlLoadIdentity(); // Reset internal modelview matrix
+#if defined(SUPPORT_DISTORTION_SHADER)
// Draw RenderTexture (stereoFbo) using distortion shader
currentShader = vrConfig.distortionShader;
+#else
+ currentShader = GetDefaultShader();
+#endif
rlEnableTexture(vrConfig.stereoFbo.texture.id);
@@ -2855,15 +2743,21 @@ void EndVrDrawing(void)
rlDisableTexture();
+ // Update and draw render texture fbo with distortion to backbuffer
UpdateDefaultBuffers();
- DrawDefaultBuffers(1);
-
+ DrawDefaultBuffers();
+
+ // Restore defaultShader
currentShader = defaultShader;
- }
-
- rlDisableDepthTest();
- vrRendering = false;
+ // Reset viewport and default projection-modelview matrices
+ rlViewport(0, 0, screenWidth, screenHeight);
+ projection = MatrixOrtho(0, screenWidth, screenHeight, 0, 0.0f, 1.0f);
+ MatrixTranspose(&projection);
+ modelview = MatrixIdentity();
+
+ rlDisableDepthTest();
+ }
#endif
}
@@ -3405,10 +3299,13 @@ static void UpdateDefaultBuffers(void)
// Draw default internal buffers vertex data
// NOTE: We draw in this order: lines, triangles, quads
-static void DrawDefaultBuffers(int eyesCount)
+static void DrawDefaultBuffers()
{
Matrix matProjection = projection;
Matrix matModelView = modelview;
+
+ int eyesCount = 1;
+ if (vrStereoRender) eyesCount = 2;
for (int eye = 0; eye < eyesCount; eye++)
{
@@ -3652,6 +3549,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
TraceLog(DEBUG, "VR: Distortion Shader: Scale = { %f, %f }", scale[0], scale[1]);
TraceLog(DEBUG, "VR: Distortion Shader: ScaleIn = { %f, %f }", scaleIn[0], scaleIn[1]);
+#if defined(SUPPORT_DISTORTION_SHADER)
// Update distortion shader with lens and distortion-scale parameters
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "leftLensCenter"), leftLensCenter, 2);
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "rightLensCenter"), rightLensCenter, 2);
@@ -3662,6 +3560,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "scaleIn"), scaleIn, 2);
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "hmdWarpParam"), hmd.distortionK, 4);
SetShaderValue(vrConfig.distortionShader, GetShaderLocation(vrConfig.distortionShader, "chromaAbParam"), hmd.chromaAbCorrection, 4);
+#endif
// Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)*RAD2DEG
// ...but with lens distortion it is increased (see Oculus SDK Documentation)
@@ -3693,47 +3592,19 @@ static void SetStereoConfig(VrDeviceInfo hmd)
// Set internal projection and modelview matrix depending on eyes tracking data
static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView)
{
- if (vrEnabled)
- {
- Matrix eyeProjection = matProjection;
- Matrix eyeModelView = matModelView;
+ Matrix eyeProjection = matProjection;
+ Matrix eyeModelView = matModelView;
-#if defined(RLGL_OCULUS_SUPPORT)
- if (vrDeviceReady)
- {
- rlViewport(layer.eyeLayer.Viewport[eye].Pos.x, layer.eyeLayer.Viewport[eye].Pos.y,
- layer.eyeLayer.Viewport[eye].Size.w, layer.eyeLayer.Viewport[eye].Size.h);
-
- Quaternion eyeRenderPose = (Quaternion){ layer.eyeLayer.RenderPose[eye].Orientation.x,
- layer.eyeLayer.RenderPose[eye].Orientation.y,
- layer.eyeLayer.RenderPose[eye].Orientation.z,
- layer.eyeLayer.RenderPose[eye].Orientation.w };
- QuaternionInvert(&eyeRenderPose);
- Matrix eyeOrientation = QuaternionToMatrix(eyeRenderPose);
- Matrix eyeTranslation = MatrixTranslate(-layer.eyeLayer.RenderPose[eye].Position.x,
- -layer.eyeLayer.RenderPose[eye].Position.y,
- -layer.eyeLayer.RenderPose[eye].Position.z);
-
- Matrix eyeView = MatrixMultiply(eyeTranslation, eyeOrientation); // Matrix containing eye-head movement
- eyeModelView = MatrixMultiply(matModelView, eyeView); // Combine internal camera matrix (modelview) wih eye-head movement
-
- eyeProjection = layer.eyeProjections[eye];
- }
- else
-#endif
- {
- // Setup viewport and projection/modelview matrices using tracking data
- rlViewport(eye*screenWidth/2, 0, screenWidth/2, screenHeight);
+ // Setup viewport and projection/modelview matrices using tracking data
+ rlViewport(eye*screenWidth/2, 0, screenWidth/2, screenHeight);
- // Apply view offset to modelview matrix
- eyeModelView = MatrixMultiply(matModelView, vrConfig.eyesViewOffset[eye]);
+ // Apply view offset to modelview matrix
+ eyeModelView = MatrixMultiply(matModelView, vrConfig.eyesViewOffset[eye]);
- eyeProjection = vrConfig.eyesProjection[eye];
- }
+ eyeProjection = vrConfig.eyesProjection[eye];
- SetMatrixModelview(eyeModelView);
- SetMatrixProjection(eyeProjection);
- }
+ SetMatrixModelview(eyeModelView);
+ SetMatrixProjection(eyeProjection);
}
#endif //defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
@@ -3864,304 +3735,6 @@ static Color *GenNextMipmap(Color *srcData, int srcWidth, int srcHeight)
}
#endif
-#if defined(RLGL_OCULUS_SUPPORT)
-// Initialize Oculus device (returns true if success)
-OCULUSAPI bool InitOculusDevice(void)
-{
- bool oculusReady = false;
-
- ovrResult result = ovr_Initialize(NULL);
-
- if (OVR_FAILURE(result)) TraceLog(WARNING, "OVR: Could not initialize Oculus device");
- else
- {
- result = ovr_Create(&session, &luid);
- if (OVR_FAILURE(result))
- {
- TraceLog(WARNING, "OVR: Could not create Oculus session");
- ovr_Shutdown();
- }
- else
- {
- hmdDesc = ovr_GetHmdDesc(session);
-
- TraceLog(INFO, "OVR: Product Name: %s", hmdDesc.ProductName);
- TraceLog(INFO, "OVR: Manufacturer: %s", hmdDesc.Manufacturer);
- TraceLog(INFO, "OVR: Product ID: %i", hmdDesc.ProductId);
- TraceLog(INFO, "OVR: Product Type: %i", hmdDesc.Type);
- //TraceLog(INFO, "OVR: Serial Number: %s", hmdDesc.SerialNumber);
- TraceLog(INFO, "OVR: Resolution: %ix%i", hmdDesc.Resolution.w, hmdDesc.Resolution.h);
-
- // NOTE: Oculus mirror is set to defined screenWidth and screenHeight...
- // ...ideally, it should be (hmdDesc.Resolution.w/2, hmdDesc.Resolution.h/2)
-
- // Initialize Oculus Buffers
- layer = InitOculusLayer(session);
- buffer = LoadOculusBuffer(session, layer.width, layer.height);
- mirror = LoadOculusMirror(session, hmdDesc.Resolution.w/2, hmdDesc.Resolution.h/2); // NOTE: hardcoded...
- layer.eyeLayer.ColorTexture[0] = buffer.textureChain; //SetOculusLayerTexture(eyeLayer, buffer.textureChain);
-
- // Recenter OVR tracking origin
- ovr_RecenterTrackingOrigin(session);
-
- oculusReady = true;
- vrEnabled = true;
- }
- }
-
- return oculusReady;
-}
-
-// Close Oculus device (and unload buffers)
-OCULUSAPI void CloseOculusDevice(void)
-{
- UnloadOculusMirror(session, mirror); // Unload Oculus mirror buffer
- UnloadOculusBuffer(session, buffer); // Unload Oculus texture buffers
-
- ovr_Destroy(session); // Free Oculus session data
- ovr_Shutdown(); // Close Oculus device connection
-}
-
-// Update Oculus head position-orientation tracking
-OCULUSAPI void UpdateOculusTracking(Camera *camera)
-{
- frameIndex++;
-
- ovrPosef eyePoses[2];
- ovr_GetEyePoses(session, frameIndex, ovrTrue, layer.viewScaleDesc.HmdToEyeOffset, eyePoses, &layer.eyeLayer.SensorSampleTime);
-
- layer.eyeLayer.RenderPose[0] = eyePoses[0];
- layer.eyeLayer.RenderPose[1] = eyePoses[1];
-
- // TODO: Update external camera with eyePoses data (position, orientation)
- // NOTE: We can simplify to simple camera if we consider IPD and HMD device configuration again later
- // it will be useful for the user to draw, lets say, billboards oriented to camera
-
- // Get session status information
- ovrSessionStatus sessionStatus;
- ovr_GetSessionStatus(session, &sessionStatus);
-
- if (sessionStatus.ShouldQuit) TraceLog(WARNING, "OVR: Session should quit...");
- if (sessionStatus.ShouldRecenter) ovr_RecenterTrackingOrigin(session);
- //if (sessionStatus.HmdPresent) // HMD is present.
- //if (sessionStatus.DisplayLost) // HMD was unplugged or the display driver was manually disabled or encountered a TDR.
- //if (sessionStatus.HmdMounted) // HMD is on the user's head.
- //if (sessionStatus.IsVisible) // the game or experience has VR focus and is visible in the HMD.
-}
-
-// Setup Oculus buffers for drawing
-OCULUSAPI void BeginOculusDrawing(void)
-{
- GLuint currentTexId;
- int currentIndex;
-
- ovr_GetTextureSwapChainCurrentIndex(session, buffer.textureChain, &currentIndex);
- ovr_GetTextureSwapChainBufferGL(session, buffer.textureChain, currentIndex, &currentTexId);
-
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, buffer.fboId);
- glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, currentTexId, 0);
- //glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, buffer.depthId, 0); // Already binded
-}
-
-// Finish Oculus drawing and blit framebuffer to mirror
-OCULUSAPI void EndOculusDrawing(void)
-{
- // Unbind current framebuffer (Oculus buffer)
- glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
-
- ovr_CommitTextureSwapChain(session, buffer.textureChain);
-
- ovrLayerHeader *layers = &layer.eyeLayer.Header;
- ovr_SubmitFrame(session, frameIndex, &layer.viewScaleDesc, &layers, 1);
-
- // Blit mirror texture to back buffer
- BlitOculusMirror(session, mirror);
-}
-
-// Load Oculus required buffers: texture-swap-chain, fbo, texture-depth
-static OculusBuffer LoadOculusBuffer(ovrSession session, int width, int height)
-{
- OculusBuffer buffer;
- buffer.width = width;
- buffer.height = height;
-
- // Create OVR texture chain
- ovrTextureSwapChainDesc desc = {};
- desc.Type = ovrTexture_2D;
- desc.ArraySize = 1;
- desc.Width = width;
- desc.Height = height;
- desc.MipLevels = 1;
- desc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; // Requires glEnable(GL_FRAMEBUFFER_SRGB);
- desc.SampleCount = 1;
- desc.StaticImage = ovrFalse;
-
- ovrResult result = ovr_CreateTextureSwapChainGL(session, &desc, &buffer.textureChain);
-
- if (!OVR_SUCCESS(result)) TraceLog(WARNING, "OVR: Failed to create swap textures buffer");
-
- int textureCount = 0;
- ovr_GetTextureSwapChainLength(session, buffer.textureChain, &textureCount);
-
- if (!OVR_SUCCESS(result) || !textureCount) TraceLog(WARNING, "OVR: Unable to count swap chain textures");
-
- for (int i = 0; i < textureCount; ++i)
- {
- GLuint chainTexId;
- ovr_GetTextureSwapChainBufferGL(session, buffer.textureChain, i, &chainTexId);
- glBindTexture(GL_TEXTURE_2D, chainTexId);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- }
-
- glBindTexture(GL_TEXTURE_2D, 0);
-
- /*
- // Setup framebuffer object (using depth texture)
- glGenFramebuffers(1, &buffer.fboId);
- glGenTextures(1, &buffer.depthId);
- glBindTexture(GL_TEXTURE_2D, buffer.depthId);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, buffer.width, buffer.height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
- */
-
- // Setup framebuffer object (using depth renderbuffer)
- glGenFramebuffers(1, &buffer.fboId);
- glGenRenderbuffers(1, &buffer.depthId);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, buffer.fboId);
- glBindRenderbuffer(GL_RENDERBUFFER, buffer.depthId);
- glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, buffer.width, buffer.height);
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, buffer.depthId);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
-
- return buffer;
-}
-
-// Unload texture required buffers
-static void UnloadOculusBuffer(ovrSession session, OculusBuffer buffer)
-{
- if (buffer.textureChain)
- {
- ovr_DestroyTextureSwapChain(session, buffer.textureChain);
- buffer.textureChain = NULL;
- }
-
- if (buffer.depthId != 0) glDeleteTextures(1, &buffer.depthId);
- if (buffer.fboId != 0) glDeleteFramebuffers(1, &buffer.fboId);
-}
-
-// Load Oculus mirror buffers
-static OculusMirror LoadOculusMirror(ovrSession session, int width, int height)
-{
- OculusMirror mirror;
- mirror.width = width;
- mirror.height = height;
-
- ovrMirrorTextureDesc mirrorDesc;
- memset(&mirrorDesc, 0, sizeof(mirrorDesc));
- mirrorDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB;
- mirrorDesc.Width = mirror.width;
- mirrorDesc.Height = mirror.height;
-
- if (!OVR_SUCCESS(ovr_CreateMirrorTextureGL(session, &mirrorDesc, &mirror.texture))) TraceLog(WARNING, "Could not create mirror texture");
-
- glGenFramebuffers(1, &mirror.fboId);
-
- return mirror;
-}
-
-// Unload Oculus mirror buffers
-static void UnloadOculusMirror(ovrSession session, OculusMirror mirror)
-{
- if (mirror.fboId != 0) glDeleteFramebuffers(1, &mirror.fboId);
- if (mirror.texture) ovr_DestroyMirrorTexture(session, mirror.texture);
-}
-
-// Copy Oculus screen buffer to mirror texture
-static void BlitOculusMirror(ovrSession session, OculusMirror mirror)
-{
- GLuint mirrorTextureId;
-
- ovr_GetMirrorTextureBufferGL(session, mirror.texture, &mirrorTextureId);
-
- glBindFramebuffer(GL_READ_FRAMEBUFFER, mirror.fboId);
- glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mirrorTextureId, 0);
-#if defined(GRAPHICS_API_OPENGL_33)
- // NOTE: glBlitFramebuffer() requires extension: GL_EXT_framebuffer_blit (not available in OpenGL ES 2.0)
- glBlitFramebuffer(0, 0, mirror.width, mirror.height, 0, mirror.height, mirror.width, 0, GL_COLOR_BUFFER_BIT, GL_NEAREST);
-#endif
- glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
-}
-
-// Init Oculus layer (similar to photoshop)
-static OculusLayer InitOculusLayer(ovrSession session)
-{
- OculusLayer layer = { 0 };
-
- layer.viewScaleDesc.HmdSpaceToWorldScaleInMeters = 1.0f;
-
- memset(&layer.eyeLayer, 0, sizeof(ovrLayerEyeFov));
- layer.eyeLayer.Header.Type = ovrLayerType_EyeFov;
- layer.eyeLayer.Header.Flags = ovrLayerFlag_TextureOriginAtBottomLeft;
-
- ovrEyeRenderDesc eyeRenderDescs[2];
-
- for (int eye = 0; eye < 2; eye++)
- {
- eyeRenderDescs[eye] = ovr_GetRenderDesc(session, eye, hmdDesc.DefaultEyeFov[eye]);
- ovrMatrix4f ovrPerspectiveProjection = ovrMatrix4f_Projection(eyeRenderDescs[eye].Fov, 0.01f, 10000.0f, ovrProjection_None); //ovrProjection_ClipRangeOpenGL);
- layer.eyeProjections[eye] = FromOvrMatrix(ovrPerspectiveProjection); // NOTE: struct ovrMatrix4f { float M[4][4] } --> struct Matrix
-
- layer.viewScaleDesc.HmdToEyeOffset[eye] = eyeRenderDescs[eye].HmdToEyeOffset;
- layer.eyeLayer.Fov[eye] = eyeRenderDescs[eye].Fov;
-
- ovrSizei eyeSize = ovr_GetFovTextureSize(session, eye, layer.eyeLayer.Fov[eye], 1.0f);
- layer.eyeLayer.Viewport[eye].Size = eyeSize;
- layer.eyeLayer.Viewport[eye].Pos.x = layer.width;
- layer.eyeLayer.Viewport[eye].Pos.y = 0;
-
- layer.height = eyeSize.h; //std::max(renderTargetSize.y, (uint32_t)eyeSize.h);
- layer.width += eyeSize.w;
- }
-
- return layer;
-}
-
-// Convert from Oculus ovrMatrix4f struct to raymath Matrix struct
-static Matrix FromOvrMatrix(ovrMatrix4f ovrmat)
-{
- Matrix rmat;
-
- rmat.m0 = ovrmat.M[0][0];
- rmat.m1 = ovrmat.M[1][0];
- rmat.m2 = ovrmat.M[2][0];
- rmat.m3 = ovrmat.M[3][0];
- rmat.m4 = ovrmat.M[0][1];
- rmat.m5 = ovrmat.M[1][1];
- rmat.m6 = ovrmat.M[2][1];
- rmat.m7 = ovrmat.M[3][1];
- rmat.m8 = ovrmat.M[0][2];
- rmat.m9 = ovrmat.M[1][2];
- rmat.m10 = ovrmat.M[2][2];
- rmat.m11 = ovrmat.M[3][2];
- rmat.m12 = ovrmat.M[0][3];
- rmat.m13 = ovrmat.M[1][3];
- rmat.m14 = ovrmat.M[2][3];
- rmat.m15 = ovrmat.M[3][3];
-
- MatrixTranspose(&rmat);
-
- return rmat;
-}
-#endif
-
#if defined(RLGL_STANDALONE)
// Output a trace log message
// NOTE: Expected msgType: (0)Info, (1)Error, (2)Warning
diff --git a/src/rlgl.h b/src/rlgl.h
index 41f671e6..a870a907 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -2,8 +2,8 @@
*
* rlgl - raylib OpenGL abstraction layer
*
-* rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
-* selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
+* rlgl is a wrapper for multiple OpenGL versions (1.1, 2.1, 3.3 Core, ES 2.0) to
+* pseudo-OpenGL 1.1 style functions (rlVertex, rlTranslate, rlRotate...).
*
* When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal
* VBO buffers (and VAOs if available). It requires calling 3 functions:
@@ -11,18 +11,29 @@
* rlglDraw() - Process internal buffers and send required draw calls
* rlglClose() - De-initialize internal buffers data and other auxiliar resources
*
-* External libs:
+* CONFIGURATION:
+*
+* #define GRAPHICS_API_OPENGL_11
+* #define GRAPHICS_API_OPENGL_21
+* #define GRAPHICS_API_OPENGL_33
+* #define GRAPHICS_API_OPENGL_ES2
+* Use selected OpenGL backend
+*
+* #define RLGL_STANDALONE
+* Use rlgl as standalone library (no raylib dependency)
+*
+* #define SUPPORT_VR_SIMULATION / SUPPORT_STEREO_RENDERING
+* Support VR simulation functionality (stereo rendering)
+*
+* #define SUPPORT_SHADER_DISTORTION
+* Include stereo rendering distortion shader (shader_distortion.h)
+*
+* DEPENDENCIES:
* raymath - 3D math functionality (Vector3, Matrix, Quaternion)
* GLAD - OpenGL extensions loading (OpenGL 3.3 Core only)
*
-* Module Configuration Flags:
-* GRAPHICS_API_OPENGL_11 - Use OpenGL 1.1 backend
-* GRAPHICS_API_OPENGL_21 - Use OpenGL 2.1 backend
-* GRAPHICS_API_OPENGL_33 - Use OpenGL 3.3 Core profile backend
-* GRAPHICS_API_OPENGL_ES2 - Use OpenGL ES 2.0 backend
-*
-* RLGL_STANDALONE - Use rlgl as standalone library (no raylib dependency)
*
+* LICENSE: zlib/libpng
*
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
*
@@ -124,15 +135,21 @@
#define RL_WRAP_CLAMP 0x812F // GL_CLAMP_TO_EDGE
#define RL_WRAP_CLAMP_MIRROR 0x8742 // GL_MIRROR_CLAMP_EXT
+// Matrix modes (equivalent to OpenGL)
+#define RL_MODELVIEW 0x1700 // GL_MODELVIEW
+#define RL_PROJECTION 0x1701 // GL_PROJECTION
+#define RL_TEXTURE 0x1702 // GL_TEXTURE
+
+// Primitive assembly draw modes
+#define RL_LINES 0x0001 // GL_LINES
+#define RL_TRIANGLES 0x0004 // GL_TRIANGLES
+#define RL_QUADS 0x0007 // GL_QUADS
+
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
typedef enum { OPENGL_11 = 1, OPENGL_21, OPENGL_33, OPENGL_ES_20 } GlVersion;
-typedef enum { RL_PROJECTION, RL_MODELVIEW, RL_TEXTURE } MatrixMode;
-
-typedef enum { RL_LINES, RL_TRIANGLES, RL_QUADS } DrawMode;
-
typedef unsigned char byte;
#if defined(RLGL_STANDALONE)
@@ -399,19 +416,12 @@ void EndBlendMode(void); // End blend
void TraceLog(int msgType, const char *text, ...);
float *MatrixToFloat(Matrix mat);
-void InitVrDevice(int vrDevice); // Init VR device
-void CloseVrDevice(void); // Close VR device
-bool IsVrDeviceReady(void); // Detect if VR device is ready
-bool IsVrSimulator(void); // Detect if VR simulator is running
+void InitVrSimulator(int vrDevice); // Init VR simulator for selected device
+void CloseVrSimulator(void); // Close VR simulator for current device
void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
-
-// Oculus Rift API for direct access the device (no simulator)
-bool InitOculusDevice(void); // Initialize Oculus device (returns true if success)
-void CloseOculusDevice(void); // Close Oculus device
-void UpdateOculusTracking(Camera *camera); // Update Oculus head position-orientation tracking (and camera)
-void BeginOculusDrawing(void); // Setup Oculus buffers for drawing
-void EndOculusDrawing(void); // Finish Oculus drawing and blit framebuffer to mirror
+void BeginVrDrawing(void); // Begin VR stereo rendering
+void EndVrDrawing(void); // End VR stereo rendering
#endif
#ifdef __cplusplus
diff --git a/src/rres.h b/src/rres.h
index 362da10d..65ebdbba 100644
--- a/src/rres.h
+++ b/src/rres.h
@@ -1,8 +1,6 @@
/**********************************************************************************************
*
-* rres - raylib Resource custom format management functions
-*
-* Basic functions to load/save rRES resource files
+* rres v1.0 - raylib resource (rRES) custom fileformat management functions
*
* CONFIGURATION:
*
diff --git a/src/shapes.c b/src/shapes.c
index 9cbe1da4..2a924476 100644
--- a/src/shapes.c
+++ b/src/shapes.c
@@ -13,7 +13,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -57,7 +57,7 @@
//----------------------------------------------------------------------------------
// Module specific Functions Declaration
//----------------------------------------------------------------------------------
-// No private (static) functions in this module (.c file)
+static float EaseCubicInOut(float t, float b, float c, float d); // Cubic easing
//----------------------------------------------------------------------------------
// Module Functions Definition
@@ -106,6 +106,13 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
// Draw a line defining thickness
void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
{
+ if (startPos.x > endPos.x)
+ {
+ Vector2 tempPos = startPos;
+ startPos = endPos;
+ endPos = tempPos;
+ }
+
float dx = endPos.x - startPos.x;
float dy = endPos.y - startPos.y;
@@ -133,6 +140,27 @@ void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color)
rlDisableTexture();
}
+// Draw line using cubic-bezier curves in-out
+void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
+{
+ #define LINE_DIVISIONS 24 // Bezier line divisions
+
+ Vector2 previous = startPos;
+ Vector2 current;
+
+ for (int i = 1; i <= LINE_DIVISIONS; i++)
+ {
+ // Cubic easing in-out
+ // NOTE: Easing is calcutated only for y position value
+ current.y = EaseCubicInOut(i, startPos.y, endPos.y - startPos.y, LINE_DIVISIONS);
+ current.x = previous.x + (endPos.x - startPos.x)/LINE_DIVISIONS;
+
+ DrawLineEx(previous, current, thick, color);
+
+ previous = current;
+ }
+}
+
// Draw a color-filled circle
void DrawCircle(int centerX, int centerY, float radius, Color color)
{
@@ -590,3 +618,15 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
return retRec;
}
+
+//----------------------------------------------------------------------------------
+// Module specific Functions Definition
+//----------------------------------------------------------------------------------
+
+// Cubic easing in-out
+// NOTE: Required for DrawLineBezier()
+static float EaseCubicInOut(float t, float b, float c, float d)
+{
+ if ((t/=d/2) < 1) return (c/2*t*t*t + b);
+ return (c/2*((t-=2)*t*t + 2) + b);
+} \ No newline at end of file
diff --git a/src/text.c b/src/text.c
index 18ebf482..04a860cf 100644
--- a/src/text.c
+++ b/src/text.c
@@ -5,12 +5,11 @@
* CONFIGURATION:
*
* #define SUPPORT_FILEFORMAT_FNT
-* #define SUPPORT_FILEFORMAT_TTF / INCLUDE_STB_TRUETYPE
-* #define SUPPORT_FILEFORMAT_IMAGE_FONT
+* #define SUPPORT_FILEFORMAT_TTF
* Selected desired fileformats to be supported for loading. Some of those formats are
* supported by default, to remove support, just comment unrequired #define in this module
*
-* #define INCLUDE_DEFAULT_FONT / SUPPORT_DEFAULT_FONT
+* #define SUPPORT_DEFAULT_FONT
*
* DEPENDENCIES:
* stb_truetype - Load TTF file and rasterize characters data
@@ -18,7 +17,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -37,6 +36,11 @@
*
**********************************************************************************************/
+// Default supported features
+//-------------------------------------
+#define SUPPORT_DEFAULT_FONT
+//-------------------------------------
+
#include "raylib.h"
#include <stdlib.h> // Required for: malloc(), free()
@@ -46,10 +50,12 @@
#include "utils.h" // Required for: GetExtension()
-// Following libs are used on LoadTTF()
-#define STBTT_STATIC // Define stb_truetype functions static to this module
-#define STB_TRUETYPE_IMPLEMENTATION
-#include "external/stb_truetype.h" // Required for: stbtt_BakeFontBitmap()
+#if defined(SUPPORT_FILEFORMAT_TTF)
+ // Following libs are used on LoadTTF()
+ #define STBTT_STATIC // Define stb_truetype functions static to this module
+ #define STB_TRUETYPE_IMPLEMENTATION
+ #include "external/stb_truetype.h" // Required for: stbtt_BakeFontBitmap()
+#endif
// Rectangle packing functions (not used at the moment)
//#define STB_RECT_PACK_IMPLEMENTATION
@@ -61,8 +67,6 @@
#define MAX_FORMATTEXT_LENGTH 64
#define MAX_SUBTEXT_LENGTH 64
-#define BIT_CHECK(a,b) ((a) & (1 << (b)))
-
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
@@ -71,8 +75,10 @@
//----------------------------------------------------------------------------------
// Global variables
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_DEFAULT_FONT)
static SpriteFont defaultFont; // Default font provided by raylib
// NOTE: defaultFont is loaded on InitWindow and disposed on CloseWindow [module: core]
+#endif
//----------------------------------------------------------------------------------
// Other Modules Functions Declaration (required by text)
@@ -86,17 +92,28 @@ static int GetCharIndex(SpriteFont font, int letter);
static SpriteFont LoadImageFont(Image image, Color key, int firstChar); // Load a Image font file (XNA style)
static SpriteFont LoadRBMF(const char *fileName); // Load a rBMF font file (raylib BitMap Font)
+#if defined(SUPPORT_FILEFORMAT_FNT)
static SpriteFont LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode font file)
+#endif
+#if defined(SUPPORT_FILEFORMAT_TTF)
static SpriteFont LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load spritefont from TTF data
+#endif
+#if defined(SUPPORT_DEFAULT_FONT)
extern void LoadDefaultFont(void);
extern void UnloadDefaultFont(void);
+#endif
//----------------------------------------------------------------------------------
// Module Functions Definition
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_DEFAULT_FONT)
+
+// Load raylib default font
extern void LoadDefaultFont(void)
{
+ #define BIT_CHECK(a,b) ((a) & (1 << (b)))
+
// NOTE: Using UTF8 encoding table for Unicode U+0000..U+00FF Basic Latin + Latin-1 Supplement
// http://www.utf8-chartable.de/unicode-utf8-table.pl
@@ -241,16 +258,23 @@ extern void LoadDefaultFont(void)
TraceLog(INFO, "[TEX ID %i] Default font loaded successfully", defaultFont.texture.id);
}
+// Unload raylib default font
extern void UnloadDefaultFont(void)
{
UnloadTexture(defaultFont.texture);
free(defaultFont.chars);
}
+#endif // SUPPORT_DEFAULT_FONT
// Get the default font, useful to be used with extended parameters
SpriteFont GetDefaultFont()
{
+#if defined(SUPPORT_DEFAULT_FONT)
return defaultFont;
+#else
+ SpriteFont font = { 0 };
+ return font;
+#endif
}
// Load SpriteFont from file into GPU memory (VRAM)
@@ -265,8 +289,12 @@ SpriteFont LoadSpriteFont(const char *fileName)
// Check file extension
if (strcmp(GetExtension(fileName),"rbmf") == 0) spriteFont = LoadRBMF(fileName); // TODO: DELETE... SOON...
+#if defined(SUPPORT_FILEFORMAT_TTF)
else if (strcmp(GetExtension(fileName),"ttf") == 0) spriteFont = LoadSpriteFontTTF(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL);
+#endif
+#if defined(SUPPORT_FILEFORMAT_FNT)
else if (strcmp(GetExtension(fileName),"fnt") == 0) spriteFont = LoadBMFont(fileName);
+#endif
else if (strcmp(GetExtension(fileName),"rres") == 0)
{
// TODO: Read multiple resource blocks from file (RRES_FONT_IMAGE, RRES_FONT_CHARDATA)
@@ -317,6 +345,7 @@ SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount,
{
SpriteFont spriteFont = { 0 };
+#if defined(SUPPORT_FILEFORMAT_TTF)
if (strcmp(GetExtension(fileName),"ttf") == 0)
{
if ((fontChars == NULL) || (charsCount == 0))
@@ -331,6 +360,7 @@ SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount,
}
else spriteFont = LoadTTF(fileName, fontSize, charsCount, fontChars);
}
+#endif
if (spriteFont.texture.id == 0)
{
@@ -345,7 +375,7 @@ SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount,
void UnloadSpriteFont(SpriteFont spriteFont)
{
// NOTE: Make sure spriteFont is not default font (fallback)
- if (spriteFont.texture.id != defaultFont.texture.id)
+ if (spriteFont.texture.id != GetDefaultFont().texture.id)
{
UnloadTexture(spriteFont.texture);
free(spriteFont.chars);
@@ -360,7 +390,7 @@ void UnloadSpriteFont(SpriteFont spriteFont)
void DrawText(const char *text, int posX, int posY, int fontSize, Color color)
{
// Check if default font has been loaded
- if (defaultFont.texture.id != 0)
+ if (GetDefaultFont().texture.id != 0)
{
Vector2 position = { (float)posX, (float)posY };
@@ -471,7 +501,7 @@ int MeasureText(const char *text, int fontSize)
Vector2 vec = { 0.0f, 0.0f };
// Check if default font has been loaded
- if (defaultFont.texture.id != 0)
+ if (GetDefaultFont().texture.id != 0)
{
int defaultFontSize = 10; // Default Font chars height in pixel
if (fontSize < defaultFontSize) fontSize = defaultFontSize;
@@ -826,6 +856,7 @@ static SpriteFont LoadRBMF(const char *fileName)
return spriteFont;
}
+#if defined(SUPPORT_FILEFORMAT_FNT)
// Load a BMFont file (AngelCode font file)
static SpriteFont LoadBMFont(const char *fileName)
{
@@ -943,7 +974,9 @@ static SpriteFont LoadBMFont(const char *fileName)
return font;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_TTF)
// Generate a sprite font from TTF file data (font size required)
// TODO: Review texture packing method and generation (use oversampling)
static SpriteFont LoadTTF(const char *fileName, int fontSize, int charsCount, int *fontChars)
@@ -1035,4 +1068,5 @@ static SpriteFont LoadTTF(const char *fileName, int fontSize, int charsCount, in
free(charData);
return font;
-} \ No newline at end of file
+}
+#endif
diff --git a/src/textures.c b/src/textures.c
index 7db3bf56..6fff8e75 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -4,24 +4,24 @@
*
* CONFIGURATION:
*
-* #define SUPPORT_STB_IMAGE / INCLUDE_STB_IMAGE
-*
-* #define SUPPORT_FILEFORMAT_BMP / SUPPORT_LOAD_BMP
-* #define SUPPORT_FILEFORMAT_PNG / SUPPORT_LOAD_PNG
+* #define SUPPORT_FILEFORMAT_BMP
+* #define SUPPORT_FILEFORMAT_PNG
* #define SUPPORT_FILEFORMAT_TGA
-* #define SUPPORT_FILEFORMAT_JPG / ENABLE_LOAD_JPG
+* #define SUPPORT_FILEFORMAT_JPG
* #define SUPPORT_FILEFORMAT_GIF
+* #define SUPPORT_FILEFORMAT_PSD
* #define SUPPORT_FILEFORMAT_HDR
-* #define SUPPORT_FILEFORMAT_DDS / ENABLE_LOAD_DDS
+* #define SUPPORT_FILEFORMAT_DDS
* #define SUPPORT_FILEFORMAT_PKM
* #define SUPPORT_FILEFORMAT_KTX
* #define SUPPORT_FILEFORMAT_PVR
* #define SUPPORT_FILEFORMAT_ASTC
-* Selected desired fileformats to be supported for loading. Some of those formats are
+* Selecte desired fileformats to be supported for image data loading. Some of those formats are
* supported by default, to remove support, just comment unrequired #define in this module
*
-* #define SUPPORT_IMAGE_RESIZE / INCLUDE_STB_IMAGE_RESIZE
* #define SUPPORT_IMAGE_MANIPULATION
+* Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop...
+* If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()
*
* DEPENDENCIES:
* stb_image - Multiple image formats loading (JPEG, PNG, BMP, TGA, PSD, GIF, PIC)
@@ -31,7 +31,7 @@
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -50,6 +50,12 @@
*
**********************************************************************************************/
+// Default configuration flags (supported features)
+//-------------------------------------------------
+#define SUPPORT_FILEFORMAT_PNG
+#define SUPPORT_IMAGE_MANIPULATION
+//-------------------------------------------------
+
#include "raylib.h"
#include <stdlib.h> // Required for: malloc(), free()
@@ -61,23 +67,46 @@
#include "utils.h" // Required for: fopen() Android mapping, TraceLog()
-// Support only desired texture formats, by default: JPEG, PNG, BMP, TGA
-//#define STBI_NO_JPEG // Image format .jpg and .jpeg
-//#define STBI_NO_PNG
-//#define STBI_NO_BMP
-//#define STBI_NO_TGA
-#define STBI_NO_PSD
-#define STBI_NO_GIF
-#define STBI_NO_HDR
+// Support only desired texture formats on stb_image
+#if !defined(SUPPORT_FILEFORMAT_BMP)
+ #define STBI_NO_BMP
+#endif
+#if !defined(SUPPORT_FILEFORMAT_PNG)
+ #define STBI_NO_PNG
+#endif
+#if !defined(SUPPORT_FILEFORMAT_TGA)
+ #define STBI_NO_TGA
+#endif
+#if !defined(SUPPORT_FILEFORMAT_JPG)
+ #define STBI_NO_JPEG // Image format .jpg and .jpeg
+#endif
+#if !defined(SUPPORT_FILEFORMAT_PSD)
+ #define STBI_NO_PSD
+#endif
+#if !defined(SUPPORT_FILEFORMAT_GIF)
+ #define STBI_NO_GIF
+#endif
+#if !defined(SUPPORT_FILEFORMAT_HDR)
+ #define STBI_NO_HDR
+#endif
+
+// Image fileformats not supported by default
#define STBI_NO_PIC
#define STBI_NO_PNM // Image format .ppm and .pgm
-#define STB_IMAGE_IMPLEMENTATION
-#include "external/stb_image.h" // Required for: stbi_load()
- // NOTE: Used to read image data (multiple formats support)
-#define STB_IMAGE_RESIZE_IMPLEMENTATION
-#include "external/stb_image_resize.h" // Required for: stbir_resize_uint8()
- // NOTE: Used for image scaling on ImageResize()
+#if (defined(SUPPORT_FILEFORMAT_BMP) || defined(SUPPORT_FILEFORMAT_PNG) || defined(SUPPORT_FILEFORMAT_TGA) || \
+ defined(SUPPORT_FILEFORMAT_JPG) || defined(SUPPORT_FILEFORMAT_PSD) || defined(SUPPORT_FILEFORMAT_GIF) || \
+ defined(SUPPORT_FILEFORMAT_HDR))
+ #define STB_IMAGE_IMPLEMENTATION
+ #include "external/stb_image.h" // Required for: stbi_load()
+ // NOTE: Used to read image data (multiple formats support)
+#endif
+
+#if defined(SUPPORT_IMAGE_MANIPULATION)
+ #define STB_IMAGE_RESIZE_IMPLEMENTATION
+ #include "external/stb_image_resize.h" // Required for: stbir_resize_uint8()
+ // NOTE: Used for image scaling on ImageResize()
+#endif
//----------------------------------------------------------------------------------
// Defines and Macros
@@ -102,11 +131,21 @@
//----------------------------------------------------------------------------------
// Module specific Functions Declaration
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_FILEFORMAT_DDS)
static Image LoadDDS(const char *fileName); // Load DDS file
+#endif
+#if defined(SUPPORT_FILEFORMAT_PKM)
static Image LoadPKM(const char *fileName); // Load PKM file
+#endif
+#if defined(SUPPORT_FILEFORMAT_KTX)
static Image LoadKTX(const char *fileName); // Load KTX file
+#endif
+#if defined(SUPPORT_FILEFORMAT_PVR)
static Image LoadPVR(const char *fileName); // Load PVR file
+#endif
+#if defined(SUPPORT_FILEFORMAT_ASTC)
static Image LoadASTC(const char *fileName); // Load ASTC file
+#endif
//----------------------------------------------------------------------------------
// Module Functions Definition
@@ -124,19 +163,22 @@ Image LoadImage(const char *fileName)
image.mipmaps = 0;
image.format = 0;
- if ((strcmp(GetExtension(fileName),"png") == 0) ||
- (strcmp(GetExtension(fileName),"bmp") == 0) ||
- (strcmp(GetExtension(fileName),"tga") == 0) ||
- (strcmp(GetExtension(fileName),"jpg") == 0)
-#ifndef STBI_NO_GIF
+ if ((strcmp(GetExtension(fileName),"png") == 0)
+#if defined(SUPPORT_FILEFORMAT_BMP)
+ || (strcmp(GetExtension(fileName),"bmp") == 0)
+#endif
+#if defined(SUPPORT_FILEFORMAT_TGA)
+ || (strcmp(GetExtension(fileName),"tga") == 0)
+#endif
+#if defined(SUPPORT_FILEFORMAT_JPG)
+ || (strcmp(GetExtension(fileName),"jpg") == 0)
+#endif
+#if defined(SUPPORT_FILEFORMAT_DDS)
|| (strcmp(GetExtension(fileName),"gif") == 0)
#endif
-#ifndef STBI_NO_PSD
+#if defined(SUPPORT_FILEFORMAT_PSD)
|| (strcmp(GetExtension(fileName),"psd") == 0)
#endif
-#ifndef STBI_NO_PIC
- || (strcmp(GetExtension(fileName),"pic") == 0)
-#endif
)
{
int imgWidth = 0;
@@ -155,11 +197,21 @@ Image LoadImage(const char *fileName)
else if (imgBpp == 3) image.format = UNCOMPRESSED_R8G8B8;
else if (imgBpp == 4) image.format = UNCOMPRESSED_R8G8B8A8;
}
+#if defined(SUPPORT_FILEFORMAT_DDS)
else if (strcmp(GetExtension(fileName),"dds") == 0) image = LoadDDS(fileName);
+#endif
+#if defined(SUPPORT_FILEFORMAT_PKM)
else if (strcmp(GetExtension(fileName),"pkm") == 0) image = LoadPKM(fileName);
+#endif
+#if defined(SUPPORT_FILEFORMAT_KTX)
else if (strcmp(GetExtension(fileName),"ktx") == 0) image = LoadKTX(fileName);
+#endif
+#if defined(SUPPORT_FILEFORMAT_PVR)
else if (strcmp(GetExtension(fileName),"pvr") == 0) image = LoadPVR(fileName);
+#endif
+#if defined(SUPPORT_FILEFORMAT_ASTC)
else if (strcmp(GetExtension(fileName),"astc") == 0) image = LoadASTC(fileName);
+#endif
else if (strcmp(GetExtension(fileName),"rres") == 0)
{
RRES rres = LoadResource(fileName, 0);
@@ -171,6 +223,7 @@ Image LoadImage(const char *fileName)
UnloadResource(rres);
}
+ else TraceLog("[%s] Image fileformat not supported", fileName);
if (image.data != NULL) TraceLog(INFO, "[%s] Image loaded successfully (%ix%i)", fileName, image.width, image.height);
else TraceLog(WARNING, "[%s] Image could not be loaded", fileName);
@@ -664,115 +717,6 @@ void ImageAlphaMask(Image *image, Image alphaMask)
}
}
-// Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
-// NOTE: In case selected bpp do not represent an known 16bit format,
-// dithered data is stored in the LSB part of the unsigned short
-void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
-{
- if (image->format >= COMPRESSED_DXT1_RGB)
- {
- TraceLog(WARNING, "Compressed data formats can not be dithered");
- return;
- }
-
- if ((rBpp+gBpp+bBpp+aBpp) > 16)
- {
- TraceLog(WARNING, "Unsupported dithering bpps (%ibpp), only 16bpp or lower modes supported", (rBpp+gBpp+bBpp+aBpp));
- }
- else
- {
- Color *pixels = GetImageData(*image);
-
- free(image->data); // free old image data
-
- if ((image->format != UNCOMPRESSED_R8G8B8) && (image->format != UNCOMPRESSED_R8G8B8A8))
- {
- TraceLog(WARNING, "Image format is already 16bpp or lower, dithering could have no effect");
- }
-
- // Define new image format, check if desired bpp match internal known format
- if ((rBpp == 5) && (gBpp == 6) && (bBpp == 5) && (aBpp == 0)) image->format = UNCOMPRESSED_R5G6B5;
- else if ((rBpp == 5) && (gBpp == 5) && (bBpp == 5) && (aBpp == 1)) image->format = UNCOMPRESSED_R5G5B5A1;
- else if ((rBpp == 4) && (gBpp == 4) && (bBpp == 4) && (aBpp == 4)) image->format = UNCOMPRESSED_R4G4B4A4;
- else
- {
- image->format = 0;
- TraceLog(WARNING, "Unsupported dithered OpenGL internal format: %ibpp (R%iG%iB%iA%i)", (rBpp+gBpp+bBpp+aBpp), rBpp, gBpp, bBpp, aBpp);
- }
-
- // NOTE: We will store the dithered data as unsigned short (16bpp)
- image->data = (unsigned short *)malloc(image->width*image->height*sizeof(unsigned short));
-
- Color oldPixel = WHITE;
- Color newPixel = WHITE;
-
- int rError, gError, bError;
- unsigned short rPixel, gPixel, bPixel, aPixel; // Used for 16bit pixel composition
-
- #define MIN(a,b) (((a)<(b))?(a):(b))
-
- for (int y = 0; y < image->height; y++)
- {
- for (int x = 0; x < image->width; x++)
- {
- oldPixel = pixels[y*image->width + x];
-
- // NOTE: New pixel obtained by bits truncate, it would be better to round values (check ImageFormat())
- newPixel.r = oldPixel.r >> (8 - rBpp); // R bits
- newPixel.g = oldPixel.g >> (8 - gBpp); // G bits
- newPixel.b = oldPixel.b >> (8 - bBpp); // B bits
- newPixel.a = oldPixel.a >> (8 - aBpp); // A bits (not used on dithering)
-
- // NOTE: Error must be computed between new and old pixel but using same number of bits!
- // We want to know how much color precision we have lost...
- rError = (int)oldPixel.r - (int)(newPixel.r << (8 - rBpp));
- gError = (int)oldPixel.g - (int)(newPixel.g << (8 - gBpp));
- bError = (int)oldPixel.b - (int)(newPixel.b << (8 - bBpp));
-
- pixels[y*image->width + x] = newPixel;
-
- // NOTE: Some cases are out of the array and should be ignored
- if (x < (image->width - 1))
- {
- pixels[y*image->width + x+1].r = MIN((int)pixels[y*image->width + x+1].r + (int)((float)rError*7.0f/16), 0xff);
- pixels[y*image->width + x+1].g = MIN((int)pixels[y*image->width + x+1].g + (int)((float)gError*7.0f/16), 0xff);
- pixels[y*image->width + x+1].b = MIN((int)pixels[y*image->width + x+1].b + (int)((float)bError*7.0f/16), 0xff);
- }
-
- if ((x > 0) && (y < (image->height - 1)))
- {
- pixels[(y+1)*image->width + x-1].r = MIN((int)pixels[(y+1)*image->width + x-1].r + (int)((float)rError*3.0f/16), 0xff);
- pixels[(y+1)*image->width + x-1].g = MIN((int)pixels[(y+1)*image->width + x-1].g + (int)((float)gError*3.0f/16), 0xff);
- pixels[(y+1)*image->width + x-1].b = MIN((int)pixels[(y+1)*image->width + x-1].b + (int)((float)bError*3.0f/16), 0xff);
- }
-
- if (y < (image->height - 1))
- {
- pixels[(y+1)*image->width + x].r = MIN((int)pixels[(y+1)*image->width + x].r + (int)((float)rError*5.0f/16), 0xff);
- pixels[(y+1)*image->width + x].g = MIN((int)pixels[(y+1)*image->width + x].g + (int)((float)gError*5.0f/16), 0xff);
- pixels[(y+1)*image->width + x].b = MIN((int)pixels[(y+1)*image->width + x].b + (int)((float)bError*5.0f/16), 0xff);
- }
-
- if ((x < (image->width - 1)) && (y < (image->height - 1)))
- {
- pixels[(y+1)*image->width + x+1].r = MIN((int)pixels[(y+1)*image->width + x+1].r + (int)((float)rError*1.0f/16), 0xff);
- pixels[(y+1)*image->width + x+1].g = MIN((int)pixels[(y+1)*image->width + x+1].g + (int)((float)gError*1.0f/16), 0xff);
- pixels[(y+1)*image->width + x+1].b = MIN((int)pixels[(y+1)*image->width + x+1].b + (int)((float)bError*1.0f/16), 0xff);
- }
-
- rPixel = (unsigned short)newPixel.r;
- gPixel = (unsigned short)newPixel.g;
- bPixel = (unsigned short)newPixel.b;
- aPixel = (unsigned short)newPixel.a;
-
- ((unsigned short *)image->data)[y*image->width + x] = (rPixel << (gBpp + bBpp + aBpp)) | (gPixel << (bBpp + aBpp)) | (bPixel << aBpp) | aPixel;
- }
- }
-
- free(pixels);
- }
-}
-
// Convert image to POT (power-of-two)
// NOTE: It could be useful on OpenGL ES 2.0 (RPI, HTML5)
void ImageToPOT(Image *image, Color fillColor)
@@ -818,6 +762,7 @@ void ImageToPOT(Image *image, Color fillColor)
}
}
+#if defined(SUPPORT_IMAGE_MANIPULATION)
// Copy an image to a new image
Image ImageCopy(Image image)
{
@@ -1203,6 +1148,115 @@ void ImageFlipHorizontal(Image *image)
image->data = processed.data;
}
+// Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
+// NOTE: In case selected bpp do not represent an known 16bit format,
+// dithered data is stored in the LSB part of the unsigned short
+void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
+{
+ if (image->format >= COMPRESSED_DXT1_RGB)
+ {
+ TraceLog(WARNING, "Compressed data formats can not be dithered");
+ return;
+ }
+
+ if ((rBpp+gBpp+bBpp+aBpp) > 16)
+ {
+ TraceLog(WARNING, "Unsupported dithering bpps (%ibpp), only 16bpp or lower modes supported", (rBpp+gBpp+bBpp+aBpp));
+ }
+ else
+ {
+ Color *pixels = GetImageData(*image);
+
+ free(image->data); // free old image data
+
+ if ((image->format != UNCOMPRESSED_R8G8B8) && (image->format != UNCOMPRESSED_R8G8B8A8))
+ {
+ TraceLog(WARNING, "Image format is already 16bpp or lower, dithering could have no effect");
+ }
+
+ // Define new image format, check if desired bpp match internal known format
+ if ((rBpp == 5) && (gBpp == 6) && (bBpp == 5) && (aBpp == 0)) image->format = UNCOMPRESSED_R5G6B5;
+ else if ((rBpp == 5) && (gBpp == 5) && (bBpp == 5) && (aBpp == 1)) image->format = UNCOMPRESSED_R5G5B5A1;
+ else if ((rBpp == 4) && (gBpp == 4) && (bBpp == 4) && (aBpp == 4)) image->format = UNCOMPRESSED_R4G4B4A4;
+ else
+ {
+ image->format = 0;
+ TraceLog(WARNING, "Unsupported dithered OpenGL internal format: %ibpp (R%iG%iB%iA%i)", (rBpp+gBpp+bBpp+aBpp), rBpp, gBpp, bBpp, aBpp);
+ }
+
+ // NOTE: We will store the dithered data as unsigned short (16bpp)
+ image->data = (unsigned short *)malloc(image->width*image->height*sizeof(unsigned short));
+
+ Color oldPixel = WHITE;
+ Color newPixel = WHITE;
+
+ int rError, gError, bError;
+ unsigned short rPixel, gPixel, bPixel, aPixel; // Used for 16bit pixel composition
+
+ #define MIN(a,b) (((a)<(b))?(a):(b))
+
+ for (int y = 0; y < image->height; y++)
+ {
+ for (int x = 0; x < image->width; x++)
+ {
+ oldPixel = pixels[y*image->width + x];
+
+ // NOTE: New pixel obtained by bits truncate, it would be better to round values (check ImageFormat())
+ newPixel.r = oldPixel.r >> (8 - rBpp); // R bits
+ newPixel.g = oldPixel.g >> (8 - gBpp); // G bits
+ newPixel.b = oldPixel.b >> (8 - bBpp); // B bits
+ newPixel.a = oldPixel.a >> (8 - aBpp); // A bits (not used on dithering)
+
+ // NOTE: Error must be computed between new and old pixel but using same number of bits!
+ // We want to know how much color precision we have lost...
+ rError = (int)oldPixel.r - (int)(newPixel.r << (8 - rBpp));
+ gError = (int)oldPixel.g - (int)(newPixel.g << (8 - gBpp));
+ bError = (int)oldPixel.b - (int)(newPixel.b << (8 - bBpp));
+
+ pixels[y*image->width + x] = newPixel;
+
+ // NOTE: Some cases are out of the array and should be ignored
+ if (x < (image->width - 1))
+ {
+ pixels[y*image->width + x+1].r = MIN((int)pixels[y*image->width + x+1].r + (int)((float)rError*7.0f/16), 0xff);
+ pixels[y*image->width + x+1].g = MIN((int)pixels[y*image->width + x+1].g + (int)((float)gError*7.0f/16), 0xff);
+ pixels[y*image->width + x+1].b = MIN((int)pixels[y*image->width + x+1].b + (int)((float)bError*7.0f/16), 0xff);
+ }
+
+ if ((x > 0) && (y < (image->height - 1)))
+ {
+ pixels[(y+1)*image->width + x-1].r = MIN((int)pixels[(y+1)*image->width + x-1].r + (int)((float)rError*3.0f/16), 0xff);
+ pixels[(y+1)*image->width + x-1].g = MIN((int)pixels[(y+1)*image->width + x-1].g + (int)((float)gError*3.0f/16), 0xff);
+ pixels[(y+1)*image->width + x-1].b = MIN((int)pixels[(y+1)*image->width + x-1].b + (int)((float)bError*3.0f/16), 0xff);
+ }
+
+ if (y < (image->height - 1))
+ {
+ pixels[(y+1)*image->width + x].r = MIN((int)pixels[(y+1)*image->width + x].r + (int)((float)rError*5.0f/16), 0xff);
+ pixels[(y+1)*image->width + x].g = MIN((int)pixels[(y+1)*image->width + x].g + (int)((float)gError*5.0f/16), 0xff);
+ pixels[(y+1)*image->width + x].b = MIN((int)pixels[(y+1)*image->width + x].b + (int)((float)bError*5.0f/16), 0xff);
+ }
+
+ if ((x < (image->width - 1)) && (y < (image->height - 1)))
+ {
+ pixels[(y+1)*image->width + x+1].r = MIN((int)pixels[(y+1)*image->width + x+1].r + (int)((float)rError*1.0f/16), 0xff);
+ pixels[(y+1)*image->width + x+1].g = MIN((int)pixels[(y+1)*image->width + x+1].g + (int)((float)gError*1.0f/16), 0xff);
+ pixels[(y+1)*image->width + x+1].b = MIN((int)pixels[(y+1)*image->width + x+1].b + (int)((float)bError*1.0f/16), 0xff);
+ }
+
+ rPixel = (unsigned short)newPixel.r;
+ gPixel = (unsigned short)newPixel.g;
+ bPixel = (unsigned short)newPixel.b;
+ aPixel = (unsigned short)newPixel.a;
+
+ ((unsigned short *)image->data)[y*image->width + x] = (rPixel << (gBpp + bBpp + aBpp)) | (gPixel << (bBpp + aBpp)) | (bPixel << aBpp) | aPixel;
+ }
+ }
+
+ free(pixels);
+ }
+}
+
// Modify image color: tint
void ImageColorTint(Image *image, Color color)
{
@@ -1359,6 +1413,7 @@ void ImageColorBrightness(Image *image, int brightness)
image->data = processed.data;
}
+#endif // SUPPORT_IMAGE_MANIPULATION
// Generate GPU mipmaps for a texture
void GenTextureMipmaps(Texture2D *texture)
@@ -1547,6 +1602,7 @@ void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, V
// Module specific Functions Definition
//----------------------------------------------------------------------------------
+#if defined(SUPPORT_FILEFORMAT_DDS)
// Loading DDS image data (compressed or uncompressed)
static Image LoadDDS(const char *fileName)
{
@@ -1744,7 +1800,9 @@ static Image LoadDDS(const char *fileName)
return image;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_PKM)
// Loading PKM image data (ETC1/ETC2 compression)
// NOTE: KTX is the standard Khronos Group compression format (ETC1/ETC2, mipmaps)
// PKM is a much simpler file format used mainly to contain a single ETC1/ETC2 compressed image (no mipmaps)
@@ -1836,7 +1894,9 @@ static Image LoadPKM(const char *fileName)
return image;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_KTX)
// Load KTX compressed image data (ETC1/ETC2 compression)
static Image LoadKTX(const char *fileName)
{
@@ -1929,7 +1989,9 @@ static Image LoadKTX(const char *fileName)
return image;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_PVR)
// Loading PVR image data (uncompressed or PVRT compression)
// NOTE: PVR v2 not supported, use PVR v3 instead
static Image LoadPVR(const char *fileName)
@@ -2087,7 +2149,9 @@ static Image LoadPVR(const char *fileName)
return image;
}
+#endif
+#if defined(SUPPORT_FILEFORMAT_ASTC)
// Load ASTC compressed image data (ASTC compression)
static Image LoadASTC(const char *fileName)
{
@@ -2170,3 +2234,4 @@ static Image LoadASTC(const char *fileName)
return image;
}
+#endif \ No newline at end of file
diff --git a/src/utils.c b/src/utils.c
index 9a2a723a..6a07f301 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -4,22 +4,28 @@
*
* CONFIGURATION:
*
-* #define SUPPORT_SAVE_PNG
-* Enable saving PNG fileformat
+* #define SUPPORT_SAVE_PNG (defined by default)
+* Support saving image data as PNG fileformat
* NOTE: Requires stb_image_write library
*
* #define SUPPORT_SAVE_BMP
+* Support saving image data as BMP fileformat
+* NOTE: Requires stb_image_write library
+*
+* #define SUPPORT_TRACELOG
+* Show TraceLog() output messages
+* NOTE: By default DEBUG traces not shown
*
-* #define DO_NOT_TRACE_DEBUG_MSGS
-* Avoid showing DEBUG TraceLog() messages
+* #define SUPPORT_TRACELOG_DEBUG
+* Show TraceLog() DEBUG messages
*
* DEPENDENCIES:
-* stb_image_write - PNG writting functions
+* stb_image_write - BMP/PNG writting functions
*
*
* LICENSE: zlib/libpng
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* Copyright (c) 2014-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.
@@ -129,18 +135,46 @@ void TraceLog(int msgType, const char *text, ...)
}
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
+
+#if defined(SUPPORT_SAVE_BMP)
// Creates a BMP image file from an array of pixel data
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize)
{
stbi_write_bmp(fileName, width, height, compSize, imgData);
}
+#endif
+#if defined(SUPPORT_SAVE_PNG)
// Creates a PNG image file from an array of pixel data
void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize)
{
stbi_write_png(fileName, width, height, compSize, imgData, width*compSize);
}
#endif
+#endif
+
+// Keep track of memory allocated
+// NOTE: mallocType defines the type of data allocated
+/*
+void RecordMalloc(int mallocType, int mallocSize, const char *msg)
+{
+ // TODO: Investigate how to record memory allocation data...
+ // Maybe creating my own malloc function...
+}
+*/
+
+bool IsFileExtension(const char *fileName, const char *ext)
+{
+ return (strcmp(GetExtension(fileName), ext) == 0);
+}
+
+// Get the extension for a filename
+const char *GetExtension(const char *fileName)
+{
+ const char *dot = strrchr(fileName, '.');
+ if (!dot || dot == fileName) return "";
+ return (dot + 1);
+}
#if defined(PLATFORM_ANDROID)
// Initialize asset manager from android app
@@ -162,24 +196,6 @@ FILE *android_fopen(const char *fileName, const char *mode)
}
#endif
-// Keep track of memory allocated
-// NOTE: mallocType defines the type of data allocated
-/*
-void RecordMalloc(int mallocType, int mallocSize, const char *msg)
-{
- // TODO: Investigate how to record memory allocation data...
- // Maybe creating my own malloc function...
-}
-*/
-
-// Get the extension for a filename
-const char *GetExtension(const char *fileName)
-{
- const char *dot = strrchr(fileName, '.');
- if (!dot || dot == fileName) return "";
- return (dot + 1);
-}
-
//----------------------------------------------------------------------------------
// Module specific Functions Definition
//----------------------------------------------------------------------------------
diff --git a/src/utils.h b/src/utils.h
index 3ffd025c..45ffcf81 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,10 +1,11 @@
/**********************************************************************************************
*
-* raylib.utils
+* raylib.utils - Some common utility functions
*
-* Some utility functions
*
-* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
+* LICENSE: zlib/libpng
+*
+* Copyright (c) 2014-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.
@@ -33,6 +34,8 @@
#include "rres.h"
+#define SUPPORT_SAVE_PNG
+
//----------------------------------------------------------------------------------
// Some basic Defines
//----------------------------------------------------------------------------------
@@ -61,9 +64,13 @@ void TraceLog(int msgType, const char *text, ...); // Outputs a trace log messa
const char *GetExtension(const char *fileName); // Returns extension of a filename
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
+#if defined(SUPPORT_SAVE_BMP)
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
+#endif
+#if defined(SUPPORT_SAVE_PNG)
void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize);
#endif
+#endif
#if defined(PLATFORM_ANDROID)
void InitAssetManager(AAssetManager *manager); // Initialize asset manager from android app
diff --git a/templates/advance_game/Makefile b/templates/advance_game/Makefile
index b3947205..0be29360 100644
--- a/templates/advance_game/Makefile
+++ b/templates/advance_game/Makefile
@@ -4,7 +4,7 @@
#
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
diff --git a/templates/advance_game/advance_game.c b/templates/advance_game/advance_game.c
index 891bbaf1..5e837f87 100644
--- a/templates/advance_game/advance_game.c
+++ b/templates/advance_game/advance_game.c
@@ -8,7 +8,7 @@
* This game has been created using raylib (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/templates/advance_game/screens/screen_ending.c b/templates/advance_game/screens/screen_ending.c
index 3d9f81a1..c776be3e 100644
--- a/templates/advance_game/screens/screen_ending.c
+++ b/templates/advance_game/screens/screen_ending.c
@@ -4,7 +4,7 @@
*
* Ending Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/advance_game/screens/screen_gameplay.c b/templates/advance_game/screens/screen_gameplay.c
index 307f2ea3..f70ddb09 100644
--- a/templates/advance_game/screens/screen_gameplay.c
+++ b/templates/advance_game/screens/screen_gameplay.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/advance_game/screens/screen_logo.c b/templates/advance_game/screens/screen_logo.c
index 1cd42830..cb60e516 100644
--- a/templates/advance_game/screens/screen_logo.c
+++ b/templates/advance_game/screens/screen_logo.c
@@ -4,7 +4,7 @@
*
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/advance_game/screens/screen_options.c b/templates/advance_game/screens/screen_options.c
index 87d32264..1f69a3b9 100644
--- a/templates/advance_game/screens/screen_options.c
+++ b/templates/advance_game/screens/screen_options.c
@@ -4,7 +4,7 @@
*
* Options Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/advance_game/screens/screen_title.c b/templates/advance_game/screens/screen_title.c
index 9c288fb5..8f2cf4af 100644
--- a/templates/advance_game/screens/screen_title.c
+++ b/templates/advance_game/screens/screen_title.c
@@ -4,7 +4,7 @@
*
* Title Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/advance_game/screens/screens.h b/templates/advance_game/screens/screens.h
index 88537d9b..43c335a6 100644
--- a/templates/advance_game/screens/screens.h
+++ b/templates/advance_game/screens/screens.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/android_project/jni/basic_game.c b/templates/android_project/jni/basic_game.c
index c801cbaa..1109f9e8 100644
--- a/templates/android_project/jni/basic_game.c
+++ b/templates/android_project/jni/basic_game.c
@@ -8,7 +8,7 @@
* This game 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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/templates/basic_game/Makefile b/templates/basic_game/Makefile
index 76337490..b9704b4b 100644
--- a/templates/basic_game/Makefile
+++ b/templates/basic_game/Makefile
@@ -4,7 +4,7 @@
#
# makefile to compile basic game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
diff --git a/templates/basic_test/Makefile b/templates/basic_test/Makefile
index b6fd44a7..7986f375 100644
--- a/templates/basic_test/Makefile
+++ b/templates/basic_test/Makefile
@@ -4,7 +4,7 @@
#
# makefile to compile basic test for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
diff --git a/templates/basic_test/basic_test.c b/templates/basic_test/basic_test.c
index d4359df5..7e732149 100644
--- a/templates/basic_test/basic_test.c
+++ b/templates/basic_test/basic_test.c
@@ -7,7 +7,7 @@
* This example 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)
+* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/templates/simple_game/Makefile b/templates/simple_game/Makefile
index 3d303082..bea25125 100644
--- a/templates/simple_game/Makefile
+++ b/templates/simple_game/Makefile
@@ -4,7 +4,7 @@
#
# makefile to compile simple game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
diff --git a/templates/simple_game/screens.c b/templates/simple_game/screens.c
index 742cf6f8..af5a9dfb 100644
--- a/templates/simple_game/screens.c
+++ b/templates/simple_game/screens.c
@@ -4,7 +4,7 @@
*
* Screens Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/simple_game/screens.h b/templates/simple_game/screens.h
index 7afaebeb..5aa53617 100644
--- a/templates/simple_game/screens.h
+++ b/templates/simple_game/screens.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/simple_game/simple_game.c b/templates/simple_game/simple_game.c
index b4d75719..d8de3c28 100644
--- a/templates/simple_game/simple_game.c
+++ b/templates/simple_game/simple_game.c
@@ -8,7 +8,7 @@
* This game has been created using raylib (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* raylib - Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* raylib - Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
diff --git a/templates/standard_game/Makefile b/templates/standard_game/Makefile
index c7cb7add..1abdbabc 100644
--- a/templates/standard_game/Makefile
+++ b/templates/standard_game/Makefile
@@ -4,7 +4,7 @@
#
# makefile to compile standard game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
-# Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+# 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.
diff --git a/templates/standard_game/screens/screen_ending.c b/templates/standard_game/screens/screen_ending.c
index e01cd6ad..de16fc8f 100644
--- a/templates/standard_game/screens/screen_ending.c
+++ b/templates/standard_game/screens/screen_ending.c
@@ -4,7 +4,7 @@
*
* Ending Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/standard_game/screens/screen_gameplay.c b/templates/standard_game/screens/screen_gameplay.c
index 13752d01..e6e45156 100644
--- a/templates/standard_game/screens/screen_gameplay.c
+++ b/templates/standard_game/screens/screen_gameplay.c
@@ -4,7 +4,7 @@
*
* Gameplay Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/standard_game/screens/screen_logo.c b/templates/standard_game/screens/screen_logo.c
index 41cb5678..2cfa0ca4 100644
--- a/templates/standard_game/screens/screen_logo.c
+++ b/templates/standard_game/screens/screen_logo.c
@@ -4,7 +4,7 @@
*
* Logo Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/standard_game/screens/screen_options.c b/templates/standard_game/screens/screen_options.c
index bb490672..9ac852d9 100644
--- a/templates/standard_game/screens/screen_options.c
+++ b/templates/standard_game/screens/screen_options.c
@@ -4,7 +4,7 @@
*
* Options Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/standard_game/screens/screen_title.c b/templates/standard_game/screens/screen_title.c
index 0082fa12..c9700e8b 100644
--- a/templates/standard_game/screens/screen_title.c
+++ b/templates/standard_game/screens/screen_title.c
@@ -4,7 +4,7 @@
*
* Title Screen Functions Definitions (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/standard_game/screens/screens.h b/templates/standard_game/screens/screens.h
index eb4aa8b7..9d558508 100644
--- a/templates/standard_game/screens/screens.h
+++ b/templates/standard_game/screens/screens.h
@@ -4,7 +4,7 @@
*
* Screens Functions Declarations (Init, Update, Draw, Unload)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* 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.
diff --git a/templates/standard_game/standard_game.c b/templates/standard_game/standard_game.c
index e4dafc70..36ca30f9 100644
--- a/templates/standard_game/standard_game.c
+++ b/templates/standard_game/standard_game.c
@@ -8,7 +8,7 @@
* This game has been created using raylib (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* raylib - Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* raylib - Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/