commit
60194753d7
102 changed files with 2443 additions and 423 deletions
|
|
@ -12,6 +12,8 @@ Release: raylib 1.3.0 (01 September 2015)
|
|||
NOTE:
|
||||
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.
|
||||
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:
|
||||
[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] Renamed function SetFlags() to SetConfigFlags()
|
||||
[shapes] Simplified some functions to improve performance
|
||||
[textures] Review of Image struct to support multiple data formats
|
||||
[textures] Added function LoadImageEx()
|
||||
[textures] Added function LoadImageRaw()
|
||||
[textures] Added function LoadTextureEx()
|
||||
|
|
@ -37,6 +40,8 @@ smaller changes:
|
|||
[textures] Added function ImageConvertFormat()
|
||||
[textures] Added function GenTextureMipmaps()
|
||||
[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] Added 3d collision functions (sphere vs sphere vs box vs box)
|
||||
[models] Added function DrawCubeTexture()
|
||||
|
|
|
|||
14
README.md
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
|
||||
(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),
|
||||
very easy to use, just calling functions: SetCameraMode() and UpdateCamera().
|
||||
New camera module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person).
|
||||
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,
|
||||
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)
|
||||
|
||||
acknowledgments
|
||||
acknowledgements
|
||||
---------------
|
||||
|
||||
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.
|
||||
- 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.
|
||||
- Marc Agüera for testing and using raylib on a real product (Koala Seasons)
|
||||
- Daniel Moreno for testing and using raylib on a real product (Koala Seasons)
|
||||
- Daniel Gomez 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](http://www.koalaseasons.com))
|
||||
- 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.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* 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)
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
91
examples/core_3d_camera_first_person.c
Normal file
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
BIN
examples/core_3d_camera_first_person.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
75
examples/core_3d_camera_free.c
Normal file
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
BIN
examples/core_3d_camera_free.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
|
|
@ -5,7 +5,7 @@
|
|||
* 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)
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
*
|
||||
* 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)
|
||||
*
|
||||
* 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
|
||||
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
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// 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
|
||||
|
|
@ -50,14 +57,16 @@ int main()
|
|||
|
||||
Begin3dMode(camera);
|
||||
|
||||
DrawCube(cubePosition, 2, 2, 2, RED);
|
||||
DrawCubeWires(cubePosition, 2, 2, 2, MAROON);
|
||||
DrawCube(cubePosition, 2, 2, 2, GRAY);
|
||||
DrawCubeWires(cubePosition, 2, 2, 2, DARKGRAY);
|
||||
|
||||
DrawGrid(10.0, 1.0);
|
||||
|
||||
DrawRay(pickingLine, MAROON);
|
||||
DrawRay(ray, MAROON);
|
||||
|
||||
End3dMode();
|
||||
|
||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, GRAY);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
|
|
|||
BIN
examples/core_3d_picking.png
Normal file
BIN
examples/core_3d_picking.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
|
|
@ -15,7 +15,7 @@
|
|||
* 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)
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* 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)
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
74
examples/core_drop_files.c
Normal file
74
examples/core_drop_files.c
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [core] example - Windows drop files
|
||||
*
|
||||
* 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) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - drop files");
|
||||
|
||||
int count = 0;
|
||||
char **droppedFiles;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsFileDropped())
|
||||
{
|
||||
droppedFiles = GetDroppedFiles(&count);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
if (count == 0) DrawText("Drop your files to this window!", 100, 40, 20, DARKGRAY);
|
||||
else
|
||||
{
|
||||
DrawText("Dropped files:", 100, 40, 20, DARKGRAY);
|
||||
|
||||
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));
|
||||
|
||||
DrawText(droppedFiles[i], 120, 100 + 40*i, 10, GRAY);
|
||||
}
|
||||
|
||||
DrawText("Drop new files...", 100, 110 + 40*count, 20, DARKGRAY);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
ClearDroppedFiles(); // Clear internal buffers
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
examples/core_drop_files.png
Normal file
BIN
examples/core_drop_files.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
|
|
@ -8,7 +8,7 @@
|
|||
* 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)
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* 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)
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* 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)
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* 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)
|
||||
*
|
||||
* 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)
|
||||
* 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
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* 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");
|
||||
|
||||
// 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
|
||||
Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
|
||||
Vector3 billPosition = { 0.0, 0.0, 0.0 }; // Position where draw billboard
|
||||
Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
|
||||
Vector3 billPosition = { 0.0, 2.0, 0.0 }; // Position where draw billboard
|
||||
|
||||
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
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyDown(KEY_LEFT)) camera.position.x -= 0.2;
|
||||
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;
|
||||
UpdateCamera(&camera); // Update internal camera and our camera
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
|
@ -49,8 +49,7 @@ int main()
|
|||
|
||||
Begin3dMode(camera);
|
||||
|
||||
//DrawBillboard(camera, lena, billPosition, 1.0, WHITE);
|
||||
DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
|
||||
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
|
||||
|
||||
DrawGrid(10.0, 1.0); // Draw a grid
|
||||
|
||||
|
|
@ -64,7 +63,7 @@ int main()
|
|||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(lena); // Unload texture
|
||||
UnloadTexture(bill); // Unload texture
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue