aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2015-01-08 20:32:30 +0100
committerRay <raysan5@gmail.com>2015-01-08 20:32:30 +0100
commite37ef10595867e4f189fff0f87db5e6fdfcfc4d0 (patch)
tree0410f5604cc3cfc036f6c1f3ac4333ac33726660 /examples
parentfad81f36e4cfd37901caad8555c49c41ac65aaee (diff)
parent4a7e522d4bb376d2277895d1d99eb0382f8bbefb (diff)
downloadraylib-e37ef10595867e4f189fff0f87db5e6fdfcfc4d0.tar.gz
raylib-e37ef10595867e4f189fff0f87db5e6fdfcfc4d0.zip
Merge pull request #14 from raysan5/master
Integrate master into develop branch
Diffstat (limited to 'examples')
-rw-r--r--examples/audio_music_stream.c2
-rw-r--r--examples/core_basic_window.c10
-rw-r--r--examples/makefile76
-rw-r--r--examples/models_cubicmap.c (renamed from examples/models_cubesmap.c)14
-rw-r--r--examples/models_cubicmap.png (renamed from examples/models_cubesmap.png)bin27438 -> 27438 bytes
-rw-r--r--examples/models_heightmap.c10
-rw-r--r--examples/resources/cubicmap.png (renamed from examples/resources/cubesmap.png)bin173 -> 173 bytes
-rw-r--r--examples/textures_image_loading.c4
-rw-r--r--examples/textures_mipmaps.c2
9 files changed, 78 insertions, 40 deletions
diff --git a/examples/audio_music_stream.c b/examples/audio_music_stream.c
index 5fd4a054..560347e6 100644
--- a/examples/audio_music_stream.c
+++ b/examples/audio_music_stream.c
@@ -27,8 +27,8 @@ int main()
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
int framesCounter = 0;
- float volume = 1.0;
float timePlayed = 0;
+ //float volume = 1.0;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
diff --git a/examples/core_basic_window.c b/examples/core_basic_window.c
index 505d8df4..c6ad8445 100644
--- a/examples/core_basic_window.c
+++ b/examples/core_basic_window.c
@@ -2,6 +2,16 @@
*
* raylib [core] example - Basic window
*
+* Welcome to raylib!
+*
+* To test examples, just press F6 and execute raylib_compile_execute script
+* Note that compiled executable is placed in the same folder as .c file
+*
+* You can find all basic examples on C:\raylib\raylib\examples folder or
+* raylib official webpage: www.raylib.com
+*
+* Enjoy using raylib. :)
+*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
diff --git a/examples/makefile b/examples/makefile
index b9cdd15d..9763b233 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -26,6 +26,23 @@
# WARNING: To compile examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP
+# determine SUBPLATFORM in case PLATFORM_DESKTOP selected
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
+ ifeq ($(OS),Windows_NT)
+ SUBPLATFORM=WINDOWS
+ else
+ UNAMEOS:=$(shell uname)
+ ifeq ($(UNAMEOS),Linux)
+ SUBPLATFORM=LINUX
+ else
+ ifeq ($(UNAMEOS),Darwin)
+ SUBPLATFORM=OSX
+ endif
+ endif
+ endif
+endif
+
# define compiler: gcc for C program, define as g++ for C++
ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler
@@ -44,14 +61,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
else
CFLAGS = -O2 -Wall -std=c99
endif
-#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
-
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
endif
+#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
+
# define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
@@ -63,28 +80,35 @@ endif
ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../src -L/opt/vc/lib
else
- LFLAGS = -L. -L../src
+ LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/
endif
# define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(SUBPLATFORM),LINUX)
+ # 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
+ endif
+ ifeq ($(SUBPLATFORM),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
+ # libraries for Windows desktop compiling
+ # NOTE: GLFW3 and OpenAL Soft libraries should be installed
+ LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
+ endif
+endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# libraries for Raspberry Pi compiling
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
-else
-ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX)
- # 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
-else
- # libraries for Windows desktop compiling
- # NOTE: GLFW3 and OpenAL Soft libraries should be installed
- LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32
endif
-endif
-
ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../src/libraylib.bc
endif
@@ -265,20 +289,24 @@ audio_music_stream: audio_music_stream.c
# clean everything
clean:
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(SUBPLATFORM),OSX)
+ rm -f *.o
+ else
+ ifeq ($(SUBPLATFORM),LINUX)
+ find . -type f -executable -delete
+ rm -f *.o
+ else
+ del *.o *.exe
+ endif
+ endif
+endif
ifeq ($(PLATFORM),PLATFORM_RPI)
- rm -f *.o
-# find . -executable -delete
-else
-ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX)
find . -type f -executable -delete
rm -f *.o
-else
+endif
ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js
-else
- del *.o *.exe
-endif
-endif
endif
@echo Cleaning done
diff --git a/examples/models_cubesmap.c b/examples/models_cubicmap.c
index 580d67e6..60e93c6d 100644
--- a/examples/models_cubesmap.c
+++ b/examples/models_cubicmap.c
@@ -1,6 +1,6 @@
/*******************************************************************************************
*
-* raylib [models] example - Cubesmap loading and drawing
+* raylib [models] example - Cubicmap loading and drawing
*
* This example has been created using raylib 1.2 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
@@ -23,11 +23,11 @@ int main()
// Define the camera to look into our 3d world
Camera camera = {{ 7.0, 7.0, 7.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
- Image img = LoadImage("resources/cubesmap.png"); // Load cubesmap image (RAM)
- Texture2D texture = CreateTexture(img, false); // Convert image to texture (VRAM)
- Model map = LoadCubesmap(img); // Load cubesmap model
- SetModelTexture(&map, texture); // Bind texture to model
- Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
+ Image img = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM)
+ Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
+ Model map = LoadCubicmap(img); // Load cubicmap model
+ SetModelTexture(&map, texture); // Bind texture to model
+ Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM
@@ -77,4 +77,4 @@ int main()
//--------------------------------------------------------------------------------------
return 0;
-} \ No newline at end of file
+}
diff --git a/examples/models_cubesmap.png b/examples/models_cubicmap.png
index f686ba21..f686ba21 100644
--- a/examples/models_cubesmap.png
+++ b/examples/models_cubicmap.png
Binary files differ
diff --git a/examples/models_heightmap.c b/examples/models_heightmap.c
index 6e807b8c..7121c261 100644
--- a/examples/models_heightmap.c
+++ b/examples/models_heightmap.c
@@ -23,11 +23,11 @@ int main()
// Define the camera to look into our 3d world
Camera camera = {{ 10.0, 12.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
- Image img = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
- Texture2D texture = CreateTexture(img, false); // Convert image to texture (VRAM)
- Model map = LoadHeightmap(img, 4); // Load heightmap model
- SetModelTexture(&map, texture); // Bind texture to model
- Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
+ Image img = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
+ Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
+ Model map = LoadHeightmap(img, 4); // Load heightmap model
+ SetModelTexture(&map, texture); // Bind texture to model
+ Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM
diff --git a/examples/resources/cubesmap.png b/examples/resources/cubicmap.png
index 87b95d50..87b95d50 100644
--- a/examples/resources/cubesmap.png
+++ b/examples/resources/cubicmap.png
Binary files differ
diff --git a/examples/textures_image_loading.c b/examples/textures_image_loading.c
index 179cf84c..b7fc2cfc 100644
--- a/examples/textures_image_loading.c
+++ b/examples/textures_image_loading.c
@@ -24,8 +24,8 @@ int main()
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
- Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
- Texture2D texture = CreateTexture(img, false); // Image converted to texture, GPU memory (VRAM)
+ Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
+ Texture2D texture = LoadTextureFromImage(img, false); // Image converted to texture, GPU memory (VRAM)
UnloadImage(img); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
//---------------------------------------------------------------------------------------
diff --git a/examples/textures_mipmaps.c b/examples/textures_mipmaps.c
index ee79f513..d3ba1708 100644
--- a/examples/textures_mipmaps.c
+++ b/examples/textures_mipmaps.c
@@ -27,7 +27,7 @@ int main()
// with mipmaps option set to true on CreateTexture()
Image image = LoadImage("resources/raylib_logo.png"); // Load image to CPU memory (RAM)
- Texture2D texture = CreateTexture(image, true); // Create texture and generate mipmaps
+ Texture2D texture = LoadTextureFromImage(image, true); // Create texture and generate mipmaps
UnloadImage(image); // Once texture has been created, we can unload image data from RAM
//--------------------------------------------------------------------------------------