Examples review...
This commit is contained in:
parent
e6bc655d6a
commit
8847602061
9 changed files with 26 additions and 16 deletions
|
@ -27,8 +27,8 @@ int main()
|
||||||
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
|
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
|
||||||
|
|
||||||
int framesCounter = 0;
|
int framesCounter = 0;
|
||||||
float volume = 1.0;
|
|
||||||
float timePlayed = 0;
|
float timePlayed = 0;
|
||||||
|
//float volume = 1.0;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -2,6 +2,16 @@
|
||||||
*
|
*
|
||||||
* raylib [core] example - Basic window
|
* 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)
|
* 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)
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
*
|
*
|
||||||
|
|
|
@ -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)
|
* 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)
|
* 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
|
// 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 }};
|
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)
|
Image img = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM)
|
||||||
Texture2D texture = CreateTexture(img, false); // Convert image to texture (VRAM)
|
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
|
||||||
Model map = LoadCubesmap(img); // Load cubesmap model
|
Model map = LoadCubicmap(img); // Load cubicmap model
|
||||||
SetModelTexture(&map, texture); // Bind texture to model
|
SetModelTexture(&map, texture); // Bind texture to model
|
||||||
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
|
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
|
||||||
|
|
||||||
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM
|
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
@ -23,11 +23,11 @@ int main()
|
||||||
// Define the camera to look into our 3d world
|
// 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 }};
|
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)
|
Image img = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
||||||
Texture2D texture = CreateTexture(img, false); // Convert image to texture (VRAM)
|
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
|
||||||
Model map = LoadHeightmap(img, 4); // Load heightmap model
|
Model map = LoadHeightmap(img, 4); // Load heightmap model
|
||||||
SetModelTexture(&map, texture); // Bind texture to model
|
SetModelTexture(&map, texture); // Bind texture to model
|
||||||
Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
|
Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
|
||||||
|
|
||||||
UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM
|
UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
|
@ -24,8 +24,8 @@ int main()
|
||||||
|
|
||||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
|
||||||
Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
|
Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
|
||||||
Texture2D texture = CreateTexture(img, false); // Image converted to texture, GPU memory (VRAM)
|
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
|
UnloadImage(img); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
|
||||||
//---------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -27,7 +27,7 @@ int main()
|
||||||
// with mipmaps option set to true on CreateTexture()
|
// with mipmaps option set to true on CreateTexture()
|
||||||
|
|
||||||
Image image = LoadImage("resources/raylib_logo.png"); // Load image to CPU memory (RAM)
|
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
|
UnloadImage(image); // Once texture has been created, we can unload image data from RAM
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* raylib now uses OpenGL 1.1 style functions (rlVertex) that are mapped to selected OpenGL version:
|
* raylib now uses OpenGL 1.1 style functions (rlVertex) that are mapped to selected OpenGL version:
|
||||||
* OpenGL 1.1 - Direct map rl* -> gl*
|
* OpenGL 1.1 - Direct map rl* -> gl*
|
||||||
* OpenGL 3.3+ - Vertex data is stored in VAOs, call rlglDraw() to render
|
* OpenGL 3.3+ - Vertex data is stored in VAOs, call rlglDraw() to render
|
||||||
* OpenGL ES 2 - Same behaviour as OpenGL 3.3+
|
* OpenGL ES 2 - Vertex data is stored in VBOs or VAOs (when available), call rlglDraw() to render
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue