|
@ -12,6 +12,8 @@ Release: raylib 1.3.0 (01 September 2015)
|
||||||
NOTE:
|
NOTE:
|
||||||
This version supposed a big boost for raylib, new modules have been added with lots of features.
|
This version supposed a big boost for raylib, new modules have been added with lots of features.
|
||||||
Most of the modules have been completely reviewed to accomodate to the new features.
|
Most of the modules have been completely reviewed to accomodate to the new features.
|
||||||
|
Over 50 new functions have been added to previous raylib version.
|
||||||
|
Most of the examples have been redone and 10 new advanced examples have been added.
|
||||||
|
|
||||||
BIG changes:
|
BIG changes:
|
||||||
[camera] NEW MODULE: Set of cameras for 3d view: Free, Orbital, 1st person, 3rd person
|
[camera] NEW MODULE: Set of cameras for 3d view: Free, Orbital, 1st person, 3rd person
|
||||||
|
@ -27,6 +29,7 @@ smaller changes:
|
||||||
[core] Added functions ShowCursor(), HideCursor(), IsCursorHidden()
|
[core] Added functions ShowCursor(), HideCursor(), IsCursorHidden()
|
||||||
[core] Renamed function SetFlags() to SetConfigFlags()
|
[core] Renamed function SetFlags() to SetConfigFlags()
|
||||||
[shapes] Simplified some functions to improve performance
|
[shapes] Simplified some functions to improve performance
|
||||||
|
[textures] Review of Image struct to support multiple data formats
|
||||||
[textures] Added function LoadImageEx()
|
[textures] Added function LoadImageEx()
|
||||||
[textures] Added function LoadImageRaw()
|
[textures] Added function LoadImageRaw()
|
||||||
[textures] Added function LoadTextureEx()
|
[textures] Added function LoadTextureEx()
|
||||||
|
@ -37,6 +40,8 @@ smaller changes:
|
||||||
[textures] Added function ImageConvertFormat()
|
[textures] Added function ImageConvertFormat()
|
||||||
[textures] Added function GenTextureMipmaps()
|
[textures] Added function GenTextureMipmaps()
|
||||||
[text] Added support for Latin-1 Extended characters for default font
|
[text] Added support for Latin-1 Extended characters for default font
|
||||||
|
[text] Redesigned SpriteFont struct, replaced Character struct by Rectangle
|
||||||
|
[text] Removed function GetFontBaseSize(), use directly spriteFont.size
|
||||||
[models] Review of struct: Model (added shaders support)
|
[models] Review of struct: Model (added shaders support)
|
||||||
[models] Added 3d collision functions (sphere vs sphere vs box vs box)
|
[models] Added 3d collision functions (sphere vs sphere vs box vs box)
|
||||||
[models] Added function DrawCubeTexture()
|
[models] Added function DrawCubeTexture()
|
||||||
|
|
14
README.md
|
@ -87,10 +87,10 @@ assigned to models or used as fullscreen postrocessing shaders.
|
||||||
Textures module has been improved to support most of the internal texture formats available in OpenGL
|
Textures module has been improved to support most of the internal texture formats available in OpenGL
|
||||||
(RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT).
|
(RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT).
|
||||||
|
|
||||||
New camera module offers the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, third person),
|
New camera module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
|
||||||
very easy to use, just calling functions: SetCameraMode() and UpdateCamera().
|
Camera modes are very easy to use, just calling functions: SetCameraMode() and UpdateCamera().
|
||||||
|
|
||||||
New gestures module simplifies getures detection on Android and HTML5 programs.
|
New gestures module simplifies gestures detection on Android and HTML5 programs.
|
||||||
|
|
||||||
New IMGUI (Immediate Mode GUI) module: raygui, offers a set of functions to create simple user interfaces,
|
New IMGUI (Immediate Mode GUI) module: raygui, offers a set of functions to create simple user interfaces,
|
||||||
primary intended for tools development, still in experimental state but already fully functional.
|
primary intended for tools development, still in experimental state but already fully functional.
|
||||||
|
@ -277,7 +277,7 @@ If you are using raylib and you enjoy it, please, [let me know][raysan5].
|
||||||
|
|
||||||
If you feel you can help, then, [helpme!](http://www.raylib.com/helpme.htm)
|
If you feel you can help, then, [helpme!](http://www.raylib.com/helpme.htm)
|
||||||
|
|
||||||
acknowledgments
|
acknowledgements
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
|
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
|
||||||
|
@ -288,9 +288,9 @@ The following people have contributed in some way to make raylib project a reali
|
||||||
- Marc Palau for implementating and testing of 3D shapes functions and helping on development of camera and getures modules.
|
- Marc Palau for implementating and testing of 3D shapes functions and helping on development of camera and getures modules.
|
||||||
- Kevin Gato for improving texture internal formats support and helping on raygui development.
|
- Kevin Gato for improving texture internal formats support and helping on raygui development.
|
||||||
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
|
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
|
||||||
- Marc Agüera for testing and using raylib on a real product (Koala Seasons)
|
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
- Daniel Moreno for testing and using raylib on a real product (Koala Seasons)
|
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
- Daniel Gomez for testing and using raylib on a real product (Koala Seasons)
|
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
- Sergio Martinez for helping on raygui development and tools development.
|
- Sergio Martinez for helping on raygui development and tools development.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
91
examples/core_3d_camera_first_person.c
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - 3d camera first person
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_COLUMNS 20
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||||
|
|
||||||
|
// Generates some random columns
|
||||||
|
float heights[MAX_COLUMNS];
|
||||||
|
Vector3 positions[MAX_COLUMNS] = { 0.0, 2.5, 0.0 };
|
||||||
|
Color colors[MAX_COLUMNS];
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
|
{
|
||||||
|
heights[i] = (float)GetRandomValue(1, 12);
|
||||||
|
positions[i] = (Vector3){ GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15) };
|
||||||
|
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 playerPosition = { 4, 2, 4 }; // Define player position
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_FIRST_PERSON); // Set a first person camera mode
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCameraPlayer(&camera, &playerPosition); // Update camera and player position
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 32, 32 }, LIGHTGRAY); // Draw ground
|
||||||
|
DrawCube((Vector3){ -16, 2.5, 0 }, 1, 5, 32, BLUE); // Draw a blue wall
|
||||||
|
DrawCube((Vector3){ 16, 2.5, 0 }, 1, 5, 32, LIME); // Draw a green wall
|
||||||
|
DrawCube((Vector3){ 0, 2.5, 16 }, 32, 5, 1, GOLD); // Draw a yellow wall
|
||||||
|
|
||||||
|
// Draw some cubes around
|
||||||
|
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||||
|
{
|
||||||
|
DrawCube(positions[i], 2, heights[i], 2, colors[i]);
|
||||||
|
DrawCubeWires(positions[i], 2, heights[i], 2, MAROON);
|
||||||
|
}
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("First person camera default controls:", 20, 20, 10, GRAY);
|
||||||
|
DrawText("- Move with keys: W, A, S, D", 40, 50, 10, DARKGRAY);
|
||||||
|
DrawText("- Mouse move to lokk around", 40, 70, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core_3d_camera_first_person.png
Normal file
After Width: | Height: | Size: 18 KiB |
75
examples/core_3d_camera_free.c
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - Initialize 3d camera free
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
|
||||||
|
|
||||||
|
// Define the camera to look into our 3d world
|
||||||
|
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0, 0.0, 0.0 };
|
||||||
|
|
||||||
|
SetCameraMode(CAMERA_FREE); // Set a free camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
|
||||||
|
SetCameraTarget(camera.target); // Set internal camera target to match our camera target
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(WHITE);
|
||||||
|
|
||||||
|
Begin3dMode(camera);
|
||||||
|
|
||||||
|
DrawCube(cubePosition, 2, 2, 2, RED);
|
||||||
|
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
|
||||||
|
|
||||||
|
DrawGrid(10.0, 1.0);
|
||||||
|
|
||||||
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("Free camera default controls:", 20, 20, 10, GRAY);
|
||||||
|
DrawText("- Mouse Wheel to Zoom in-out", 40, 50, 10, DARKGRAY);
|
||||||
|
DrawText("- Mouse Wheel Pressed to Pan", 40, 70, 10, DARKGRAY);
|
||||||
|
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 90, 10, DARKGRAY);
|
||||||
|
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 110, 10, DARKGRAY);
|
||||||
|
DrawText("- Z to zoom to (0, 0, 0)", 40, 130, 10, DARKGRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/core_3d_camera_free.png
Normal file
After Width: | Height: | Size: 24 KiB |
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
*
|
*
|
||||||
* raylib [core] example - Picking in 3d mode
|
* raylib [core] example - Picking in 3d mode
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -23,23 +23,30 @@ int main()
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0, 0.0, 0.0 };
|
Vector3 cubePosition = { 0.0, 1.0, 0.0 };
|
||||||
|
|
||||||
Ray pickingLine;
|
Ray ray; // Picking line ray
|
||||||
|
|
||||||
SetCameraMode(CAMERA_FREE);
|
SetCameraMode(CAMERA_FREE); // Set a free camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
|
||||||
|
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
camera = UpdateCamera(0);
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
|
|
||||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pickingLine = GetMouseRay(GetMousePosition(), camera);
|
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON))
|
||||||
|
{
|
||||||
|
// NOTE: This function is NOT WORKING properly!
|
||||||
|
ray = GetMouseRay(GetMousePosition(), camera);
|
||||||
|
|
||||||
|
// TODO: Check collision between ray and box
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -50,15 +57,17 @@ int main()
|
||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2, 2, 2, RED);
|
DrawCube(cubePosition, 2, 2, 2, GRAY);
|
||||||
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
|
DrawCubeWires(cubePosition, 2, 2, 2, DARKGRAY);
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0);
|
DrawGrid(10.0, 1.0);
|
||||||
|
|
||||||
DrawRay(pickingLine, MAROON);
|
DrawRay(ray, MAROON);
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
DrawText("Try selecting the box with mouse!", 240, 10, 20, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
BIN
examples/core_3d_picking.png
Normal file
After Width: | Height: | Size: 23 KiB |
|
@ -15,7 +15,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [models] example - Draw 3d planes
|
* raylib [core] example - Windows drop files
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.2 (www.raylib.com)
|
* This example has been created using raylib 1.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||||
|
@ -18,12 +18,12 @@ int main()
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - 3d planes");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
int count = 0;
|
||||||
Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
char **droppedFiles;
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
@ -31,7 +31,10 @@ int main()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// TODO: Update your variables here
|
if (IsFileDropped())
|
||||||
|
{
|
||||||
|
droppedFiles = GetDroppedFiles(&count);
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -40,15 +43,21 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin3dMode(camera);
|
if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
|
||||||
|
|
||||||
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 4, 4 }, RED); // Draw a plane XZ
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
if (i%2 == 0) DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.5f));
|
||||||
|
else DrawRectangle(0, 85 + 40*i, screenWidth, 40, Fade(LIGHTGRAY, 0.3f));
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0);
|
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
End3dMode();
|
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
|
||||||
|
}
|
||||||
DrawFPS(10, 10);
|
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -56,7 +65,9 @@ int main()
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseWindow(); // Close window and OpenGL context
|
ClearDroppedFiles(); // Clear internal buffers
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
BIN
examples/core_drop_files.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
|
@ -8,7 +8,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* This test has been created using raylib 1.1 (www.raylib.com)
|
* This test has been created using raylib 1.1 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.1 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
*
|
*
|
||||||
* raylib [models] example - Drawing billboards
|
* raylib [models] example - Drawing billboards
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.2 (www.raylib.com)
|
* This example has been created using raylib 1.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -21,24 +21,24 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
Camera camera = {{ 5.0, 4.0, 5.0 }, { 0.0, 2.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||||
|
|
||||||
Texture2D lena = LoadTexture("resources/lena.png"); // Our texture for billboard
|
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
|
||||||
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
|
Vector3 billPosition = { 0.0, 2.0, 0.0 }; // Position where draw billboard
|
||||||
Vector3 billPosition = { 0.0, 0.0, 0.0 }; // Position where draw billboard
|
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
|
||||||
|
SetCameraTarget(camera.target); // Set internal camera target to match our camera target
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_LEFT)) camera.position.x -= 0.2;
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
if (IsKeyDown(KEY_RIGHT)) camera.position.x += 0.2;
|
|
||||||
if (IsKeyDown(KEY_UP)) camera.position.y -= 0.2;
|
|
||||||
if (IsKeyDown(KEY_DOWN)) camera.position.y += 0.2;
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -49,8 +49,7 @@ int main()
|
||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
//DrawBillboard(camera, lena, billPosition, 1.0, WHITE);
|
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
|
||||||
DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
|
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0); // Draw a grid
|
DrawGrid(10.0, 1.0); // Draw a grid
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ int main()
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(lena); // Unload texture
|
UnloadTexture(bill); // Unload texture
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
BIN
examples/models_billboard.png
Normal file
After Width: | Height: | Size: 53 KiB |
|
@ -2,10 +2,10 @@
|
||||||
*
|
*
|
||||||
* raylib [models] example - Cubicmap 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.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -21,29 +21,32 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing");
|
||||||
|
|
||||||
// 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 = {{ 16.0, 14.0, 16.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||||
|
|
||||||
Image image = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM)
|
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
||||||
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
||||||
Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image)
|
Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image)
|
||||||
SetModelTexture(&map, texture); // Bind texture to model
|
|
||||||
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
|
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||||
|
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||||
|
SetModelTexture(&map, texture); // Bind texture to map model
|
||||||
|
|
||||||
|
Vector3 mapPosition = { -16, 0.0, -8 }; // Set model position
|
||||||
|
|
||||||
UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
|
UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our custom camera position
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_UP)) camera.position.y += 0.2f;
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
else if (IsKeyDown(KEY_DOWN)) camera.position.y -= 0.2f;
|
|
||||||
|
|
||||||
if (IsKeyDown(KEY_RIGHT)) camera.position.z += 0.2f;
|
|
||||||
else if (IsKeyDown(KEY_LEFT)) camera.position.z -= 0.2f;
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -54,14 +57,16 @@ int main()
|
||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawModel(map, mapPosition, 1.0f, MAROON);
|
DrawModel(map, mapPosition, 1.0f, WHITE);
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0);
|
|
||||||
|
|
||||||
DrawGizmo(mapPosition);
|
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE);
|
||||||
|
DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
|
||||||
|
|
||||||
|
DrawText("cubicmap image used to", 658, 90, 10, GRAY);
|
||||||
|
DrawText("generate map 3d model", 658, 104, 10, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
@ -70,8 +75,9 @@ int main()
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(texture); // Unload texture
|
UnloadTexture(cubicmap); // Unload cubicmap texture
|
||||||
UnloadModel(map); // Unload model
|
UnloadTexture(texture); // Unload map texture
|
||||||
|
UnloadModel(map); // Unload map model
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 403 KiB |
|
@ -1,86 +0,0 @@
|
||||||
/*******************************************************************************************
|
|
||||||
*
|
|
||||||
* raylib [models] example - Load and draw a 3d model (OBJ)
|
|
||||||
*
|
|
||||||
* 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)
|
|
||||||
*
|
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
|
||||||
*
|
|
||||||
********************************************************************************************/
|
|
||||||
|
|
||||||
#include "raylib.h"
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
// Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
int screenWidth = 1280;
|
|
||||||
int screenHeight = 720;
|
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - custom shader");
|
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
|
||||||
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
|
||||||
|
|
||||||
Texture2D texture = LoadTexture("resources/catsham.png"); // Load model texture
|
|
||||||
Shader shader = LoadShader("resources/shaders/custom.vs", "resources/shaders/custom.fs");
|
|
||||||
//Shader poste = LoadShader("resources/shaders/custom.vs", "resources/shaders/pixel.fs");
|
|
||||||
|
|
||||||
Model cat = LoadModel("resources/cat.obj"); // Load OBJ model
|
|
||||||
|
|
||||||
SetModelTexture(&cat, texture); // Bind texture to model
|
|
||||||
//SetModelShader(&cat, poste);
|
|
||||||
|
|
||||||
Vector3 catPosition = { 0.0, 0.0, 0.0 }; // Set model position
|
|
||||||
|
|
||||||
SetPostproShader(shader);
|
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Main game loop
|
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
|
||||||
{
|
|
||||||
// Update
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
if (IsKeyDown(KEY_LEFT)) catPosition.x -= 0.2;
|
|
||||||
if (IsKeyDown(KEY_RIGHT)) catPosition.x += 0.2;
|
|
||||||
if (IsKeyDown(KEY_UP)) catPosition.z -= 0.2;
|
|
||||||
if (IsKeyDown(KEY_DOWN)) catPosition.z += 0.2;
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Draw
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
Begin3dMode(camera);
|
|
||||||
|
|
||||||
DrawModel(cat, catPosition, 0.1f, WHITE); // Draw 3d model with texture
|
|
||||||
|
|
||||||
DrawGrid(10.0, 1.0); // Draw a grid
|
|
||||||
|
|
||||||
DrawGizmo(catPosition); // Draw gizmo
|
|
||||||
|
|
||||||
End3dMode();
|
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
|
||||||
|
|
||||||
EndDrawing();
|
|
||||||
//----------------------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
|
|
||||||
// De-Initialization
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
UnloadTexture(texture); // Unload texture
|
|
||||||
UnloadModel(cat); // Unload model
|
|
||||||
UnloadShader(shader);
|
|
||||||
//UnloadShader(poste);
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
*
|
*
|
||||||
* raylib [models] example - Heightmap loading and drawing
|
* raylib [models] example - Heightmap loading and drawing
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -20,26 +20,29 @@ int main()
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define our custom 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 = {{ 24.0, 18.0, 24.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||||
|
|
||||||
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
||||||
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
||||||
Model map = LoadHeightmap(image, 4); // Load heightmap model
|
Model map = LoadHeightmap(image, 32); // 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 = { -16, 0.0, -16 }; // Set model position (depends on model scaling!)
|
||||||
|
|
||||||
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
|
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
|
||||||
|
SetCameraPosition(camera.position); // Set internal camera position to match our custom camera position
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// ...
|
UpdateCamera(&camera); // Update internal camera and our camera
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -50,14 +53,14 @@ int main()
|
||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawModel(map, mapPosition, 0.5f, MAROON);
|
// NOTE: Model is scaled to 1/4 of its original size (128x128 units)
|
||||||
|
DrawModel(map, mapPosition, 1/4.0f, RED);
|
||||||
DrawGrid(10.0, 1.0);
|
|
||||||
|
|
||||||
DrawGizmo(mapPosition);
|
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE);
|
||||||
|
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 121 KiB |
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* raylib [models] example - Load and draw a 3d model (OBJ)
|
* raylib [models] example - Load and draw a 3d model (OBJ)
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
|
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 125 KiB |
BIN
examples/resources/billboard.png
Normal file
After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 201 B |
BIN
examples/resources/cubicmap_atlas.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
examples/resources/guybrush.png
Normal file
After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 463 KiB |
BIN
examples/resources/smoke.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
examples/resources/texture_formats/sonic.png
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
examples/resources/texture_formats/sonic_A1R5G5B5.dds
Normal file
BIN
examples/resources/texture_formats/sonic_A4R4G4B4.dds
Normal file
BIN
examples/resources/texture_formats/sonic_A8R8G8B8.dds
Normal file
BIN
examples/resources/texture_formats/sonic_ASTC_4x4_ldr.astc
Normal file
BIN
examples/resources/texture_formats/sonic_ASTC_8x8_ldr.astc
Normal file
BIN
examples/resources/texture_formats/sonic_DXT1_RGB.dds
Normal file
BIN
examples/resources/texture_formats/sonic_DXT1_RGBA.dds
Normal file
BIN
examples/resources/texture_formats/sonic_DXT3_RGBA.dds
Normal file
BIN
examples/resources/texture_formats/sonic_DXT5_RGBA.dds
Normal file
BIN
examples/resources/texture_formats/sonic_ETC1_RGB.ktx
Normal file
BIN
examples/resources/texture_formats/sonic_ETC1_RGB.pkm
Normal file
BIN
examples/resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx
Normal file
BIN
examples/resources/texture_formats/sonic_ETC2_EAC_RGBA.old.pkm
Normal file
BIN
examples/resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm
Normal file
BIN
examples/resources/texture_formats/sonic_ETC2_RGB.ktx
Normal file
BIN
examples/resources/texture_formats/sonic_ETC2_RGB.pkm
Normal file
BIN
examples/resources/texture_formats/sonic_GRAYSCALE.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_L8A8.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_PVRT_RGB.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_PVRT_RGBA.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_PVRT_RGBA_2bpp.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_PVRT_RGB_2bpp.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_R4G4B4A4.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_R5G5B5A1.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_R5G6B5.dds
Normal file
BIN
examples/resources/texture_formats/sonic_R5G6B5.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_R8G8B8.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_R8G8B8A8.pvr
Normal file
BIN
examples/resources/texture_formats/sonic_R8G8B8A8.raw
Normal file
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.1 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
*
|
*
|
||||||
* raylib [text] example - Font selector
|
* raylib [text] example - Font selector
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ int main()
|
||||||
|
|
||||||
const char text[50] = "THIS is THE FONT you SELECTED!"; // Main text
|
const char text[50] = "THIS is THE FONT you SELECTED!"; // Main text
|
||||||
|
|
||||||
Vector2 textSize = MeasureTextEx(fonts[currentFont], text, GetFontBaseSize(fonts[currentFont])*3, 1);
|
Vector2 textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].size*3, 1);
|
||||||
|
|
||||||
Vector2 mousePoint;
|
Vector2 mousePoint;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ int main()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text measurement for better positioning on screen
|
// Text measurement for better positioning on screen
|
||||||
textSize = MeasureTextEx(fonts[currentFont], text, GetFontBaseSize(fonts[currentFont])*3, 1);
|
textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].size*3, 1);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -140,7 +140,7 @@ int main()
|
||||||
DrawText("NEXT", 700, positionY + 13, 20, btnNextOutColor);
|
DrawText("NEXT", 700, positionY + 13, 20, btnNextOutColor);
|
||||||
|
|
||||||
DrawTextEx(fonts[currentFont], text, (Vector2){ screenWidth/2 - textSize.x/2,
|
DrawTextEx(fonts[currentFont], text, (Vector2){ screenWidth/2 - textSize.x/2,
|
||||||
260 + (70 - textSize.y)/2 }, GetFontBaseSize(fonts[currentFont])*3,
|
260 + (70 - textSize.y)/2 }, fonts[currentFont].size*3,
|
||||||
1, colors[currentFont]);
|
1, colors[currentFont]);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 16 KiB |
|
@ -5,7 +5,7 @@
|
||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.1 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
* NOTE: raylib is distributed with some free to use fonts (even for commercial pourposes!)
|
* NOTE: raylib is distributed with some free to use fonts (even for commercial pourposes!)
|
||||||
* To view details and credits for those fonts, check raylib license file
|
* To view details and credits for those fonts, check raylib license file
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
* This example has been created using raylib 1.3 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ int main()
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], GetFontBaseSize(fonts[i])*2, spacings[i]).x/2;
|
positions[i].x = screenWidth/2 - MeasureTextEx(fonts[i], messages[i], fonts[i].size*2, spacings[i]).x/2;
|
||||||
positions[i].y = 60 + GetFontBaseSize(fonts[i]) + 50*i;
|
positions[i].y = 60 + fonts[i].size + 50*i;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color colors[8] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD };
|
Color colors[8] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD };
|
||||||
|
@ -76,7 +76,7 @@ int main()
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
DrawTextEx(fonts[i], messages[i], positions[i], GetFontBaseSize(fonts[i])*2, spacings[i], colors[i]);
|
DrawTextEx(fonts[i], messages[i], positions[i], fonts[i].size*2, spacings[i], colors[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 19 KiB |
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ int main()
|
||||||
|
|
||||||
Vector2 fontPosition1, fontPosition2, fontPosition3;
|
Vector2 fontPosition1, fontPosition2, fontPosition3;
|
||||||
|
|
||||||
fontPosition1.x = screenWidth/2 - MeasureTextEx(font1, msg1, GetFontBaseSize(font1), -3).x/2;
|
fontPosition1.x = screenWidth/2 - MeasureTextEx(font1, msg1, font1.size, -3).x/2;
|
||||||
fontPosition1.y = screenHeight/2 - GetFontBaseSize(font1)/2 - 80;
|
fontPosition1.y = screenHeight/2 - font1.size/2 - 80;
|
||||||
|
|
||||||
fontPosition2.x = screenWidth/2 - MeasureTextEx(font2, msg2, GetFontBaseSize(font2), -2).x/2;
|
fontPosition2.x = screenWidth/2 - MeasureTextEx(font2, msg2, font2.size, -2).x/2;
|
||||||
fontPosition2.y = screenHeight/2 - GetFontBaseSize(font2)/2 - 10;
|
fontPosition2.y = screenHeight/2 - font2.size/2 - 10;
|
||||||
|
|
||||||
fontPosition3.x = screenWidth/2 - MeasureTextEx(font3, msg3, GetFontBaseSize(font3), 2).x/2;
|
fontPosition3.x = screenWidth/2 - MeasureTextEx(font3, msg3, font3.size, 2).x/2;
|
||||||
fontPosition3.y = screenHeight/2 - GetFontBaseSize(font3)/2 + 50;
|
fontPosition3.y = screenHeight/2 - font3.size/2 + 50;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawTextEx(font1, msg1, fontPosition1, GetFontBaseSize(font1), -3, WHITE);
|
DrawTextEx(font1, msg1, fontPosition1, font1.size, -3, WHITE);
|
||||||
DrawTextEx(font2, msg2, fontPosition2, GetFontBaseSize(font2), -2, WHITE);
|
DrawTextEx(font2, msg2, fontPosition2, font2.size, -2, WHITE);
|
||||||
DrawTextEx(font3, msg3, fontPosition3, GetFontBaseSize(font3), 2, WHITE);
|
DrawTextEx(font3, msg3, fontPosition3, font3.size, 2, WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
244
examples/textures_formats_loading.c
Normal file
|
@ -0,0 +1,244 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [textures] example - texture formats loading (compressed and uncompressed)
|
||||||
|
*
|
||||||
|
* NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed textures,
|
||||||
|
* OpenGL 1.1 does not support compressed textures, only uncompressed ones.
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define NUM_TEXTURES 24
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PNG_R8G8B8A8 = 0,
|
||||||
|
PVR_GRAYSCALE,
|
||||||
|
PVR_GRAY_ALPHA,
|
||||||
|
PVR_R5G6B5,
|
||||||
|
PVR_R5G5B5A1,
|
||||||
|
PVR_R4G4B4A4,
|
||||||
|
DDS_R5G6B5,
|
||||||
|
DDS_R5G5B5A1,
|
||||||
|
DDS_R4G4B4A4,
|
||||||
|
DDS_R8G8B8A8,
|
||||||
|
DDS_DXT1_RGB,
|
||||||
|
DDS_DXT1_RGBA,
|
||||||
|
DDS_DXT3_RGBA,
|
||||||
|
DDS_DXT5_RGBA,
|
||||||
|
PKM_ETC1_RGB,
|
||||||
|
PKM_ETC2_RGB,
|
||||||
|
PKM_ETC2_EAC_RGBA,
|
||||||
|
KTX_ETC1_RGB,
|
||||||
|
KTX_ETC2_RGB,
|
||||||
|
KTX_ETC2_EAC_RGBA,
|
||||||
|
ASTC_4x4_LDR,
|
||||||
|
ASTC_8x8_LDR,
|
||||||
|
PVR_PVRT_RGB,
|
||||||
|
PVR_PVRT_RGBA
|
||||||
|
|
||||||
|
} TextureFormats;
|
||||||
|
|
||||||
|
static const char *formatText[] = {
|
||||||
|
"PNG_R8G8B8A8",
|
||||||
|
"PVR_GRAYSCALE",
|
||||||
|
"PVR_GRAY_ALPHA",
|
||||||
|
"PVR_R5G6B5",
|
||||||
|
"PVR_R5G5B5A1",
|
||||||
|
"PVR_R4G4B4A4",
|
||||||
|
"DDS_R5G6B5",
|
||||||
|
"DDS_R5G5B5A1",
|
||||||
|
"DDS_R4G4B4A4",
|
||||||
|
"DDS_R8G8B8A8",
|
||||||
|
"DDS_DXT1_RGB",
|
||||||
|
"DDS_DXT1_RGBA",
|
||||||
|
"DDS_DXT3_RGBA",
|
||||||
|
"DDS_DXT5_RGBA",
|
||||||
|
"PKM_ETC1_RGB",
|
||||||
|
"PKM_ETC2_RGB",
|
||||||
|
"PKM_ETC2_EAC_RGBA",
|
||||||
|
"KTX_ETC1_RGB",
|
||||||
|
"KTX_ETC2_RGB",
|
||||||
|
"KTX_ETC2_EAC_RGBA",
|
||||||
|
"ASTC_4x4_LDR",
|
||||||
|
"ASTC_8x8_LDR",
|
||||||
|
"PVR_PVRT_RGB",
|
||||||
|
"PVR_PVRT_RGBA"
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 480;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture formats loading");
|
||||||
|
|
||||||
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
|
||||||
|
Texture2D sonic[NUM_TEXTURES];
|
||||||
|
|
||||||
|
sonic[PNG_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic.png");
|
||||||
|
|
||||||
|
// Load UNCOMPRESSED PVR texture data
|
||||||
|
sonic[PVR_GRAYSCALE] = LoadTexture("resources/texture_formats/sonic_GRAYSCALE.pvr");
|
||||||
|
sonic[PVR_GRAY_ALPHA] = LoadTexture("resources/texture_formats/sonic_L8A8.pvr");
|
||||||
|
sonic[PVR_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.pvr");
|
||||||
|
sonic[PVR_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_R5G5B5A1.pvr");
|
||||||
|
sonic[PVR_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_R4G4B4A4.pvr");
|
||||||
|
|
||||||
|
// Load UNCOMPRESSED DDS texture data
|
||||||
|
sonic[DDS_R5G6B5] = LoadTexture("resources/texture_formats/sonic_R5G6B5.dds");
|
||||||
|
sonic[DDS_R5G5B5A1] = LoadTexture("resources/texture_formats/sonic_A1R5G5B5.dds");
|
||||||
|
sonic[DDS_R4G4B4A4] = LoadTexture("resources/texture_formats/sonic_A4R4G4B4.dds");
|
||||||
|
sonic[DDS_R8G8B8A8] = LoadTexture("resources/texture_formats/sonic_A8R8G8B8.dds");
|
||||||
|
|
||||||
|
// Load COMPRESSED DXT DDS texture data (if supported)
|
||||||
|
sonic[DDS_DXT1_RGB] = LoadTexture("resources/texture_formats/sonic_DXT1_RGB.dds");
|
||||||
|
sonic[DDS_DXT1_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT1_RGBA.dds");
|
||||||
|
sonic[DDS_DXT3_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT3_RGBA.dds");
|
||||||
|
sonic[DDS_DXT5_RGBA] = LoadTexture("resources/texture_formats/sonic_DXT5_RGBA.dds");
|
||||||
|
|
||||||
|
// Load COMPRESSED ETC texture data (if supported)
|
||||||
|
sonic[PKM_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.pkm");
|
||||||
|
sonic[PKM_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.pkm");
|
||||||
|
sonic[PKM_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.pkm");
|
||||||
|
|
||||||
|
sonic[KTX_ETC1_RGB] = LoadTexture("resources/texture_formats/sonic_ETC1_RGB.ktx");
|
||||||
|
sonic[KTX_ETC2_RGB] = LoadTexture("resources/texture_formats/sonic_ETC2_RGB.ktx");
|
||||||
|
sonic[KTX_ETC2_EAC_RGBA] = LoadTexture("resources/texture_formats/sonic_ETC2_EAC_RGBA.ktx");
|
||||||
|
|
||||||
|
// Load COMPRESSED ASTC texture data (if supported)
|
||||||
|
sonic[ASTC_4x4_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_4x4_ldr.astc");
|
||||||
|
sonic[ASTC_8x8_LDR] = LoadTexture("resources/texture_formats/sonic_ASTC_8x8_ldr.astc");
|
||||||
|
|
||||||
|
// Load COMPRESSED PVR texture data (if supported)
|
||||||
|
sonic[PVR_PVRT_RGB] = LoadTexture("resources/texture_formats/sonic_PVRT_RGB.pvr");
|
||||||
|
sonic[PVR_PVRT_RGBA] = LoadTexture("resources/texture_formats/sonic_PVRT_RGBA.pvr");
|
||||||
|
|
||||||
|
int selectedFormat = PNG_R8G8B8A8;
|
||||||
|
|
||||||
|
Rectangle selectRecs[NUM_TEXTURES];
|
||||||
|
|
||||||
|
for (int i = 0; i < NUM_TEXTURES; i++)
|
||||||
|
{
|
||||||
|
if (i < NUM_TEXTURES/2) selectRecs[i] = (Rectangle){ 40, 45 + 32*i, 150, 30 };
|
||||||
|
else selectRecs[i] = (Rectangle){ 40 + 152, 45 + 32*(i - NUM_TEXTURES/2), 150, 30 };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Texture sizes in KB
|
||||||
|
float textureSizes[NUM_TEXTURES] = {
|
||||||
|
512*512*32/8/1024, //PNG_R8G8B8A8 (32 bpp)
|
||||||
|
512*512*8/8/1024, //PVR_GRAYSCALE (8 bpp)
|
||||||
|
512*512*16/8/1024, //PVR_GRAY_ALPHA (16 bpp)
|
||||||
|
512*512*16/8/1024, //PVR_R5G6B5 (16 bpp)
|
||||||
|
512*512*16/8/1024, //PVR_R5G5B5A1 (16 bpp)
|
||||||
|
512*512*16/8/1024, //PVR_R4G4B4A4 (16 bpp)
|
||||||
|
512*512*16/8/1024, //DDS_R5G6B5 (16 bpp)
|
||||||
|
512*512*16/8/1024, //DDS_R5G5B5A1 (16 bpp)
|
||||||
|
512*512*16/8/1024, //DDS_R4G4B4A4 (16 bpp)
|
||||||
|
512*512*32/8/1024, //DDS_R8G8B8A8 (32 bpp)
|
||||||
|
512*512*4/8/1024, //DDS_DXT1_RGB (4 bpp) -Compressed-
|
||||||
|
512*512*4/8/1024, //DDS_DXT1_RGBA (4 bpp) -Compressed-
|
||||||
|
512*512*8/8/1024, //DDS_DXT3_RGBA (8 bpp) -Compressed-
|
||||||
|
512*512*8/8/1024, //DDS_DXT5_RGBA (8 bpp) -Compressed-
|
||||||
|
512*512*4/8/1024, //PKM_ETC1_RGB (4 bpp) -Compressed-
|
||||||
|
512*512*4/8/1024, //PKM_ETC2_RGB (4 bpp) -Compressed-
|
||||||
|
512*512*8/8/1024, //PKM_ETC2_EAC_RGBA (8 bpp) -Compressed-
|
||||||
|
512*512*4/8/1024, //KTX_ETC1_RGB (4 bpp) -Compressed-
|
||||||
|
512*512*4/8/1024, //KTX_ETC2_RGB (4 bpp) -Compressed-
|
||||||
|
512*512*8/8/1024, //KTX_ETC2_EAC_RGBA (8 bpp) -Compressed-
|
||||||
|
512*512*8/8/1024, //ASTC_4x4_LDR (8 bpp) -Compressed-
|
||||||
|
512*512*2/8/1024, //ASTC_8x8_LDR (2 bpp) -Compressed-
|
||||||
|
512*512*4/8/1024, //PVR_PVRT_RGB (4 bpp) -Compressed-
|
||||||
|
512*512*4/8/1024, //PVR_PVRT_RGBA (4 bpp) -Compressed-
|
||||||
|
};
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
if (IsKeyPressed(KEY_DOWN))
|
||||||
|
{
|
||||||
|
selectedFormat++;
|
||||||
|
if (selectedFormat >= NUM_TEXTURES) selectedFormat = 0;
|
||||||
|
}
|
||||||
|
else if (IsKeyPressed(KEY_UP))
|
||||||
|
{
|
||||||
|
selectedFormat--;
|
||||||
|
if (selectedFormat < 0) selectedFormat = NUM_TEXTURES - 1;
|
||||||
|
}
|
||||||
|
else if (IsKeyPressed(KEY_RIGHT))
|
||||||
|
{
|
||||||
|
if (selectedFormat < NUM_TEXTURES/2) selectedFormat += NUM_TEXTURES/2;
|
||||||
|
}
|
||||||
|
else if (IsKeyPressed(KEY_LEFT))
|
||||||
|
{
|
||||||
|
if (selectedFormat >= NUM_TEXTURES/2) selectedFormat -= NUM_TEXTURES/2;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Draw rectangles
|
||||||
|
for (int i = 0; i < NUM_TEXTURES; i++)
|
||||||
|
{
|
||||||
|
if (i == selectedFormat)
|
||||||
|
{
|
||||||
|
DrawRectangleRec(selectRecs[i], SKYBLUE);
|
||||||
|
DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE);
|
||||||
|
DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)/2, selectRecs[i].y + 11, 10, DARKBLUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawRectangleRec(selectRecs[i], LIGHTGRAY);
|
||||||
|
DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, GRAY);
|
||||||
|
DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)/2, selectRecs[i].y + 11, 10, DARKGRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw selected texture
|
||||||
|
if (sonic[selectedFormat].id != 0)
|
||||||
|
{
|
||||||
|
DrawTexture(sonic[selectedFormat], 350, 0, WHITE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawRectangleLines(488, 165, 200, 110, DARKGRAY);
|
||||||
|
DrawText("FORMAT", 550, 180, 20, MAROON);
|
||||||
|
DrawText("NOT SUPPORTED", 500, 210, 20, MAROON);
|
||||||
|
DrawText("ON YOUR GPU", 520, 240, 20, MAROON);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText("Select texture format (use cursor keys):", 40, 26, 10, DARKGRAY);
|
||||||
|
DrawText("Required GPU memory size (VRAM):", 40, 442, 10, DARKGRAY);
|
||||||
|
DrawText(FormatText("%4.0f KB", textureSizes[selectedFormat]), 240, 435, 20, DARKBLUE);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(sonic[i]);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/textures_formats_loading.png
Normal file
After Width: | Height: | Size: 77 KiB |
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
|
132
examples/textures_particles_trail_blending.c
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib example - particles trail blending
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_PARTICLES 200
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Vector2 position;
|
||||||
|
Color color;
|
||||||
|
float alpha;
|
||||||
|
float size;
|
||||||
|
float rotation;
|
||||||
|
bool active; // NOTE: Use it to activate/deactive particle
|
||||||
|
} Particle;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - particles trail blending");
|
||||||
|
|
||||||
|
// Particles pool, reuse them!
|
||||||
|
Particle mouseTail[MAX_PARTICLES];
|
||||||
|
|
||||||
|
// Initialize particles
|
||||||
|
for (int i = 0; i < MAX_PARTICLES; i++)
|
||||||
|
{
|
||||||
|
mouseTail[i].position = (Vector2){ 0, 0 };
|
||||||
|
mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
|
||||||
|
mouseTail[i].alpha = 1.0f;
|
||||||
|
mouseTail[i].size = (float)GetRandomValue(1, 30)/20;
|
||||||
|
mouseTail[i].rotation = GetRandomValue(0, 360);
|
||||||
|
mouseTail[i].active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
float gravity = 3;
|
||||||
|
|
||||||
|
Texture2D smoke = LoadTexture("resources/smoke.png");
|
||||||
|
|
||||||
|
int blending = BLEND_ALPHA;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Activate one particle every frame and Update active particles
|
||||||
|
// NOTE: Particles initial position should be mouse position when activated
|
||||||
|
// NOTE: Particles fall down with gravity and rotation... and disappear after 2 seconds (alpha = 0)
|
||||||
|
// NOTE: When a particle disappears, active = false and it can be reused.
|
||||||
|
for (int i = 0; i < MAX_PARTICLES; i++)
|
||||||
|
{
|
||||||
|
if (!mouseTail[i].active)
|
||||||
|
{
|
||||||
|
mouseTail[i].active = true;
|
||||||
|
mouseTail[i].alpha = 1.0f;
|
||||||
|
mouseTail[i].position = GetMousePosition();
|
||||||
|
i = MAX_PARTICLES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_PARTICLES; i++)
|
||||||
|
{
|
||||||
|
if (mouseTail[i].active)
|
||||||
|
{
|
||||||
|
mouseTail[i].position.y += gravity;
|
||||||
|
mouseTail[i].alpha -= 0.01f;
|
||||||
|
|
||||||
|
if (mouseTail[i].alpha <= 0.0f) mouseTail[i].active = false;
|
||||||
|
|
||||||
|
mouseTail[i].rotation += 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
if (blending == BLEND_ALPHA) blending = BLEND_ADDITIVE;
|
||||||
|
else blending = BLEND_ALPHA;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(DARKGRAY);
|
||||||
|
|
||||||
|
SetBlendMode(blending);
|
||||||
|
|
||||||
|
// Draw active particles
|
||||||
|
for (int i = 0; i < MAX_PARTICLES; i++)
|
||||||
|
{
|
||||||
|
if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0, 0, smoke.width, smoke.height },
|
||||||
|
(Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
|
||||||
|
(Vector2){ smoke.width*mouseTail[i].size/2, smoke.height*mouseTail[i].size/2 }, mouseTail[i].rotation,
|
||||||
|
Fade(mouseTail[i].color, mouseTail[i].alpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText("PRESS SPACE to CHANGE BLENDING MODE", 180, 20, 20, RAYWHITE);
|
||||||
|
|
||||||
|
if (blending == BLEND_ALPHA) DrawText("ALPHA BLENDING", 290, screenHeight - 40, 20, RAYWHITE);
|
||||||
|
else DrawText("ADDITIVE BLENDING", 280, screenHeight - 40, 20, RAYWHITE);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(smoke);
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/textures_particles_trail_blending.png
Normal file
After Width: | Height: | Size: 350 KiB |
90
examples/textures_raw_data.c
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [textures] example - Load textures from raw data
|
||||||
|
*
|
||||||
|
* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.3 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#include <stdlib.h> // Required for malloc() and free()
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture from raw data");
|
||||||
|
|
||||||
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
|
||||||
|
// Load RAW image data (512x512, 32bit RGBA, no file header)
|
||||||
|
Image sonicRaw = LoadImageRaw("resources/texture_formats/sonic_R8G8B8A8.raw", 512, 512, UNCOMPRESSED_R8G8B8A8, 0);
|
||||||
|
Texture2D sonic = LoadTextureFromImage(sonicRaw); // Upload CPU (RAM) image to GPU (VRAM)
|
||||||
|
UnloadImage(sonicRaw); // Unload CPU (RAM) image data
|
||||||
|
|
||||||
|
// Generate a checked texture by code (1024x1024 pixels)
|
||||||
|
int width = 1024;
|
||||||
|
int height = 1024;
|
||||||
|
|
||||||
|
Color *pixels = (Color *)malloc(width*height*sizeof(Color));
|
||||||
|
|
||||||
|
for (int y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
if (((x/32+y/32)/1)%2 == 0) pixels[y*height + x] = DARKBLUE;
|
||||||
|
else pixels[y*height + x] = SKYBLUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load pixels data into an image structure and create texture
|
||||||
|
Image checkedIm = LoadImageEx(pixels, width, height);
|
||||||
|
Texture2D checked = LoadTextureFromImage(checkedIm);
|
||||||
|
UnloadImage(checkedIm); // Unload CPU (RAM) image data
|
||||||
|
free(pixels); // Unload CPU (RAM) pixels data
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update your variables here
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(WHITE, 0.3f));
|
||||||
|
DrawTexture(sonic, 330, -20, WHITE);
|
||||||
|
|
||||||
|
DrawText("CHECKED TEXTURE ", 84, 100, 30, DARKBLUE);
|
||||||
|
DrawText("GENERATED by CODE", 72, 164, 30, DARKBLUE);
|
||||||
|
DrawText("and RAW IMAGE LOADING", 46, 226, 30, DARKBLUE);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(sonic); // Texture unloading
|
||||||
|
UnloadTexture(checked); // Texture unloading
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/textures_raw_data.png
Normal file
After Width: | Height: | Size: 85 KiB |
|
@ -5,7 +5,7 @@
|
||||||
* 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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -20,15 +20,12 @@ int main()
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");
|
InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");
|
||||||
|
|
||||||
const char textLine1[] = "Lena image is a standard test image which has been in use since 1973.";
|
|
||||||
const char textLine2[] = "It comprises 512x512 pixels, and it is probably the most widely used";
|
|
||||||
const char textLine3[] = "test image for all sorts of image processing algorithms.";
|
|
||||||
|
|
||||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
Texture2D texture = LoadTexture("resources/lena.png"); // Texture loading
|
Texture2D guybrush = LoadTexture("resources/guybrush.png"); // Texture loading
|
||||||
|
|
||||||
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
|
Vector2 position = { 350, 240 };
|
||||||
Vector2 position = { 369, 241 };
|
Rectangle frameRec = { 0, 0, guybrush.width/7, guybrush.height };
|
||||||
|
int currentFrame = 0;
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
@ -36,7 +33,14 @@ int main()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// TODO: Update your variables here
|
if (IsKeyPressed(KEY_RIGHT))
|
||||||
|
{
|
||||||
|
currentFrame++;
|
||||||
|
|
||||||
|
if (currentFrame > 6) currentFrame = 0;
|
||||||
|
|
||||||
|
frameRec.x = currentFrame*guybrush.width/7;
|
||||||
|
}
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -45,15 +49,19 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
DrawText("LENA", 220, 100, 20, PINK);
|
DrawTexture(guybrush, 35, 40, WHITE);
|
||||||
|
DrawRectangleLines(35, 40, guybrush.width, guybrush.height, LIME);
|
||||||
|
|
||||||
DrawTexture(texture, screenWidth/2 - 256, 0, Fade(WHITE, 0.1f)); // Draw background image
|
DrawTextureRec(guybrush, frameRec, position, WHITE); // Draw part of the texture
|
||||||
|
|
||||||
DrawTextureRec(texture, eyesRec, position, WHITE); // Draw eyes part of image
|
DrawRectangleLines(35 + frameRec.x, 40 + frameRec.y, frameRec.width, frameRec.height, RED);
|
||||||
|
|
||||||
DrawText(textLine1, 220, 140, 10, DARKGRAY);
|
DrawText("PRESS RIGHT KEY to", 540, 310, 10, GRAY);
|
||||||
DrawText(textLine2, 220, 160, 10, DARKGRAY);
|
DrawText("CHANGE DRAWING RECTANGLE", 520, 330, 10, GRAY);
|
||||||
DrawText(textLine3, 220, 180, 10, DARKGRAY);
|
|
||||||
|
DrawText("Guybrush Ulysses Threepwood,", 100, 300, 10, GRAY);
|
||||||
|
DrawText("main character of the Monkey Island series", 80, 320, 10, GRAY);
|
||||||
|
DrawText("of computer adventure games by LucasArts.", 80, 340, 10, GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -61,7 +69,7 @@ int main()
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(texture); // Texture unloading
|
UnloadTexture(guybrush); // Texture unloading
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 107 KiB |
|
@ -5,7 +5,7 @@
|
||||||
* This example has been created using raylib 1.1 (www.raylib.com)
|
* This example has been created using raylib 1.1 (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)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
|
@ -21,16 +21,23 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles");
|
InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles");
|
||||||
|
|
||||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading
|
Texture2D guybrush = LoadTexture("resources/guybrush.png"); // Texture loading
|
||||||
|
|
||||||
|
int frameWidth = guybrush.width/7;
|
||||||
|
int frameHeight = guybrush.height;
|
||||||
|
|
||||||
// NOTE: Source rectangle (part of the texture to use for drawing)
|
// NOTE: Source rectangle (part of the texture to use for drawing)
|
||||||
Rectangle sourceRec = { 128, 128, 128, 128 };
|
Rectangle sourceRec = { 0, 0, frameWidth, frameHeight };
|
||||||
|
|
||||||
// NOTE: Destination rectangle (screen rectangle where drawing part of texture)
|
// NOTE: Destination rectangle (screen rectangle where drawing part of texture)
|
||||||
Rectangle destRec = { screenWidth/2, screenHeight/2, 256, 256 };
|
Rectangle destRec = { screenWidth/2, screenHeight/2, frameWidth*2, frameHeight*2 };
|
||||||
|
|
||||||
// NOTE: Origin of the texture in case of rotation, it's relative to destination rectangle size
|
// NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size
|
||||||
Vector2 origin = { 128, 128 };
|
Vector2 origin = { frameWidth, frameHeight };
|
||||||
|
|
||||||
|
int rotation = 0;
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
@ -38,7 +45,7 @@ int main()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// TODO: Update your variables here
|
rotation++;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -48,10 +55,10 @@ int main()
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
// NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
|
// NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
|
||||||
DrawTexturePro(texture, sourceRec, destRec, origin, 45, LIGHTGRAY);
|
DrawTexturePro(guybrush, sourceRec, destRec, origin, rotation, WHITE);
|
||||||
|
|
||||||
DrawLine(destRec.x, 0, destRec.x, screenHeight, RED);
|
DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY);
|
||||||
DrawLine(0, destRec.y, screenWidth, destRec.y, RED);
|
DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -59,7 +66,7 @@ int main()
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadTexture(texture); // Texture unloading
|
UnloadTexture(guybrush); // Texture unloading
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 47 KiB |
68
examples/textures_to_image.c
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [textures] example - Retrieve image data from texture: GetTextureData()
|
||||||
|
*
|
||||||
|
* NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM)
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 1.1 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture to image");
|
||||||
|
|
||||||
|
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||||
|
|
||||||
|
Image image = LoadImage("resources/raylib_logo.png"); // Load image data into CPU memory (RAM)
|
||||||
|
Texture2D texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (RAM -> VRAM)
|
||||||
|
UnloadImage(image); // Unload image data from CPU memory (RAM)
|
||||||
|
|
||||||
|
image = GetTextureData(texture); // Retrieve image data from GPU memory (VRAM -> RAM)
|
||||||
|
UnloadTexture(texture); // Unload texture from GPU memory (VRAM)
|
||||||
|
|
||||||
|
texture = LoadTextureFromImage(image); // Recreate texture from retrieved image data (RAM -> VRAM)
|
||||||
|
UnloadImage(image); // Unload retrieved image data from CPU memory (RAM)
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// TODO: Update your variables here
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);
|
||||||
|
|
||||||
|
DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadTexture(texture); // Texture unloading
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
examples/textures_to_image.png
Normal file
After Width: | Height: | Size: 17 KiB |
115
src/camera.c
|
@ -84,12 +84,12 @@ typedef enum { MOVE_FRONT = 0, MOVE_LEFT, MOVE_BACK, MOVE_RIGHT, MOVE_UP, MOVE_D
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
static Camera internalCamera = {{2,0,2},{0,0,0},{0,1,0}};
|
static Camera internalCamera = {{2, 0, 2}, {0, 0, 0}, {0, 1, 0}};
|
||||||
static Vector2 cameraAngle = { 0, 0 };
|
static Vector2 cameraAngle = { 0, 0 };
|
||||||
static float cameraTargetDistance = 5;
|
static float cameraTargetDistance = 5.0f;
|
||||||
static Vector2 cameraMousePosition = { 0, 0 };
|
static Vector2 cameraMousePosition = { 0, 0 };
|
||||||
static Vector2 cameraMouseVariation = { 0, 0 };
|
static Vector2 cameraMouseVariation = { 0, 0 };
|
||||||
static float mouseSensitivity = 0.003;
|
static float mouseSensitivity = 0.003f;
|
||||||
static int cameraMoveControl[6] = { 'W', 'A', 'S', 'D', 'E', 'Q' };
|
static int cameraMoveControl[6] = { 'W', 'A', 'S', 'D', 'E', 'Q' };
|
||||||
static int cameraMoveCounter = 0;
|
static int cameraMoveCounter = 0;
|
||||||
static int cameraUseGravity = 1;
|
static int cameraUseGravity = 1;
|
||||||
|
@ -123,6 +123,7 @@ static int IsKeyDown(int key) { return 0; }
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Select camera mode (multiple camera modes available)
|
// Select camera mode (multiple camera modes available)
|
||||||
|
// TODO: Review hardcoded values when changing modes...
|
||||||
void SetCameraMode(int mode)
|
void SetCameraMode(int mode)
|
||||||
{
|
{
|
||||||
if ((cameraMode == CAMERA_FIRST_PERSON) && (mode == CAMERA_FREE))
|
if ((cameraMode == CAMERA_FIRST_PERSON) && (mode == CAMERA_FREE))
|
||||||
|
@ -144,7 +145,7 @@ void SetCameraMode(int mode)
|
||||||
cameraTargetDistance = 10;
|
cameraTargetDistance = 10;
|
||||||
cameraAngle.x = 45 * DEG2RAD;
|
cameraAngle.x = 45 * DEG2RAD;
|
||||||
cameraAngle.y = -40 * DEG2RAD;
|
cameraAngle.y = -40 * DEG2RAD;
|
||||||
internalCamera.target = (Vector3){ 0, 0, 0};
|
internalCamera.target = (Vector3){ 0, 0, 0 };
|
||||||
ProcessCamera(&internalCamera, &internalCamera.position);
|
ProcessCamera(&internalCamera, &internalCamera.position);
|
||||||
|
|
||||||
ShowCursor();
|
ShowCursor();
|
||||||
|
@ -154,22 +155,82 @@ void SetCameraMode(int mode)
|
||||||
cameraTargetDistance = 10;
|
cameraTargetDistance = 10;
|
||||||
cameraAngle.x = 225 * DEG2RAD;
|
cameraAngle.x = 225 * DEG2RAD;
|
||||||
cameraAngle.y = -40 * DEG2RAD;
|
cameraAngle.y = -40 * DEG2RAD;
|
||||||
internalCamera.target = (Vector3){ 3, 0, 3};
|
internalCamera.target = (Vector3){ 0, 0, 0};
|
||||||
ProcessCamera(&internalCamera, &internalCamera.position);
|
ProcessCamera(&internalCamera, &internalCamera.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraMode = mode;
|
cameraMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update camera with position
|
// Update camera (player position is ignored)
|
||||||
Camera UpdateCamera(Vector3 *position)
|
void UpdateCamera(Camera *camera)
|
||||||
{
|
{
|
||||||
// Calculate camera
|
Vector3 position = { 0, 0, 0 };
|
||||||
if (cameraMode != CAMERA_CUSTOM) ProcessCamera(&internalCamera, position);
|
|
||||||
|
|
||||||
return internalCamera;
|
// Process internal camera and player position (if required)
|
||||||
|
if (cameraMode != CAMERA_CUSTOM) ProcessCamera(&internalCamera, &position);
|
||||||
|
|
||||||
|
*camera = internalCamera;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update camera and player position (1st person and 3rd person cameras)
|
||||||
|
void UpdateCameraPlayer(Camera *camera, Vector3 *position)
|
||||||
|
{
|
||||||
|
// Process internal camera and player position (if required)
|
||||||
|
if (cameraMode != CAMERA_CUSTOM) ProcessCamera(&internalCamera, position);
|
||||||
|
|
||||||
|
*camera = internalCamera;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set internal camera position
|
||||||
|
void SetCameraPosition(Vector3 position)
|
||||||
|
{
|
||||||
|
internalCamera.position = position;
|
||||||
|
|
||||||
|
Vector3 v1 = internalCamera.position;
|
||||||
|
Vector3 v2 = internalCamera.target;
|
||||||
|
|
||||||
|
float dx = v2.x - v1.x;
|
||||||
|
float dy = v2.y - v1.y;
|
||||||
|
float dz = v2.z - v1.z;
|
||||||
|
|
||||||
|
cameraTargetDistance = sqrt(dx*dx + dy*dy + dz*dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set internal camera target
|
||||||
|
void SetCameraTarget(Vector3 target)
|
||||||
|
{
|
||||||
|
internalCamera.target = target;
|
||||||
|
|
||||||
|
Vector3 v1 = internalCamera.position;
|
||||||
|
Vector3 v2 = internalCamera.target;
|
||||||
|
|
||||||
|
float dx = v2.x - v1.x;
|
||||||
|
float dy = v2.y - v1.y;
|
||||||
|
float dz = v2.z - v1.z;
|
||||||
|
|
||||||
|
cameraTargetDistance = sqrt(dx*dx + dy*dy + dz*dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set camera pan key to combine with mouse movement (free camera)
|
||||||
|
void SetCameraPanControl(int panKey)
|
||||||
|
{
|
||||||
|
panControlKey = panKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set camera alt key to combine with mouse movement (free camera)
|
||||||
|
void SetCameraAltControl(int altKey)
|
||||||
|
{
|
||||||
|
altControlKey = altKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set camera smooth zoom key to combine with mouse (free camera)
|
||||||
|
void SetCameraSmoothZoomControl(int szKey)
|
||||||
|
{
|
||||||
|
smoothZoomControlKey = szKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set camera move controls (1st person and 3rd person cameras)
|
||||||
void SetCameraMoveControls(int frontKey, int backKey, int leftKey, int rightKey, int upKey, int downKey)
|
void SetCameraMoveControls(int frontKey, int backKey, int leftKey, int rightKey, int upKey, int downKey)
|
||||||
{
|
{
|
||||||
cameraMoveControl[MOVE_FRONT] = frontKey;
|
cameraMoveControl[MOVE_FRONT] = frontKey;
|
||||||
|
@ -180,32 +241,12 @@ void SetCameraMoveControls(int frontKey, int backKey, int leftKey, int rightKey,
|
||||||
cameraMoveControl[MOVE_DOWN] = downKey;
|
cameraMoveControl[MOVE_DOWN] = downKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set camera mouse sensitivity (1st person and 3rd person cameras)
|
||||||
void SetCameraMouseSensitivity(float sensitivity)
|
void SetCameraMouseSensitivity(float sensitivity)
|
||||||
{
|
{
|
||||||
mouseSensitivity = (sensitivity / 10000.0);
|
mouseSensitivity = (sensitivity/10000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCameraPanControl(int panKey)
|
|
||||||
{
|
|
||||||
panControlKey = panKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetCameraAltControl(int altKey)
|
|
||||||
{
|
|
||||||
altControlKey = altKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetCameraSmoothZoomControl(int szKey)
|
|
||||||
{
|
|
||||||
smoothZoomControlKey = szKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetCameraTarget(Vector3 target)
|
|
||||||
{
|
|
||||||
internalCamera.target = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Definition
|
// Module specific Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -247,7 +288,9 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition)
|
||||||
cameraMouseVariation.y = mousePosition.y - cameraMousePosition.y;
|
cameraMouseVariation.y = mousePosition.y - cameraMousePosition.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraMousePosition = mousePosition;
|
// NOTE: We GetMousePosition() again because it can be modified by a previous SetMousePosition() call
|
||||||
|
// If using directly mousePosition variable we have problems on CAMERA_FIRST_PERSON and CAMERA_THIRD_PERSON
|
||||||
|
cameraMousePosition = GetMousePosition();
|
||||||
|
|
||||||
// Support for multiple automatic camera modes
|
// Support for multiple automatic camera modes
|
||||||
switch (cameraMode)
|
switch (cameraMode)
|
||||||
|
@ -298,7 +341,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition)
|
||||||
}
|
}
|
||||||
else if ((camera->position.y < camera->target.y) && (camera->target.y > 0) && (mouseWheelMove > 0))
|
else if ((camera->position.y < camera->target.y) && (camera->target.y > 0) && (mouseWheelMove > 0))
|
||||||
{
|
{
|
||||||
cameraTargetDistance -= (mouseWheelMove * CAMERA_SCROLL_SENSITIVITY);
|
cameraTargetDistance -= (mouseWheelMove*CAMERA_SCROLL_SENSITIVITY);
|
||||||
if (cameraTargetDistance < FREE_CAMERA_DISTANCE_MIN_CLAMP) cameraTargetDistance = FREE_CAMERA_DISTANCE_MIN_CLAMP;
|
if (cameraTargetDistance < FREE_CAMERA_DISTANCE_MIN_CLAMP) cameraTargetDistance = FREE_CAMERA_DISTANCE_MIN_CLAMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,8 +492,8 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition)
|
||||||
if (isMoving) cameraMoveCounter++;
|
if (isMoving) cameraMoveCounter++;
|
||||||
|
|
||||||
// Camera orientation calculation
|
// Camera orientation calculation
|
||||||
cameraAngle.x += cameraMouseVariation.x*-mouseSensitivity;
|
cameraAngle.x += (cameraMouseVariation.x * -mouseSensitivity);
|
||||||
cameraAngle.y += cameraMouseVariation.y*-mouseSensitivity;
|
cameraAngle.y += (cameraMouseVariation.y * -mouseSensitivity);
|
||||||
|
|
||||||
// Angle clamp
|
// Angle clamp
|
||||||
if (cameraAngle.y > FIRST_PERSON_MIN_CLAMP*DEG2RAD) cameraAngle.y = FIRST_PERSON_MIN_CLAMP*DEG2RAD;
|
if (cameraAngle.y > FIRST_PERSON_MIN_CLAMP*DEG2RAD) cameraAngle.y = FIRST_PERSON_MIN_CLAMP*DEG2RAD;
|
||||||
|
|
12
src/camera.h
|
@ -76,18 +76,20 @@ extern "C" { // Prevents name mangling of functions
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
|
void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
|
||||||
Camera UpdateCamera(Vector3 *playerPosition); // Update camera and player position (1st person and 3rd person cameras)
|
void UpdateCamera(Camera *camera); // Update camera (player position is ignored)
|
||||||
|
void UpdateCameraPlayer(Camera *camera, Vector3 *position); // Update camera and player position (1st person and 3rd person cameras)
|
||||||
|
|
||||||
void SetCameraMoveControls(int frontKey, int backKey,
|
void SetCameraPosition(Vector3 position); // Set internal camera position
|
||||||
int leftKey, int rightKey,
|
void SetCameraTarget(Vector3 target); // Set internal camera target
|
||||||
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
|
|
||||||
|
|
||||||
void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
||||||
void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
|
void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
|
||||||
void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
|
void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
|
||||||
|
|
||||||
|
void SetCameraMoveControls(int frontKey, int backKey,
|
||||||
|
int leftKey, int rightKey,
|
||||||
|
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
|
||||||
void SetCameraMouseSensitivity(float sensitivity); // Set camera mouse sensitivity (1st person and 3rd person cameras)
|
void SetCameraMouseSensitivity(float sensitivity); // Set camera mouse sensitivity (1st person and 3rd person cameras)
|
||||||
void SetCameraTarget(Vector3 target); // Set internal camera target
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,6 +638,7 @@ void ShowLogo(void)
|
||||||
showLogo = true;
|
showLogo = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
// Check if a file have been dropped into window
|
// Check if a file have been dropped into window
|
||||||
bool IsFileDropped(void)
|
bool IsFileDropped(void)
|
||||||
{
|
{
|
||||||
|
@ -664,6 +665,7 @@ void ClearDroppedFiles(void)
|
||||||
dropFilesCount = 0;
|
dropFilesCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: Gives the ray trace from mouse position
|
// TODO: Gives the ray trace from mouse position
|
||||||
Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
Ray GetMouseRay(Vector2 mousePosition, Camera camera)
|
||||||
|
@ -1007,8 +1009,8 @@ static void InitDisplay(int width, int height)
|
||||||
|
|
||||||
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); // Avoid window being resizable
|
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); // Avoid window being resizable
|
||||||
//glfwWindowHint(GLFW_DECORATED, GL_TRUE); // Border and buttons on Window
|
//glfwWindowHint(GLFW_DECORATED, GL_TRUE); // Border and buttons on Window
|
||||||
//glfwWindowHint(GLFW_RED_BITS, 8); // Color framebuffer red component bits
|
//glfwWindowHint(GLFW_RED_BITS, 8); // Framebuffer red color component bits
|
||||||
//glfwWindowHint(GLFW_DEPTH_BITS, 16); // Depth buffer bits (24 by default)
|
//glfwWindowHint(GLFW_DEPTH_BITS, 16); // Depthbuffer bits (24 by default)
|
||||||
//glfwWindowHint(GLFW_REFRESH_RATE, 0); // Refresh rate for fullscreen window
|
//glfwWindowHint(GLFW_REFRESH_RATE, 0); // Refresh rate for fullscreen window
|
||||||
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // Default OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
|
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API); // Default OpenGL API to use. Alternative: GLFW_OPENGL_ES_API
|
||||||
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
//glfwWindowHint(GLFW_AUX_BUFFERS, 0); // Number of auxiliar buffers
|
||||||
|
|
1002
src/raygui.c
Normal file
271
src/raygui.h
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raygui - raylib IMGUI system (Immedite Mode GUI)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Kevin Gato, Daniel Nicolás, Sergio Martinez and Ramon Santamaria
|
||||||
|
*
|
||||||
|
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
|
* will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
*
|
||||||
|
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||||
|
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||||
|
*
|
||||||
|
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||||
|
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||||
|
* in the product documentation would be appreciated but is not required.
|
||||||
|
*
|
||||||
|
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||||
|
* as being the original software.
|
||||||
|
*
|
||||||
|
* 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
*
|
||||||
|
**********************************************************************************************/
|
||||||
|
#ifndef RAYGUI_H
|
||||||
|
#define RAYGUI_H
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Defines and Macros
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
#define NUM_PROPERTIES 98
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Types and Structures Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
typedef enum GuiProperty {
|
||||||
|
GLOBAL_BASE_COLOR = 0,
|
||||||
|
GLOBAL_BORDER_COLOR,
|
||||||
|
GLOBAL_TEXT_COLOR,
|
||||||
|
GLOBAL_TEXT_FONTSIZE,
|
||||||
|
GLOBAL_BORDER_WIDTH,
|
||||||
|
BACKGROUND_COLOR,
|
||||||
|
LABEL_BORDER_WIDTH,
|
||||||
|
LABEL_TEXT_COLOR,
|
||||||
|
LABEL_TEXT_PADDING,
|
||||||
|
BUTTON_BORDER_WIDTH,
|
||||||
|
BUTTON_TEXT_PADDING,
|
||||||
|
BUTTON_DEFAULT_BORDER_COLOR,
|
||||||
|
BUTTON_DEFAULT_INSIDE_COLOR,
|
||||||
|
BUTTON_DEFAULT_TEXT_COLOR,
|
||||||
|
BUTTON_HOVER_BORDER_COLOR,
|
||||||
|
BUTTON_HOVER_INSIDE_COLOR,
|
||||||
|
BUTTON_HOVER_TEXT_COLOR,
|
||||||
|
BUTTON_PRESSED_BORDER_COLOR,
|
||||||
|
BUTTON_PRESSED_INSIDE_COLOR,
|
||||||
|
BUTTON_PRESSED_TEXT_COLOR,
|
||||||
|
TOGGLE_TEXT_PADDING,
|
||||||
|
TOGGLE_BORDER_WIDTH,
|
||||||
|
TOGGLE_DEFAULT_BORDER_COLOR,
|
||||||
|
TOGGLE_DEFAULT_INSIDE_COLOR,
|
||||||
|
TOGGLE_DEFAULT_TEXT_COLOR,
|
||||||
|
TOGGLE_HOVER_BORDER_COLOR,
|
||||||
|
TOGGLE_HOVER_INSIDE_COLOR,
|
||||||
|
TOGGLE_HOVER_TEXT_COLOR,
|
||||||
|
TOGGLE_PRESSED_BORDER_COLOR,
|
||||||
|
TOGGLE_PRESSED_INSIDE_COLOR,
|
||||||
|
TOGGLE_PRESSED_TEXT_COLOR,
|
||||||
|
TOGGLE_ACTIVE_BORDER_COLOR,
|
||||||
|
TOGGLE_ACTIVE_INSIDE_COLOR,
|
||||||
|
TOGGLE_ACTIVE_TEXT_COLOR,
|
||||||
|
TOGGLEGROUP_PADDING,
|
||||||
|
SLIDER_BORDER_WIDTH,
|
||||||
|
SLIDER_BUTTON_BORDER_WIDTH,
|
||||||
|
SLIDER_BORDER_COLOR,
|
||||||
|
SLIDER_INSIDE_COLOR,
|
||||||
|
SLIDER_DEFAULT_COLOR,
|
||||||
|
SLIDER_HOVER_COLOR,
|
||||||
|
SLIDER_ACTIVE_COLOR,
|
||||||
|
SLIDERBAR_BORDER_COLOR,
|
||||||
|
SLIDERBAR_INSIDE_COLOR,
|
||||||
|
SLIDERBAR_DEFAULT_COLOR,
|
||||||
|
SLIDERBAR_HOVER_COLOR,
|
||||||
|
SLIDERBAR_ACTIVE_COLOR,
|
||||||
|
SLIDERBAR_ZERO_LINE_COLOR,
|
||||||
|
PROGRESSBAR_BORDER_COLOR,
|
||||||
|
PROGRESSBAR_INSIDE_COLOR,
|
||||||
|
PROGRESSBAR_PROGRESS_COLOR,
|
||||||
|
PROGRESSBAR_BORDER_WIDTH,
|
||||||
|
SPINNER_LABEL_BORDER_COLOR,
|
||||||
|
SPINNER_LABEL_INSIDE_COLOR,
|
||||||
|
SPINNER_DEFAULT_BUTTON_BORDER_COLOR,
|
||||||
|
SPINNER_DEFAULT_BUTTON_INSIDE_COLOR,
|
||||||
|
SPINNER_DEFAULT_SYMBOL_COLOR,
|
||||||
|
SPINNER_DEFAULT_TEXT_COLOR,
|
||||||
|
SPINNER_HOVER_BUTTON_BORDER_COLOR,
|
||||||
|
SPINNER_HOVER_BUTTON_INSIDE_COLOR,
|
||||||
|
SPINNER_HOVER_SYMBOL_COLOR,
|
||||||
|
SPINNER_HOVER_TEXT_COLOR,
|
||||||
|
SPINNER_PRESSED_BUTTON_BORDER_COLOR,
|
||||||
|
SPINNER_PRESSED_BUTTON_INSIDE_COLOR,
|
||||||
|
SPINNER_PRESSED_SYMBOL_COLOR,
|
||||||
|
SPINNER_PRESSED_TEXT_COLOR,
|
||||||
|
COMBOBOX_PADDING,
|
||||||
|
COMBOBOX_BUTTON_WIDTH,
|
||||||
|
COMBOBOX_BUTTON_HEIGHT,
|
||||||
|
COMBOBOX_BORDER_WIDTH,
|
||||||
|
COMBOBOX_DEFAULT_BORDER_COLOR,
|
||||||
|
COMBOBOX_DEFAULT_INSIDE_COLOR,
|
||||||
|
COMBOBOX_DEFAULT_TEXT_COLOR,
|
||||||
|
COMBOBOX_DEFAULT_LIST_TEXT_COLOR,
|
||||||
|
COMBOBOX_HOVER_BORDER_COLOR,
|
||||||
|
COMBOBOX_HOVER_INSIDE_COLOR,
|
||||||
|
COMBOBOX_HOVER_TEXT_COLOR,
|
||||||
|
COMBOBOX_HOVER_LIST_TEXT_COLOR,
|
||||||
|
COMBOBOX_PRESSED_BORDER_COLOR,
|
||||||
|
COMBOBOX_PRESSED_INSIDE_COLOR,
|
||||||
|
COMBOBOX_PRESSED_TEXT_COLOR,
|
||||||
|
COMBOBOX_PRESSED_LIST_BORDER_COLOR,
|
||||||
|
COMBOBOX_PRESSED_LIST_INSIDE_COLOR,
|
||||||
|
COMBOBOX_PRESSED_LIST_TEXT_COLOR,
|
||||||
|
CHECKBOX_DEFAULT_BORDER_COLOR,
|
||||||
|
CHECKBOX_DEFAULT_INSIDE_COLOR,
|
||||||
|
CHECKBOX_HOVER_BORDER_COLOR,
|
||||||
|
CHECKBOX_HOVER_INSIDE_COLOR,
|
||||||
|
CHECKBOX_CLICK_BORDER_COLOR,
|
||||||
|
CHECKBOX_CLICK_INSIDE_COLOR,
|
||||||
|
CHECKBOX_STATUS_ACTIVE_COLOR,
|
||||||
|
CHECKBOX_INSIDE_WIDTH,
|
||||||
|
TEXTBOX_BORDER_WIDTH,
|
||||||
|
TEXTBOX_BORDER_COLOR,
|
||||||
|
TEXTBOX_INSIDE_COLOR,
|
||||||
|
TEXTBOX_TEXT_COLOR,
|
||||||
|
TEXTBOX_LINE_COLOR,
|
||||||
|
TEXTBOX_TEXT_FONTSIZE
|
||||||
|
} GuiProperty;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" { // Prevents name mangling of functions
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Global Variables Definition
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
static const char *guiPropertyName[] = {
|
||||||
|
"GLOBAL_BASE_COLOR",
|
||||||
|
"GLOBAL_BORDER_COLOR",
|
||||||
|
"GLOBAL_TEXT_COLOR",
|
||||||
|
"GLOBAL_TEXT_FONTSIZE",
|
||||||
|
"GLOBAL_BORDER_WIDTH",
|
||||||
|
"BACKGROUND_COLOR",
|
||||||
|
"LABEL_BORDER_WIDTH",
|
||||||
|
"LABEL_TEXT_COLOR",
|
||||||
|
"LABEL_TEXT_PADDING",
|
||||||
|
"BUTTON_BORDER_WIDTH",
|
||||||
|
"BUTTON_TEXT_PADDING",
|
||||||
|
"BUTTON_DEFAULT_BORDER_COLOR",
|
||||||
|
"BUTTON_DEFAULT_INSIDE_COLOR",
|
||||||
|
"BUTTON_DEFAULT_TEXT_COLOR",
|
||||||
|
"BUTTON_HOVER_BORDER_COLOR",
|
||||||
|
"BUTTON_HOVER_INSIDE_COLOR",
|
||||||
|
"BUTTON_HOVER_TEXT_COLOR",
|
||||||
|
"BUTTON_PRESSED_BORDER_COLOR",
|
||||||
|
"BUTTON_PRESSED_INSIDE_COLOR",
|
||||||
|
"BUTTON_PRESSED_TEXT_COLOR",
|
||||||
|
"TOGGLE_TEXT_PADDING",
|
||||||
|
"TOGGLE_BORDER_WIDTH",
|
||||||
|
"TOGGLE_DEFAULT_BORDER_COLOR",
|
||||||
|
"TOGGLE_DEFAULT_INSIDE_COLOR",
|
||||||
|
"TOGGLE_DEFAULT_TEXT_COLOR",
|
||||||
|
"TOGGLE_HOVER_BORDER_COLOR",
|
||||||
|
"TOGGLE_HOVER_INSIDE_COLOR",
|
||||||
|
"TOGGLE_HOVER_TEXT_COLOR",
|
||||||
|
"TOGGLE_PRESSED_BORDER_COLOR",
|
||||||
|
"TOGGLE_PRESSED_INSIDE_COLOR",
|
||||||
|
"TOGGLE_PRESSED_TEXT_COLOR",
|
||||||
|
"TOGGLE_ACTIVE_BORDER_COLOR",
|
||||||
|
"TOGGLE_ACTIVE_INSIDE_COLOR",
|
||||||
|
"TOGGLE_ACTIVE_TEXT_COLOR",
|
||||||
|
"TOGGLEGROUP_PADDING",
|
||||||
|
"SLIDER_BORDER_WIDTH",
|
||||||
|
"SLIDER_BUTTON_BORDER_WIDTH",
|
||||||
|
"SLIDER_BORDER_COLOR",
|
||||||
|
"SLIDER_INSIDE_COLOR",
|
||||||
|
"SLIDER_DEFAULT_COLOR",
|
||||||
|
"SLIDER_HOVER_COLOR",
|
||||||
|
"SLIDER_ACTIVE_COLOR",
|
||||||
|
"SLIDERBAR_BORDER_COLOR",
|
||||||
|
"SLIDERBAR_INSIDE_COLOR",
|
||||||
|
"SLIDERBAR_DEFAULT_COLOR",
|
||||||
|
"SLIDERBAR_HOVER_COLOR",
|
||||||
|
"SLIDERBAR_ACTIVE_COLOR",
|
||||||
|
"SLIDERBAR_ZERO_LINE_COLOR",
|
||||||
|
"PROGRESSBAR_BORDER_COLOR",
|
||||||
|
"PROGRESSBAR_INSIDE_COLOR",
|
||||||
|
"PROGRESSBAR_PROGRESS_COLOR",
|
||||||
|
"PROGRESSBAR_BORDER_WIDTH",
|
||||||
|
"SPINNER_LABEL_BORDER_COLOR",
|
||||||
|
"SPINNER_LABEL_INSIDE_COLOR",
|
||||||
|
"SPINNER_DEFAULT_BUTTON_BORDER_COLOR",
|
||||||
|
"SPINNER_DEFAULT_BUTTON_INSIDE_COLOR",
|
||||||
|
"SPINNER_DEFAULT_SYMBOL_COLOR",
|
||||||
|
"SPINNER_DEFAULT_TEXT_COLOR",
|
||||||
|
"SPINNER_HOVER_BUTTON_BORDER_COLOR",
|
||||||
|
"SPINNER_HOVER_BUTTON_INSIDE_COLOR",
|
||||||
|
"SPINNER_HOVER_SYMBOL_COLOR",
|
||||||
|
"SPINNER_HOVER_TEXT_COLOR",
|
||||||
|
"SPINNER_PRESSED_BUTTON_BORDER_COLOR",
|
||||||
|
"SPINNER_PRESSED_BUTTON_INSIDE_COLOR",
|
||||||
|
"SPINNER_PRESSED_SYMBOL_COLOR",
|
||||||
|
"SPINNER_PRESSED_TEXT_COLOR",
|
||||||
|
"COMBOBOX_PADDING",
|
||||||
|
"COMBOBOX_BUTTON_WIDTH",
|
||||||
|
"COMBOBOX_BUTTON_HEIGHT",
|
||||||
|
"COMBOBOX_BORDER_WIDTH",
|
||||||
|
"COMBOBOX_DEFAULT_BORDER_COLOR",
|
||||||
|
"COMBOBOX_DEFAULT_INSIDE_COLOR",
|
||||||
|
"COMBOBOX_DEFAULT_TEXT_COLOR",
|
||||||
|
"COMBOBOX_DEFAULT_LIST_TEXT_COLOR",
|
||||||
|
"COMBOBOX_HOVER_BORDER_COLOR",
|
||||||
|
"COMBOBOX_HOVER_INSIDE_COLOR",
|
||||||
|
"COMBOBOX_HOVER_TEXT_COLOR",
|
||||||
|
"COMBOBOX_HOVER_LIST_TEXT_COLOR",
|
||||||
|
"COMBOBOX_PRESSED_BORDER_COLOR",
|
||||||
|
"COMBOBOX_PRESSED_INSIDE_COLOR",
|
||||||
|
"COMBOBOX_PRESSED_TEXT_COLOR",
|
||||||
|
"COMBOBOX_PRESSED_LIST_BORDER_COLOR",
|
||||||
|
"COMBOBOX_PRESSED_LIST_INSIDE_COLOR",
|
||||||
|
"COMBOBOX_PRESSED_LIST_TEXT_COLOR",
|
||||||
|
"CHECKBOX_DEFAULT_BORDER_COLOR",
|
||||||
|
"CHECKBOX_DEFAULT_INSIDE_COLOR",
|
||||||
|
"CHECKBOX_HOVER_BORDER_COLOR",
|
||||||
|
"CHECKBOX_HOVER_INSIDE_COLOR",
|
||||||
|
"CHECKBOX_CLICK_BORDER_COLOR",
|
||||||
|
"CHECKBOX_CLICK_INSIDE_COLOR",
|
||||||
|
"CHECKBOX_STATUS_ACTIVE_COLOR",
|
||||||
|
"CHECKBOX_INSIDE_WIDTH",
|
||||||
|
"TEXTBOX_BORDER_WIDTH",
|
||||||
|
"TEXTBOX_BORDER_COLOR",
|
||||||
|
"TEXTBOX_INSIDE_COLOR",
|
||||||
|
"TEXTBOX_TEXT_COLOR",
|
||||||
|
"TEXTBOX_LINE_COLOR",
|
||||||
|
"TEXTBOX_TEXT_FONTSIZE"
|
||||||
|
};
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Module Functions Declaration
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
void GuiLabel(Rectangle bounds, const char *text); // Label element, show text
|
||||||
|
void GuiLabelEx(Rectangle bounds, const char *text, Color textColor, Color border, Color inner); // Label element extended, configurable colors
|
||||||
|
bool GuiButton(Rectangle bounds, const char *text); // Button element, returns true when clicked
|
||||||
|
bool GuiToggleButton(Rectangle bounds, const char *text, bool toggle); // Toggle Button element, returns true when active
|
||||||
|
int GuiToggleGroup(Rectangle bounds, int toggleNum, char **toggleText, int toggleActive); // Toggle Group element, returns toggled button index
|
||||||
|
int GuiComboBox(Rectangle bounds, int comboNum, char **comboText, int comboActive); // Combo Box element, returns selected item index
|
||||||
|
bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box element, returns true when active
|
||||||
|
float GuiSlider(Rectangle bounds, float value, float minValue, float maxValue); // Slider element, returns selected value
|
||||||
|
float GuiSliderBar(Rectangle bounds, float value, float minValue, float maxValue); // Slider Bar element, returns selected value
|
||||||
|
void GuiProgressBar(Rectangle bounds, float value); // Progress Bar element, shows current progress value
|
||||||
|
int GuiSpinner(Rectangle bounds, int value, int minValue, int maxValue); // Spinner element, returns selected value
|
||||||
|
char *GuiTextBox(Rectangle bounds, char *text); // Text Box element, returns input text
|
||||||
|
|
||||||
|
void SaveGuiStyle(const char *fileName); // Save GUI style file
|
||||||
|
void LoadGuiStyle(const char *fileName); // Load GUI style file
|
||||||
|
|
||||||
|
void SetStyleProperty(int guiProperty, int value); // Set one style property
|
||||||
|
int GetStyleProperty(int guiProperty); // Get one style property
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RAYGUI_H
|
87
src/raylib.h
|
@ -241,20 +241,13 @@ typedef struct Texture2D {
|
||||||
int format; // Data format (TextureFormat)
|
int format; // Data format (TextureFormat)
|
||||||
} Texture2D;
|
} Texture2D;
|
||||||
|
|
||||||
// Character type (one font glyph)
|
|
||||||
typedef struct Character {
|
|
||||||
int value; //char value = ' '; (int)value = 32;
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
int w;
|
|
||||||
int h;
|
|
||||||
} Character;
|
|
||||||
|
|
||||||
// SpriteFont type, includes texture and charSet array data
|
// SpriteFont type, includes texture and charSet array data
|
||||||
typedef struct SpriteFont {
|
typedef struct SpriteFont {
|
||||||
Texture2D texture;
|
Texture2D texture; // Font texture
|
||||||
int numChars;
|
int size; // Base size (default chars height)
|
||||||
Character *charSet;
|
int numChars; // Number of characters
|
||||||
|
int *charValues; // Characters values array
|
||||||
|
Rectangle *charRecs; // Characters rectangles within the texture
|
||||||
} SpriteFont;
|
} SpriteFont;
|
||||||
|
|
||||||
// Camera type, defines a camera position/orientation in 3d space
|
// Camera type, defines a camera position/orientation in 3d space
|
||||||
|
@ -276,7 +269,7 @@ typedef struct VertexData {
|
||||||
unsigned int vboId[4];
|
unsigned int vboId[4];
|
||||||
} VertexData;
|
} VertexData;
|
||||||
|
|
||||||
// Shader type
|
// Shader type (generic shader)
|
||||||
typedef struct Shader {
|
typedef struct Shader {
|
||||||
unsigned int id; // Shader program id
|
unsigned int id; // Shader program id
|
||||||
|
|
||||||
|
@ -411,6 +404,8 @@ void EndDrawing(void); // End canvas drawin
|
||||||
void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup)
|
void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup)
|
||||||
void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode
|
void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode
|
||||||
|
|
||||||
|
Ray GetMouseRay(Vector2 mousePosition, Camera camera); // TODO: Returns a ray trace from mouse position
|
||||||
|
|
||||||
void SetTargetFPS(int fps); // Set target FPS (maximum)
|
void SetTargetFPS(int fps); // Set target FPS (maximum)
|
||||||
float GetFPS(void); // Returns current FPS
|
float GetFPS(void); // Returns current FPS
|
||||||
float GetFrameTime(void); // Returns time in seconds for one frame
|
float GetFrameTime(void); // Returns time in seconds for one frame
|
||||||
|
@ -421,38 +416,13 @@ int GetHexValue(Color color); // Returns hexadecim
|
||||||
int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
|
int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
|
||||||
Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
|
||||||
|
|
||||||
void SetConfigFlags(char flags); // Enable some window configurations
|
void SetConfigFlags(char flags); // Setup some window configuration flags
|
||||||
void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
|
void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
|
||||||
|
|
||||||
bool IsFileDropped(void); // Check if a file have been dropped into window
|
bool IsFileDropped(void); // Check if a file have been dropped into window
|
||||||
char **GetDroppedFiles(int *count); // Retrieve dropped files into window
|
char **GetDroppedFiles(int *count); // Retrieve dropped files into window
|
||||||
void ClearDroppedFiles(void); // Clear dropped files paths buffer
|
void ClearDroppedFiles(void); // Clear dropped files paths buffer
|
||||||
|
|
||||||
Ray GetMouseRay(Vector2 mousePosition, Camera camera); // TODO: Gives the ray trace from mouse position
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
// Shaders System Functions (Module: rlgl)
|
|
||||||
// NOTE: This functions are useless when using OpenGL 1.1
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
|
|
||||||
unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr); // Load a custom shader and return program id
|
|
||||||
void UnloadShader(Shader shader); // Unload a custom shader from memory
|
|
||||||
void SetPostproShader(Shader shader); // Set fullscreen postproduction shader
|
|
||||||
void SetCustomShader(Shader shader); // Set custom shader to be used in batch draw
|
|
||||||
void SetDefaultShader(void); // Set default shader to be used in batch draw
|
|
||||||
void SetModelShader(Model *model, Shader shader); // Link a shader to a model
|
|
||||||
bool IsPosproShaderEnabled(void); // Check if postprocessing shader is enabled
|
|
||||||
|
|
||||||
int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
|
||||||
void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // Set shader uniform value (float)
|
|
||||||
void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int)
|
|
||||||
void SetShaderMapDiffuse(Shader *shader, Texture2D texture); // Default diffuse shader map texture assignment
|
|
||||||
void SetShaderMapNormal(Shader *shader, const char *uniformName, Texture2D texture); // Normal map texture shader assignment
|
|
||||||
void SetShaderMapSpecular(Shader *shader, const char *uniformName, Texture2D texture); // Specular map texture shader assignment
|
|
||||||
void SetShaderMap(Shader *shader, int mapLocation, Texture2D texture, int textureUnit); // TODO: Generic shader map assignment
|
|
||||||
|
|
||||||
void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied)
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Input Handling Functions (Module: core)
|
// Input Handling Functions (Module: core)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
@ -517,18 +487,20 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang
|
||||||
// Camera System Functions (Module: camera)
|
// Camera System Functions (Module: camera)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
|
void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
|
||||||
Camera UpdateCamera(Vector3 *playerPosition); // Update camera and player position (1st person and 3rd person cameras)
|
void UpdateCamera(Camera *camera); // Update camera (player position is ignored)
|
||||||
|
void UpdateCameraPlayer(Camera *camera, Vector3 *position); // Update camera and player position (1st person and 3rd person cameras)
|
||||||
|
|
||||||
void SetCameraMoveControls(int frontKey, int backKey,
|
void SetCameraPosition(Vector3 position); // Set internal camera position
|
||||||
int leftKey, int rightKey,
|
void SetCameraTarget(Vector3 target); // Set internal camera target
|
||||||
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
|
|
||||||
|
|
||||||
void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
|
||||||
void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
|
void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
|
||||||
void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
|
void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
|
||||||
|
|
||||||
|
void SetCameraMoveControls(int frontKey, int backKey,
|
||||||
|
int leftKey, int rightKey,
|
||||||
|
int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
|
||||||
void SetCameraMouseSensitivity(float sensitivity); // Set camera mouse sensitivity (1st person and 3rd person cameras)
|
void SetCameraMouseSensitivity(float sensitivity); // Set camera mouse sensitivity (1st person and 3rd person cameras)
|
||||||
void SetCameraTarget(Vector3 target); // Set internal camera target
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Basic Shapes Drawing Functions (Module: shapes)
|
// Basic Shapes Drawing Functions (Module: shapes)
|
||||||
|
@ -570,7 +542,7 @@ Image LoadImageFromRES(const char *rresName, int resId);
|
||||||
Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory
|
Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory
|
||||||
Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount); // Load a texture from raw data into GPU memory
|
Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount); // Load a texture from raw data into GPU memory
|
||||||
Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource)
|
Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource)
|
||||||
Texture2D LoadTextureFromImage(Image image); // Load a texture from image data (and generate mipmaps)
|
Texture2D LoadTextureFromImage(Image image); // Load a texture from image data
|
||||||
void UnloadImage(Image image); // Unload image from CPU memory (RAM)
|
void UnloadImage(Image image); // Unload image from CPU memory (RAM)
|
||||||
void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
|
void UnloadTexture(Texture2D texture); // Unload texture from GPU memory
|
||||||
Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
|
Color *GetImageData(Image image); // Get pixel data from image as a Color struct array
|
||||||
|
@ -598,7 +570,7 @@ void DrawTextEx(SpriteFont spriteFont, const char* text, Vector2 position,
|
||||||
int fontSize, int spacing, Color tint);
|
int fontSize, int spacing, Color tint);
|
||||||
int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||||
Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing); // Measure string size for SpriteFont
|
Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int spacing); // Measure string size for SpriteFont
|
||||||
int GetFontBaseSize(SpriteFont spriteFont); // Returns the base size for a SpriteFont (chars height)
|
|
||||||
void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner
|
||||||
const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
|
||||||
|
|
||||||
|
@ -644,6 +616,29 @@ bool CheckCollisionBoxes(Vector3 minBBox1, Vector3 maxBBox1, Vector3 minBBox2, V
|
||||||
bool CheckCollisionBoxSphere(Vector3 minBBox, Vector3 maxBBox, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere
|
bool CheckCollisionBoxSphere(Vector3 minBBox, Vector3 maxBBox, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere
|
||||||
Vector3 ResolveCollisionCubicmap(Image cubicmap, Vector3 mapPosition, Vector3 *playerPosition, float radius); // Return the normal vector of the impacted surface
|
Vector3 ResolveCollisionCubicmap(Image cubicmap, Vector3 mapPosition, Vector3 *playerPosition, float radius); // Return the normal vector of the impacted surface
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
// Shaders System Functions (Module: rlgl)
|
||||||
|
// NOTE: This functions are useless when using OpenGL 1.1
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
|
||||||
|
unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr); // Load custom shaders strings and return program id
|
||||||
|
void UnloadShader(Shader shader); // Unload a custom shader from memory
|
||||||
|
void SetPostproShader(Shader shader); // Set fullscreen postproduction shader
|
||||||
|
void SetCustomShader(Shader shader); // Set custom shader to be used in batch draw
|
||||||
|
void SetDefaultShader(void); // Set default shader to be used in batch draw
|
||||||
|
void SetModelShader(Model *model, Shader shader); // Link a shader to a model
|
||||||
|
bool IsPosproShaderEnabled(void); // Check if postprocessing shader is enabled
|
||||||
|
|
||||||
|
int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
||||||
|
void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // Set shader uniform value (float)
|
||||||
|
void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int)
|
||||||
|
void SetShaderMapDiffuse(Shader *shader, Texture2D texture); // Default diffuse shader map texture assignment
|
||||||
|
void SetShaderMapNormal(Shader *shader, const char *uniformName, Texture2D texture); // Normal map texture shader assignment
|
||||||
|
void SetShaderMapSpecular(Shader *shader, const char *uniformName, Texture2D texture); // Specular map texture shader assignment
|
||||||
|
void SetShaderMap(Shader *shader, int mapLocation, Texture2D texture, int textureUnit); // TODO: Generic shader map assignment
|
||||||
|
|
||||||
|
void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// Audio Loading and Playing Functions (Module: audio)
|
// Audio Loading and Playing Functions (Module: audio)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
16
src/rlgl.c
|
@ -4,8 +4,8 @@
|
||||||
*
|
*
|
||||||
* 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 (@raysan5)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
|
@ -858,7 +858,7 @@ void rlglInit(void)
|
||||||
// NOTE: We don't need that much data on screen... right now...
|
// NOTE: We don't need that much data on screen... right now...
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_11)
|
#if defined(GRAPHICS_API_OPENGL_11)
|
||||||
TraceLog(INFO, "OpenGL 1.1 profile initialized");
|
//TraceLog(INFO, "OpenGL 1.1 (or driver default) profile initialized");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
|
@ -1938,15 +1938,17 @@ Model rlglLoadModel(VertexData mesh)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read screen pixel data (color buffer)
|
// Read screen pixel data (color buffer)
|
||||||
|
// ISSUE: Non pre-multiplied alpha when reading from backbuffer!
|
||||||
|
// TODO: Multiply alpha
|
||||||
unsigned char *rlglReadScreenPixels(int width, int height)
|
unsigned char *rlglReadScreenPixels(int width, int height)
|
||||||
{
|
{
|
||||||
unsigned char *screenData = (unsigned char *)malloc(width * height * sizeof(unsigned char) * 4);
|
unsigned char *screenData = (unsigned char *)malloc(width*height*sizeof(unsigned char)*4);
|
||||||
|
|
||||||
// NOTE: glReadPixels returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer
|
// NOTE: glReadPixels returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer
|
||||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, screenData);
|
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, screenData);
|
||||||
|
|
||||||
// Flip image vertically!
|
// Flip image vertically!
|
||||||
unsigned char *imgData = (unsigned char *)malloc(width * height * sizeof(unsigned char) * 4);
|
unsigned char *imgData = (unsigned char *)malloc(width*height*sizeof(unsigned char)*4);
|
||||||
|
|
||||||
for (int y = height-1; y >= 0; y--)
|
for (int y = height-1; y >= 0; y--)
|
||||||
{
|
{
|
||||||
|
@ -2075,7 +2077,7 @@ Shader LoadShader(char *vsFileName, char *fsFileName)
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load a custom shader and return program id
|
// Load custom shader strings and return program id
|
||||||
unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr)
|
unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr)
|
||||||
{
|
{
|
||||||
unsigned int program = 0;
|
unsigned int program = 0;
|
||||||
|
@ -3059,8 +3061,6 @@ static pixel *GenNextMipmap(pixel *srcData, int srcWidth, int srcHeight)
|
||||||
|
|
||||||
#if defined(RLGL_STANDALONE)
|
#if defined(RLGL_STANDALONE)
|
||||||
|
|
||||||
typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
|
|
||||||
|
|
||||||
// Output a trace log message
|
// Output a trace log message
|
||||||
// NOTE: Expected msgType: (0)Info, (1)Error, (2)Warning
|
// NOTE: Expected msgType: (0)Info, (1)Error, (2)Warning
|
||||||
static void TraceLog(int msgType, const char *text, ...)
|
static void TraceLog(int msgType, const char *text, ...)
|
||||||
|
|
|
@ -4,7 +4,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 - Vertex data is stored in VBOs or VAOs (when available), call rlglDraw() to render
|
* OpenGL ES 2 - Vertex data is stored in VBOs or VAOs (when available), call rlglDraw() to render
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||||
|
@ -270,7 +270,7 @@ void PrintModelviewMatrix(void); // DEBUG: Print modelview matrix
|
||||||
// NOTE: This functions are useless when using OpenGL 1.1
|
// NOTE: This functions are useless when using OpenGL 1.1
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
|
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
|
||||||
unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr); // Load a custom shader and return program id
|
unsigned int LoadShaderProgram(char *vShaderStr, char *fShaderStr); // Load custom shader strings and return program id
|
||||||
void UnloadShader(Shader shader); // Unload a custom shader from memory
|
void UnloadShader(Shader shader); // Unload a custom shader from memory
|
||||||
void SetPostproShader(Shader shader); // Set fullscreen postproduction shader
|
void SetPostproShader(Shader shader); // Set fullscreen postproduction shader
|
||||||
void SetCustomShader(Shader shader); // Set custom shader to be used in batch draw
|
void SetCustomShader(Shader shader); // Set custom shader to be used in batch draw
|
||||||
|
|