Merged
This commit is contained in:
commit
9a1816bc5b
33 changed files with 636 additions and 407 deletions
14
.gitignore
vendored
14
.gitignore
vendored
|
|
@ -53,17 +53,6 @@ packages/
|
||||||
*.bc
|
*.bc
|
||||||
*.so
|
*.so
|
||||||
|
|
||||||
# Ignore all examples files
|
|
||||||
examples/*
|
|
||||||
# Unignore all examples files with extension
|
|
||||||
!examples/*.c
|
|
||||||
!examples/*.png
|
|
||||||
# Unignore examples Makefile
|
|
||||||
!examples/Makefile
|
|
||||||
!examples/Makefile.Android
|
|
||||||
!examples/raylib_compile_execute.bat
|
|
||||||
!examples/raylib_makefile_example.bat
|
|
||||||
|
|
||||||
# Ignore files build by xcode
|
# Ignore files build by xcode
|
||||||
*.mode*v*
|
*.mode*v*
|
||||||
*.pbxuser
|
*.pbxuser
|
||||||
|
|
@ -93,9 +82,6 @@ compile_commands.json
|
||||||
CTestTestfile.cmake
|
CTestTestfile.cmake
|
||||||
build
|
build
|
||||||
|
|
||||||
# Unignore These makefiles...
|
|
||||||
!examples/CMakeLists.txt
|
|
||||||
|
|
||||||
# Ignore GNU global tags
|
# Ignore GNU global tags
|
||||||
GPATH
|
GPATH
|
||||||
GRTAGS
|
GRTAGS
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ Here it is a list with the ones I'm aware of:
|
||||||
| raylib-factor | 3.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor |
|
| raylib-factor | 3.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor |
|
||||||
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib |
|
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib |
|
||||||
| raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe |
|
| raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe |
|
||||||
|
| hxRaylib | 3.7 | [Haxe](https://haxe.org/) | https://github.com/ForeignSasquatch/hxRaylib |
|
||||||
| ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib |
|
| ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib |
|
||||||
| cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib |
|
| cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib |
|
||||||
| raylib-scm | 2.5 | [Chicken Scheme](https://www.call-cc.org/) | https://github.com/yashrk/raylib-scm |
|
| raylib-scm | 2.5 | [Chicken Scheme](https://www.call-cc.org/) | https://github.com/yashrk/raylib-scm |
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,16 @@
|
||||||
* This example has been created using raylib 3.7 (www.raylib.com)
|
* This example has been created using raylib 3.7 (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)
|
||||||
*
|
*
|
||||||
* Example contributed by Giancamillo Alessandroni ([discord]NotManyIdeas#9972 - [github]NotManyIdeasDev) and
|
* Example contributed by Giancamillo Alessandroni (@NotManyIdeasDev) and
|
||||||
* reviewed by Ramon Santamaria (@raysan5)
|
* reviewed by Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2021 Giancamillo Alessandroni (NotManyIdeas#9972) and Ramon Santamaria (@raysan5)
|
* Copyright (c) 2021 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include <math.h>
|
|
||||||
|
#include <math.h> // Required for: sinf(), cosf()
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
@ -22,10 +23,10 @@ int main(void)
|
||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 450;
|
const int screenHeight = 450;
|
||||||
|
|
||||||
const int virualScreenWidth = 160;
|
const int virtualScreenWidth = 160;
|
||||||
const int virtualScreenHeight = 90;
|
const int virtualScreenHeight = 90;
|
||||||
|
|
||||||
const float virtualRatio = (float)screenWidth/(float)virualScreenWidth;
|
const float virtualRatio = (float)screenWidth/(float)virtualScreenWidth;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - smooth pixel-perfect camera");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - smooth pixel-perfect camera");
|
||||||
|
|
||||||
|
|
@ -35,20 +36,19 @@ int main(void)
|
||||||
Camera2D screenSpaceCamera = { 0 }; // Smoothing camera
|
Camera2D screenSpaceCamera = { 0 }; // Smoothing camera
|
||||||
screenSpaceCamera.zoom = 1.0f;
|
screenSpaceCamera.zoom = 1.0f;
|
||||||
|
|
||||||
RenderTexture2D renderTexture = LoadRenderTexture(virualScreenWidth, virtualScreenHeight); //This is where we'll draw all our objects.
|
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); // This is where we'll draw all our objects.
|
||||||
|
|
||||||
Rectangle firstRectangle = { 70.0f, 35.0f, 20.0f, 20.0f };
|
Rectangle rec01 = { 70.0f, 35.0f, 20.0f, 20.0f };
|
||||||
Rectangle secondRectangle = { 90.0f, 55.0f, 30.0f, 10.0f };
|
Rectangle rec02 = { 90.0f, 55.0f, 30.0f, 10.0f };
|
||||||
Rectangle thirdRectangle = { 80.0f, 65.0f, 15.0f, 25.0f };
|
Rectangle rec03 = { 80.0f, 65.0f, 15.0f, 25.0f };
|
||||||
|
|
||||||
//The renderTexture's height is flipped (in the source Rectangle), due to OpenGL reasons.
|
// The target's height is flipped (in the source Rectangle), due to OpenGL reasons
|
||||||
Rectangle renderTextureSource = { 0.0f, 0.0f, (float)renderTexture.texture.width, (float)-renderTexture.texture.height };
|
Rectangle sourceRec = { 0.0f, 0.0f, (float)target.texture.width, -(float)target.texture.height };
|
||||||
Rectangle renderTextureDest = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };
|
Rectangle destRec = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };
|
||||||
|
|
||||||
Vector2 origin = { 0.0f, 0.0f };
|
Vector2 origin = { 0.0f, 0.0f };
|
||||||
|
|
||||||
float rotation = 0.0f;
|
float rotation = 0.0f;
|
||||||
float degreesPerSecond = 60.0f;
|
|
||||||
|
|
||||||
float cameraX = 0.0f;
|
float cameraX = 0.0f;
|
||||||
float cameraY = 0.0f;
|
float cameraY = 0.0f;
|
||||||
|
|
@ -61,16 +61,16 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
rotation += degreesPerSecond*GetFrameTime(); // Rotate the rectangles.
|
rotation += 60.0f*GetFrameTime(); // Rotate the rectangles, 60 degrees per second
|
||||||
|
|
||||||
// Make the camera move to demonstrate the effect.
|
// Make the camera move to demonstrate the effect
|
||||||
cameraX = (sinf(GetTime())*50.0f) - 10.0f;
|
cameraX = (sinf(GetTime())*50.0f) - 10.0f;
|
||||||
cameraY = cosf(GetTime())*30.0f;
|
cameraY = cosf(GetTime())*30.0f;
|
||||||
|
|
||||||
// Set the camera's target to the values computed above.
|
// Set the camera's target to the values computed above
|
||||||
screenSpaceCamera.target = (Vector2){ cameraX, cameraY };
|
screenSpaceCamera.target = (Vector2){ cameraX, cameraY };
|
||||||
|
|
||||||
//Round worldSpace coordinates, keep decimals into screenSpace coordinates.
|
// Round worldSpace coordinates, keep decimals into screenSpace coordinates
|
||||||
worldSpaceCamera.target.x = (int)screenSpaceCamera.target.x;
|
worldSpaceCamera.target.x = (int)screenSpaceCamera.target.x;
|
||||||
screenSpaceCamera.target.x -= worldSpaceCamera.target.x;
|
screenSpaceCamera.target.x -= worldSpaceCamera.target.x;
|
||||||
screenSpaceCamera.target.x *= virtualRatio;
|
screenSpaceCamera.target.x *= virtualRatio;
|
||||||
|
|
@ -83,46 +83,34 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginTextureMode(target);
|
||||||
ClearBackground(RED); // This is for debug purposes. If you see red, then you've probably done something wrong.
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
BeginTextureMode(renderTexture);
|
|
||||||
BeginMode2D(worldSpaceCamera);
|
BeginMode2D(worldSpaceCamera);
|
||||||
ClearBackground(RAYWHITE); // This is the color you should see as background color.
|
DrawRectanglePro(rec01, origin, rotation, BLACK);
|
||||||
|
DrawRectanglePro(rec02, origin, -rotation, RED);
|
||||||
// Draw the rectangles
|
DrawRectanglePro(rec03, origin, rotation + 45.0f, BLUE);
|
||||||
DrawRectanglePro(firstRectangle, origin, rotation, BLACK);
|
|
||||||
DrawRectanglePro(secondRectangle, origin, -rotation, RED);
|
|
||||||
DrawRectanglePro(thirdRectangle, origin, rotation + 45.0f, BLUE);
|
|
||||||
|
|
||||||
EndMode2D();
|
EndMode2D();
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RED);
|
||||||
|
|
||||||
BeginMode2D(screenSpaceCamera);
|
BeginMode2D(screenSpaceCamera);
|
||||||
|
DrawTexturePro(target.texture, sourceRec, destRec, origin, 0.0f, WHITE);
|
||||||
// Draw the render texture with an offset of 1 worldSpace unit/pixel, so that the content behind the renderTexture is not shown.
|
|
||||||
DrawTexturePro(
|
|
||||||
renderTexture.texture,
|
|
||||||
renderTextureSource,
|
|
||||||
renderTextureDest,
|
|
||||||
origin,
|
|
||||||
0.0f,
|
|
||||||
WHITE
|
|
||||||
);
|
|
||||||
|
|
||||||
EndMode2D();
|
EndMode2D();
|
||||||
|
|
||||||
//Debug info
|
DrawText(TextFormat("Screen resolution: %ix%i", screenWidth, screenHeight), 10, 10, 20, DARKBLUE);
|
||||||
DrawText("Screen resolution: 800x450", 5, 0, 20, DARKBLUE);
|
DrawText(TextFormat("World resolution: %ix%i", virtualScreenWidth, virtualScreenHeight), 10, 40, 20, DARKGREEN);
|
||||||
DrawText("World resolution: 160x90", 5, 20, 20, DARKGREEN);
|
DrawFPS(GetScreenWidth() - 95, 10);
|
||||||
DrawFPS(screenWidth - 75, 0);
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadRenderTexture(renderTexture); // RenderTexture unloading
|
UnloadRenderTexture(target); // Unload render texture
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 15 KiB |
125
examples/core/core_custom_frame_control.c
Normal file
125
examples/core/core_custom_frame_control.c
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [core] example - custom frame control
|
||||||
|
*
|
||||||
|
* WARNING: This is an example for advance users willing to have full control over
|
||||||
|
* the frame processes. By default, EndDrawing() calls the following processes:
|
||||||
|
* 1. Draw remaining batch data: rlDrawRenderBatchActive()
|
||||||
|
* 2. SwapScreenBuffer()
|
||||||
|
* 3. Frame time control: WaitTime()
|
||||||
|
* 4. PollInputEvents()
|
||||||
|
*
|
||||||
|
* To avoid steps 2, 3 and 4, flag SUPPORT_CUSTOM_FRAME_CONTROL can be enabled in
|
||||||
|
* config.h (it requires recompiling raylib). This way those steps are up to the user.
|
||||||
|
*
|
||||||
|
* Note that enabling this flag invalidates some functions:
|
||||||
|
* - GetFrameTime()
|
||||||
|
* - SetTargetFPS()
|
||||||
|
* - GetFPS()
|
||||||
|
*
|
||||||
|
* This example has been created using raylib 3.8 (www.raylib.com)
|
||||||
|
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
const int screenWidth = 800;
|
||||||
|
const int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom frame control");
|
||||||
|
|
||||||
|
// Custom timming variables
|
||||||
|
double previousTime = GetTime(); // Previous time measure
|
||||||
|
double currentTime = 0.0; // Current time measure
|
||||||
|
double updateDrawTime = 0.0; // Update + Draw time
|
||||||
|
double waitTime = 0.0; // Wait time (if target fps required)
|
||||||
|
float deltaTime = 0.0f; // Frame time (Update + Draw + Wait time)
|
||||||
|
|
||||||
|
float timeCounter = 0.0f; // Accumulative time counter (seconds)
|
||||||
|
float position = 0.0f; // Circle position
|
||||||
|
bool pause = false; // Pause control flag
|
||||||
|
|
||||||
|
int targetFPS = 60; // Our initial target fps
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) pause = !pause;
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_UP)) targetFPS += 20;
|
||||||
|
else if (IsKeyPressed(KEY_DOWN)) targetFPS -= 20;
|
||||||
|
|
||||||
|
if (targetFPS < 0) targetFPS = 0;
|
||||||
|
|
||||||
|
if (!pause)
|
||||||
|
{
|
||||||
|
position += 200*deltaTime; // We move at 200 pixels per second
|
||||||
|
if (position >= GetScreenWidth()) position = 0;
|
||||||
|
timeCounter += deltaTime; // We count time (seconds)
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
for (int i = 0; i < GetScreenWidth()/200; i++) DrawRectangle(200*i, 0, 1, GetScreenHeight(), SKYBLUE);
|
||||||
|
|
||||||
|
DrawCircle((int)position, GetScreenHeight()/2 - 25, 50, RED);
|
||||||
|
|
||||||
|
DrawText(FormatText("%03.0f ms", timeCounter*1000.0f), position - 40, GetScreenHeight()/2 - 100, 20, MAROON);
|
||||||
|
DrawText(FormatText("PosX: %03.0f", position), position - 50, GetScreenHeight()/2 + 40, 20, BLACK);
|
||||||
|
|
||||||
|
DrawText("Circle is moving at a constant 200 pixels/sec,\nindependently of the frame rate.", 10, 10, 20, DARKGRAY);
|
||||||
|
DrawText("PRESS SPACE to PAUSE MOVEMENT", 10, GetScreenHeight() - 60, 20, GRAY);
|
||||||
|
DrawText("PRESS UP | DOWN to CHANGE TARGET FPS", 10, GetScreenHeight() - 30, 20, GRAY);
|
||||||
|
DrawText(FormatText("TARGET FPS: %i", targetFPS), GetScreenWidth() - 220, 10, 20, LIME);
|
||||||
|
DrawText(FormatText("CURRENT FPS: %i", (int)(1.0f/deltaTime)), GetScreenWidth() - 220, 40, 20, GREEN);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
|
||||||
|
// NOTE: In case raylib is configured to SUPPORT_CUSTOM_FRAME_CONTROL,
|
||||||
|
// Events polling, screen buffer swap and frame time control must be managed by the user
|
||||||
|
|
||||||
|
SwapScreenBuffer(); // Flip the back buffer to screen (front buffer)
|
||||||
|
|
||||||
|
currentTime = GetTime();
|
||||||
|
updateDrawTime = currentTime - previousTime;
|
||||||
|
|
||||||
|
if (targetFPS > 0) // We want a fixed frame rate
|
||||||
|
{
|
||||||
|
waitTime = (1.0f/(float)targetFPS) - updateDrawTime;
|
||||||
|
if (waitTime > 0.0)
|
||||||
|
{
|
||||||
|
WaitTime((float)waitTime*1000.0f);
|
||||||
|
currentTime = GetTime();
|
||||||
|
deltaTime = (float)(currentTime - previousTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else deltaTime = updateDrawTime; // Framerate could be variable
|
||||||
|
|
||||||
|
previousTime = currentTime;
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core/core_custom_frame_control.png
Normal file
BIN
examples/core/core_custom_frame_control.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
83
examples/core/core_rotate_by_quat.c
Normal file
83
examples/core/core_rotate_by_quat.c
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "rlgl.h" // just to change line width
|
||||||
|
#include "raymath.h"
|
||||||
|
|
||||||
|
#define windowWidth 1280
|
||||||
|
#define windowHeight 720
|
||||||
|
|
||||||
|
Vector3 Vector3MultiplyQuaternion(Vector3 v, Quaternion q)
|
||||||
|
{
|
||||||
|
Vector3 r, qv, uv, uuv;
|
||||||
|
|
||||||
|
qv.x = q.x;
|
||||||
|
qv.y = q.y;
|
||||||
|
qv.z = q.z;
|
||||||
|
|
||||||
|
uv = Vector3CrossProduct(qv, v);
|
||||||
|
uuv = Vector3CrossProduct(qv, uv);
|
||||||
|
|
||||||
|
uv = Vector3Scale(uv, 2.f*q.w);
|
||||||
|
uuv = Vector3Scale(uuv, 2.0f);
|
||||||
|
|
||||||
|
r = Vector3Add(v, uv);
|
||||||
|
r = Vector3Add(r, uuv);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
SetTraceLogLevel( LOG_ALL );
|
||||||
|
SetConfigFlags( FLAG_VSYNC_HINT | FLAG_MSAA_4X_HINT );
|
||||||
|
InitWindow( windowWidth, windowHeight, "Raylib - template" );
|
||||||
|
|
||||||
|
Camera camera = { 0 };
|
||||||
|
camera.position = (Vector3){ 0.0f, 1.0f, 4.0f };
|
||||||
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||||
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
|
||||||
|
camera.fovy = 45.0f;
|
||||||
|
camera.projection = CAMERA_PERSPECTIVE;
|
||||||
|
|
||||||
|
Vector3 ang = { 0 };
|
||||||
|
Vector3 qv = { 0 };
|
||||||
|
Vector3 mv = { 0 };
|
||||||
|
Vector3 bv = { 0 };
|
||||||
|
Quaternion q;
|
||||||
|
|
||||||
|
float dT = 0;
|
||||||
|
|
||||||
|
rlSetLineWidth(4);
|
||||||
|
while ( !WindowShouldClose() )
|
||||||
|
{
|
||||||
|
dT = GetFrameTime();
|
||||||
|
|
||||||
|
ang.x += .7f * dT;
|
||||||
|
ang.y += .55 * dT;
|
||||||
|
ang.z -= 2.75 * dT;
|
||||||
|
|
||||||
|
q = QuaternionFromEuler(ang.x, ang.y, ang.z);
|
||||||
|
qv = Vector3MultiplyQuaternion((Vector3){0,0,1}, q);
|
||||||
|
|
||||||
|
Matrix m = QuaternionToMatrix(q);
|
||||||
|
mv = Vector3Transform((Vector3){0,0,1},m);
|
||||||
|
|
||||||
|
bv = Vector3RotateByQuaternion((Vector3){0,0,1}, q);
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground( (Color){64,128,255,255} );
|
||||||
|
|
||||||
|
BeginMode3D( camera );
|
||||||
|
DrawLine3D((Vector3){0,0,0}, qv, GREEN);
|
||||||
|
DrawLine3D((Vector3){-.1,0,0}, mv, YELLOW);
|
||||||
|
DrawLine3D((Vector3){.1,0,0}, bv, RED);
|
||||||
|
|
||||||
|
DrawGrid( 10, 1.0f );
|
||||||
|
|
||||||
|
EndMode3D();
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseWindow();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -89,7 +89,7 @@ int main(void)
|
||||||
// this moves thigns at 10 world units per second, regardless of the actual FPS
|
// this moves thigns at 10 world units per second, regardless of the actual FPS
|
||||||
float offsetThisFrame = 10.0f*GetFrameTime();
|
float offsetThisFrame = 10.0f*GetFrameTime();
|
||||||
|
|
||||||
// Move player 1 forward and backwards (no turning)
|
// Move Player1 forward and backwards (no turning)
|
||||||
if (IsKeyDown(KEY_W))
|
if (IsKeyDown(KEY_W))
|
||||||
{
|
{
|
||||||
cameraPlayer1.position.z += offsetThisFrame;
|
cameraPlayer1.position.z += offsetThisFrame;
|
||||||
|
|
@ -101,7 +101,7 @@ int main(void)
|
||||||
cameraPlayer1.target.z -= offsetThisFrame;
|
cameraPlayer1.target.z -= offsetThisFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move player 2 forward and backwards (no turning)
|
// Move Player2 forward and backwards (no turning)
|
||||||
if (IsKeyDown(KEY_UP))
|
if (IsKeyDown(KEY_UP))
|
||||||
{
|
{
|
||||||
cameraPlayer2.position.x += offsetThisFrame;
|
cameraPlayer2.position.x += offsetThisFrame;
|
||||||
|
|
@ -116,7 +116,7 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Draw player 1's view to the render texture
|
// Draw Player1 view to the render texture
|
||||||
BeginTextureMode(screenPlayer1);
|
BeginTextureMode(screenPlayer1);
|
||||||
ClearBackground(SKYBLUE);
|
ClearBackground(SKYBLUE);
|
||||||
BeginMode3D(cameraPlayer1);
|
BeginMode3D(cameraPlayer1);
|
||||||
|
|
@ -125,7 +125,7 @@ int main(void)
|
||||||
DrawText("PLAYER1 W/S to move", 0, 0, 20, RED);
|
DrawText("PLAYER1 W/S to move", 0, 0, 20, RED);
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
// Draw player 2's view to the render texture
|
// Draw Player2 view to the render texture
|
||||||
BeginTextureMode(screenPlayer2);
|
BeginTextureMode(screenPlayer2);
|
||||||
ClearBackground(SKYBLUE);
|
ClearBackground(SKYBLUE);
|
||||||
BeginMode3D(cameraPlayer2);
|
BeginMode3D(cameraPlayer2);
|
||||||
|
|
@ -134,7 +134,7 @@ int main(void)
|
||||||
DrawText("PLAYER2 UP/DOWN to move", 0, 0, 20, BLUE);
|
DrawText("PLAYER2 UP/DOWN to move", 0, 0, 20, BLUE);
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
// Draw both view render textures to the screen side by side
|
// Draw both views render textures to the screen side by side
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(BLACK);
|
ClearBackground(BLACK);
|
||||||
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
|
DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE);
|
||||||
|
|
@ -144,9 +144,9 @@ int main(void)
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadRenderTexture(screenPlayer1);
|
UnloadRenderTexture(screenPlayer1); // Unload render texture
|
||||||
UnloadRenderTexture(screenPlayer2);
|
UnloadRenderTexture(screenPlayer2); // Unload render texture
|
||||||
UnloadTexture(textureGrid);
|
UnloadTexture(textureGrid); // Unload texture
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,6 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
BeginTextureMode(target);
|
BeginTextureMode(target);
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
BeginVrStereoMode(config);
|
BeginVrStereoMode(config);
|
||||||
|
|
@ -122,13 +118,13 @@ int main(void)
|
||||||
EndVrStereoMode();
|
EndVrStereoMode();
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
BeginShaderMode(distortion);
|
BeginShaderMode(distortion);
|
||||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width,
|
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width,
|
||||||
(float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
|
(float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,28 +79,24 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
|
||||||
ClearBackground(BLACK);
|
|
||||||
|
|
||||||
// Draw everything in the render texture, note this will not be rendered on screen, yet
|
// Draw everything in the render texture, note this will not be rendered on screen, yet
|
||||||
BeginTextureMode(target);
|
BeginTextureMode(target);
|
||||||
|
|
||||||
ClearBackground(RAYWHITE); // Clear render texture background color
|
ClearBackground(RAYWHITE); // Clear render texture background color
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) DrawRectangle(0, (gameScreenHeight/10)*i, gameScreenWidth, gameScreenHeight/10, colors[i]);
|
for (int i = 0; i < 10; i++) DrawRectangle(0, (gameScreenHeight/10)*i, gameScreenWidth, gameScreenHeight/10, colors[i]);
|
||||||
|
|
||||||
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
|
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
|
||||||
|
|
||||||
DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN);
|
DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN);
|
||||||
DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW);
|
DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW);
|
||||||
|
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
// Draw RenderTexture2D to window, properly scaled
|
BeginDrawing();
|
||||||
|
ClearBackground(BLACK); // Clear screen background
|
||||||
|
|
||||||
|
// Draw render texture to screen, properly scaled
|
||||||
DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height },
|
DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height },
|
||||||
(Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5f, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5f,
|
(Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5f, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5f,
|
||||||
(float)gameScreenWidth*scale, (float)gameScreenHeight*scale }, (Vector2){ 0, 0 }, 0.0f, WHITE);
|
(float)gameScreenWidth*scale, (float)gameScreenHeight*scale }, (Vector2){ 0, 0 }, 0.0f, WHITE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,16 +41,18 @@
|
||||||
*
|
*
|
||||||
* raylib [core] example - Basic window
|
* raylib [core] example - Basic window
|
||||||
*
|
*
|
||||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
* This example has been created using raylib 3.8 (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) 2019 Ramon Santamaria (@raysan5)
|
* Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021 <user_name> (@<user_github>)
|
||||||
*
|
*
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,14 @@
|
||||||
#define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
#define RAYWHITE (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||||
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
|
#define DARKGRAY (Color){ 80, 80, 80, 255 } // Dark Gray
|
||||||
|
|
||||||
|
// Color, 4 components, R8G8B8A8 (32bit)
|
||||||
|
typedef struct Color {
|
||||||
|
unsigned char r; // Color red value
|
||||||
|
unsigned char g; // Color green value
|
||||||
|
unsigned char b; // Color blue value
|
||||||
|
unsigned char a; // Color alpha value
|
||||||
|
} Color;
|
||||||
|
|
||||||
// Camera type, defines a camera position/orientation in 3d space
|
// Camera type, defines a camera position/orientation in 3d space
|
||||||
typedef struct Camera {
|
typedef struct Camera {
|
||||||
Vector3 position; // Camera position
|
Vector3 position; // Camera position
|
||||||
|
|
|
||||||
|
|
@ -86,38 +86,29 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
BeginTextureMode(target); // Enable drawing to texture
|
BeginTextureMode(target); // Enable drawing to texture
|
||||||
|
|
||||||
ClearBackground(RAYWHITE); // Clear texture background
|
ClearBackground(RAYWHITE); // Clear texture background
|
||||||
|
|
||||||
BeginMode3D(camera); // Begin 3d mode drawing
|
BeginMode3D(camera); // Begin 3d mode drawing
|
||||||
|
|
||||||
DrawModel(model, position, 0.5f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 0.5f, WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode
|
EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode
|
||||||
|
|
||||||
DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RED);
|
DrawText("TEXT DRAWN IN RENDER TEXTURE", 200, 10, 30, RED);
|
||||||
|
|
||||||
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
||||||
|
|
||||||
BeginShaderMode(shader);
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE); // Clear screen background
|
||||||
|
|
||||||
|
// Enable shader using the custom uniform
|
||||||
|
BeginShaderMode(shader);
|
||||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
||||||
|
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
// Draw some 2d text over drawn texture
|
// Draw some 2d text over drawn texture
|
||||||
DrawText("(c) Barracks 3D model by Alberto Cano", screenWidth - 220, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Barracks 3D model by Alberto Cano", screenWidth - 220, screenHeight - 20, 10, GRAY);
|
||||||
|
|
||||||
DrawFPS(10, 10);
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,6 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
BeginTextureMode(target); // Enable drawing to texture
|
BeginTextureMode(target); // Enable drawing to texture
|
||||||
ClearBackground(BLACK); // Clear the render texture
|
ClearBackground(BLACK); // Clear the render texture
|
||||||
|
|
||||||
|
|
@ -73,11 +69,13 @@ int main(void)
|
||||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK);
|
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK);
|
||||||
EndTextureMode(); // End drawing to texture (now we have a blank texture available for the shader)
|
EndTextureMode(); // End drawing to texture (now we have a blank texture available for the shader)
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(RAYWHITE); // Clear screen background
|
||||||
|
|
||||||
BeginShaderMode(shader);
|
BeginShaderMode(shader);
|
||||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
|
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +83,7 @@ int main(void)
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
UnloadShader(shader); // Unload shader
|
UnloadShader(shader); // Unload shader
|
||||||
UnloadRenderTexture(target); // Unload texture
|
UnloadRenderTexture(target); // Unload render texture
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -145,10 +145,6 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(BLACK); // Clear the screen of the previous frame.
|
|
||||||
|
|
||||||
// Using a render texture to draw Julia set
|
// Using a render texture to draw Julia set
|
||||||
BeginTextureMode(target); // Enable drawing to texture
|
BeginTextureMode(target); // Enable drawing to texture
|
||||||
ClearBackground(BLACK); // Clear the render texture
|
ClearBackground(BLACK); // Clear the render texture
|
||||||
|
|
@ -160,6 +156,9 @@ int main(void)
|
||||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK);
|
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK);
|
||||||
EndTextureMode();
|
EndTextureMode();
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
ClearBackground(BLACK); // Clear screen background
|
||||||
|
|
||||||
// Draw the saved texture and rendered julia set with shader
|
// Draw the saved texture and rendered julia set with shader
|
||||||
// NOTE: We do not invert texture on Y, already considered inside shader
|
// NOTE: We do not invert texture on Y, already considered inside shader
|
||||||
BeginShaderMode(shader);
|
BeginShaderMode(shader);
|
||||||
|
|
@ -176,7 +175,6 @@ int main(void)
|
||||||
DrawText("Press KEY_LEFT | KEY_RIGHT to change speed", 10, 60, 10, RAYWHITE);
|
DrawText("Press KEY_LEFT | KEY_RIGHT to change speed", 10, 60, 10, RAYWHITE);
|
||||||
DrawText("Press KEY_SPACE to pause movement animation", 10, 75, 10, RAYWHITE);
|
DrawText("Press KEY_SPACE to pause movement animation", 10, 75, 10, RAYWHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,50 +124,38 @@ int main(void)
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
|
|
||||||
BeginTextureMode(target); // Enable drawing to texture
|
BeginTextureMode(target); // Enable drawing to texture
|
||||||
|
|
||||||
ClearBackground(RAYWHITE); // Clear texture background
|
ClearBackground(RAYWHITE); // Clear texture background
|
||||||
|
|
||||||
BeginMode3D(camera); // Begin 3d mode drawing
|
BeginMode3D(camera); // Begin 3d mode drawing
|
||||||
|
|
||||||
DrawModel(model, position, 0.1f, WHITE); // Draw 3d model with texture
|
DrawModel(model, position, 0.1f, WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode
|
EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode
|
||||||
|
|
||||||
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
||||||
|
|
||||||
// Render previously generated texture using selected postpro shader
|
BeginDrawing();
|
||||||
BeginShaderMode(shaders[currentShader]);
|
ClearBackground(RAYWHITE); // Clear screen background
|
||||||
|
|
||||||
|
// Render generated texture using selected postprocessing shader
|
||||||
|
BeginShaderMode(shaders[currentShader]);
|
||||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
||||||
|
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
// Draw 2d shapes and text over drawn texture
|
// Draw 2d shapes and text over drawn texture
|
||||||
DrawRectangle(0, 9, 580, 30, Fade(LIGHTGRAY, 0.7f));
|
DrawRectangle(0, 9, 580, 30, Fade(LIGHTGRAY, 0.7f));
|
||||||
|
|
||||||
DrawText("(c) Church 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
DrawText("(c) Church 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
|
||||||
|
|
||||||
DrawText("CURRENT POSTPRO SHADER:", 10, 15, 20, BLACK);
|
DrawText("CURRENT POSTPRO SHADER:", 10, 15, 20, BLACK);
|
||||||
DrawText(postproShaderText[currentShader], 330, 15, 20, RED);
|
DrawText(postproShaderText[currentShader], 330, 15, 20, RED);
|
||||||
DrawText("< >", 540, 10, 30, DARKBLUE);
|
DrawText("< >", 540, 10, 30, DARKBLUE);
|
||||||
|
|
||||||
DrawFPS(700, 15);
|
DrawFPS(700, 15);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Unload all postpro shaders
|
// Unload all postpro shaders
|
||||||
for (int i = 0; i < MAX_POSTPRO_SHADERS; i++) UnloadShader(shaders[i]);
|
for (int i = 0; i < MAX_POSTPRO_SHADERS; i++) UnloadShader(shaders[i]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -533,7 +533,7 @@ void DrawText3D(Font font, const char *text, Vector3 position, float fontSize, f
|
||||||
{
|
{
|
||||||
// Get next codepoint from byte string and glyph index in font
|
// Get next codepoint from byte string and glyph index in font
|
||||||
int codepointByteCount = 0;
|
int codepointByteCount = 0;
|
||||||
int codepoint = GetNextCodepoint(&text[i], &codepointByteCount);
|
int codepoint = GetCodepoint(&text[i], &codepointByteCount);
|
||||||
int index = GetGlyphIndex(font, codepoint);
|
int index = GetGlyphIndex(font, codepoint);
|
||||||
|
|
||||||
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||||
|
|
@ -582,7 +582,7 @@ Vector3 MeasureText3D(Font font, const char* text, float fontSize, float fontSpa
|
||||||
lenCounter++;
|
lenCounter++;
|
||||||
|
|
||||||
int next = 0;
|
int next = 0;
|
||||||
letter = GetNextCodepoint(&text[i], &next);
|
letter = GetCodepoint(&text[i], &next);
|
||||||
index = GetGlyphIndex(font, letter);
|
index = GetGlyphIndex(font, letter);
|
||||||
|
|
||||||
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||||
|
|
@ -632,7 +632,7 @@ void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSiz
|
||||||
{
|
{
|
||||||
// Get next codepoint from byte string and glyph index in font
|
// Get next codepoint from byte string and glyph index in font
|
||||||
int codepointByteCount = 0;
|
int codepointByteCount = 0;
|
||||||
int codepoint = GetNextCodepoint(&text[i], &codepointByteCount);
|
int codepoint = GetCodepoint(&text[i], &codepointByteCount);
|
||||||
int index = GetGlyphIndex(font, codepoint);
|
int index = GetGlyphIndex(font, codepoint);
|
||||||
|
|
||||||
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||||
|
|
@ -649,7 +649,7 @@ void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSiz
|
||||||
}
|
}
|
||||||
else if (codepoint == '~')
|
else if (codepoint == '~')
|
||||||
{
|
{
|
||||||
if (GetNextCodepoint(&text[i+1], &codepointByteCount) == '~')
|
if (GetCodepoint(&text[i+1], &codepointByteCount) == '~')
|
||||||
{
|
{
|
||||||
codepointByteCount += 1;
|
codepointByteCount += 1;
|
||||||
wave = !wave;
|
wave = !wave;
|
||||||
|
|
@ -698,7 +698,7 @@ Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, float fon
|
||||||
lenCounter++;
|
lenCounter++;
|
||||||
|
|
||||||
int next = 0;
|
int next = 0;
|
||||||
letter = GetNextCodepoint(&text[i], &next);
|
letter = GetCodepoint(&text[i], &next);
|
||||||
index = GetGlyphIndex(font, letter);
|
index = GetGlyphIndex(font, letter);
|
||||||
|
|
||||||
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||||
|
|
@ -708,7 +708,7 @@ Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, float fon
|
||||||
|
|
||||||
if (letter != '\n')
|
if (letter != '\n')
|
||||||
{
|
{
|
||||||
if(letter == '~' && GetNextCodepoint(&text[i+1], &next) == '~')
|
if (letter == '~' && GetCodepoint(&text[i+1], &next) == '~')
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ GenMeshTorus|Mesh|(float radius, float size, int radSeg, int sides);|
|
||||||
GenMeshKnot|Mesh|(float radius, float size, int radSeg, int sides);|
|
GenMeshKnot|Mesh|(float radius, float size, int radSeg, int sides);|
|
||||||
GenMeshHeightmap|Mesh|(Image heightmap, Vector3 size);|
|
GenMeshHeightmap|Mesh|(Image heightmap, Vector3 size);|
|
||||||
GenMeshCubicmap|Mesh|(Image cubicmap, Vector3 cubeSize);|
|
GenMeshCubicmap|Mesh|(Image cubicmap, Vector3 cubeSize);|
|
||||||
MeshBoundingBox|BoundingBox|(Mesh mesh);|
|
GetMeshBoundingBox|BoundingBox|(Mesh mesh);|
|
||||||
MeshTangents|void|(Mesh *mesh);|
|
MeshTangents|void|(Mesh *mesh);|
|
||||||
MeshBinormals|void|(Mesh *mesh);|
|
MeshBinormals|void|(Mesh *mesh);|
|
||||||
DrawModel|void|(Model model, Vector3 position, float scale, Color tint);|
|
DrawModel|void|(Model model, Vector3 position, float scale, Color tint);|
|
||||||
|
|
|
||||||
|
|
@ -1549,7 +1549,7 @@
|
||||||
</KeyWord>
|
</KeyWord>
|
||||||
|
|
||||||
<!-- Mesh manipulation functions -->
|
<!-- Mesh manipulation functions -->
|
||||||
<KeyWord name="MeshBoundingBox" func="yes">
|
<KeyWord name="GetMeshBoundingBox" func="yes">
|
||||||
<Overload retVal="BoundingBox" descr="Compute mesh bounding box limits">
|
<Overload retVal="BoundingBox" descr="Compute mesh bounding box limits">
|
||||||
<Param name="Mesh mesh" />
|
<Param name="Mesh mesh" />
|
||||||
</Overload>
|
</Overload>
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue