mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-07 11:58:13 +00:00
WARNING
: **NEW** raylib code CONVENTION: Comments do not end with '.'
This commit is contained in:
@@ -28,6 +28,10 @@ Some other conventions to follow:
|
||||
- **ALWAYS** initialize all defined variables.
|
||||
- **Do not use TABS**, use 4 spaces instead.
|
||||
- Avoid trailing spaces, please, avoid them
|
||||
- Comments always start with space + capital letter and never end with a '.', place them **before** the line(s) they refer to
|
||||
```c
|
||||
// This is a comment in raylib or raylib examples
|
||||
```
|
||||
- Control flow statements always are followed **by a space**:
|
||||
```c
|
||||
if (condition) value = 0;
|
||||
|
@@ -108,8 +108,6 @@ int main(void)
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Sample mouse input.
|
||||
mousePosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
|
||||
@@ -125,7 +123,7 @@ int main(void)
|
||||
// Compute two cycles to allow the buffer padding, simplifying any modulation, resampling, etc.
|
||||
if (frequency != oldFrequency)
|
||||
{
|
||||
// Compute wavelength. Limit size in both directions.
|
||||
// Compute wavelength. Limit size in both directions
|
||||
//int oldWavelength = waveLength;
|
||||
waveLength = (int)(22050/frequency);
|
||||
if (waveLength > MAX_SAMPLES/2) waveLength = MAX_SAMPLES/2;
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* 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.
|
||||
* config.h (it requires recompiling raylib). This way those steps are up to the user
|
||||
*
|
||||
* Note that enabling this flag invalidates some functions:
|
||||
* - GetFrameTime()
|
||||
|
@@ -43,7 +43,8 @@ int main(void)
|
||||
Camera2D screenSpaceCamera = { 0 }; // Smoothing camera
|
||||
screenSpaceCamera.zoom = 1.0f;
|
||||
|
||||
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); // This is where we'll draw all our objects.
|
||||
// Load render texture to draw all our objects
|
||||
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight);
|
||||
|
||||
Rectangle rec01 = { 70.0f, 35.0f, 20.0f, 20.0f };
|
||||
Rectangle rec02 = { 90.0f, 55.0f, 30.0f, 10.0f };
|
||||
|
@@ -6,30 +6,30 @@
|
||||
|
||||
1. File naming: <module>_<description> - Lower case filename, words separated by underscore,
|
||||
no more than 3-4 words in total to describe the example. <module> referes to the primary
|
||||
raylib module the example is more related with (code, shapes, textures, models, shaders, raudio).
|
||||
raylib module the example is more related with (code, shapes, textures, models, shaders, raudio)
|
||||
i.e: core_input_multitouch, shapes_lines_bezier, shaders_palette_switch
|
||||
|
||||
2. Follow below template structure, example info should list the module, the short description
|
||||
and the author of the example, twitter or github info could be also provided for the author.
|
||||
Short description should also be used on the title of the window.
|
||||
and the author of the example, twitter or github info could be also provided for the author
|
||||
Short description should also be used on the title of the window
|
||||
|
||||
3. Code should be organized by sections:[Initialization]- [Update] - [Draw] - [De-Initialization]
|
||||
Place your code between the dotted lines for every section, please don't mix update logic with drawing
|
||||
and remember to unload all loaded resources.
|
||||
and remember to unload all loaded resources
|
||||
|
||||
4. Code should follow raylib conventions: https://github.com/raysan5/raylib/wiki/raylib-coding-conventions
|
||||
Try to be very organized, using line-breaks appropiately.
|
||||
Try to be very organized, using line-breaks appropiately
|
||||
|
||||
5. Add comments to the specific parts of code the example is focus on.
|
||||
Don't abuse with comments, try to be clear and impersonal on the comments.
|
||||
5. Add comments to the specific parts of code the example is focus on
|
||||
Don't abuse with comments, try to be clear and impersonal on the comments
|
||||
|
||||
6. Try to keep the example simple, under 300 code lines if possible. Try to avoid external dependencies.
|
||||
Try to avoid defining functions outside the main(). Example should be as self-contained as possible.
|
||||
6. Try to keep the example simple, under 300 code lines if possible. Try to avoid external dependencies
|
||||
Try to avoid defining functions outside the main(). Example should be as self-contained as possible
|
||||
|
||||
7. About external resources, they should be placed in a [resources] folder and those resources
|
||||
should be open and free for use and distribution. Avoid propietary content.
|
||||
should be open and free for use and distribution. Avoid propietary content
|
||||
|
||||
8. Try to keep the example simple but with a creative touch.
|
||||
8. Try to keep the example simple but with a creative touch
|
||||
Simple but beautiful examples are more appealing to users!
|
||||
|
||||
9. In case of additional information is required, just come to raylib Discord channel: example-contributions
|
||||
@@ -37,7 +37,7 @@
|
||||
10. Have fun!
|
||||
|
||||
The following files should be updated when adding a new example, it's planned to create some
|
||||
script to automatize this process but not available yet.
|
||||
script to automatize this process but not available yet
|
||||
|
||||
- raylib/examples/<category>/<category>_example_name.c
|
||||
- raylib/examples/<category>/<category>_example_name.png
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* NOTE: To export a model from blender, make sure it is not posed, the vertices need to be
|
||||
* in the same position as they would be in edit mode and the scale of your models is
|
||||
* set to 0. Scaling can be done from the export menu.
|
||||
* set to 0. Scaling can be done from the export menu
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
@@ -40,7 +40,7 @@ int main(void)
|
||||
Vector3 billPositionStatic = { 0.0f, 2.0f, 0.0f }; // Position of static billboard
|
||||
Vector3 billPositionRotating = { 1.0f, 2.0f, 1.0f }; // Position of rotating billboard
|
||||
|
||||
// Entire billboard texture, source is used to take a segment from a larger texture.
|
||||
// Entire billboard texture, source is used to take a segment from a larger texture
|
||||
Rectangle source = { 0.0f, 0.0f, (float)bill.width, (float)bill.height };
|
||||
|
||||
// NOTE: Billboard locked on axis-Y
|
||||
@@ -54,7 +54,7 @@ int main(void)
|
||||
Vector2 origin = Vector2Scale(size, 0.5f);
|
||||
|
||||
// Distance is needed for the correct billboard draw order
|
||||
// Larger distance (further away from the camera) should be drawn prior to smaller distance.
|
||||
// Larger distance (further away from the camera) should be drawn prior to smaller distance
|
||||
float distanceStatic;
|
||||
float distanceRotating;
|
||||
float rotation = 0.0f;
|
||||
|
@@ -7,11 +7,11 @@
|
||||
* NOTE: raylib supports multiple models file formats:
|
||||
*
|
||||
* - OBJ > Text file format. Must include vertex position-texcoords-normals information,
|
||||
* if files references some .mtl materials file, it will be loaded (or try to).
|
||||
* if files references some .mtl materials file, it will be loaded (or try to)
|
||||
* - GLTF > Text/binary file format. Includes lot of information and it could
|
||||
* also reference external files, raylib will try loading mesh and materials data.
|
||||
* also reference external files, raylib will try loading mesh and materials data
|
||||
* - IQM > Binary file format. Includes mesh vertex data but also animation data,
|
||||
* raylib can load .iqm animations.
|
||||
* raylib can load .iqm animations
|
||||
* - VOX > Binary file format. MagikaVoxel mesh format:
|
||||
* https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt
|
||||
* - M3D > Binary file format. Model 3D format:
|
||||
|
@@ -119,7 +119,7 @@ int main(void)
|
||||
// without a -1, we would always draw a cube at the origin
|
||||
for (int i = 0; i < model.boneCount - 1; i++)
|
||||
{
|
||||
// By default the model is loaded in bind-pose by LoadModel().
|
||||
// By default the model is loaded in bind-pose by LoadModel()
|
||||
// But if UpdateModelAnimation() has been called at least once
|
||||
// then the model is already in animation pose, so we need the animated skeleton
|
||||
if (!animPlaying || !animsCount)
|
||||
|
@@ -221,10 +221,12 @@ int main(void)
|
||||
}
|
||||
|
||||
|
||||
// NoEase function, used when "no easing" is selected for any axis. It just ignores all parameters besides b.
|
||||
// NoEase function, used when "no easing" is selected for any axis
|
||||
// It just ignores all parameters besides b
|
||||
static float NoEase(float t, float b, float c, float d)
|
||||
{
|
||||
float burn = t + b + c + d; // Hack to avoid compiler warning (about unused variables)
|
||||
// Hack to avoid compiler warning (about unused variables)
|
||||
float burn = t + b + c + d;
|
||||
d += burn;
|
||||
|
||||
return b;
|
||||
|
@@ -16,13 +16,13 @@
|
||||
********************************************************************************************
|
||||
*
|
||||
* Mixes raylib and plain OpenGL code to draw a GL_POINTS based particle system. The
|
||||
* primary point is to demonstrate raylib and OpenGL interop.
|
||||
* primary point is to demonstrate raylib and OpenGL interop
|
||||
*
|
||||
* rlgl batched draw operations internally so we have to flush the current batch before
|
||||
* doing our own OpenGL work (rlDrawRenderBatchActive()).
|
||||
* doing our own OpenGL work (rlDrawRenderBatchActive())
|
||||
*
|
||||
* The example also demonstrates how to get the current model view projection matrix of
|
||||
* raylib. That way raylib cameras and so on work as expected.
|
||||
* raylib. That way raylib cameras and so on work as expected
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -87,13 +87,13 @@ int main(void)
|
||||
particles[i].x = (float)GetRandomValue(20, screenWidth - 20);
|
||||
particles[i].y = (float)GetRandomValue(50, screenHeight - 20);
|
||||
|
||||
// Give each particle a slightly different period. But don't spread it to much.
|
||||
// This way the particles line up every so often and you get a glimps of what is going on.
|
||||
// Give each particle a slightly different period. But don't spread it to much
|
||||
// This way the particles line up every so often and you get a glimps of what is going on
|
||||
particles[i].period = (float)GetRandomValue(10, 30)/10.0f;
|
||||
}
|
||||
|
||||
// Create a plain OpenGL vertex buffer with the data and an vertex array object
|
||||
// that feeds the data from the buffer into the vertexPosition shader attribute.
|
||||
// that feeds the data from the buffer into the vertexPosition shader attribute
|
||||
GLuint vao = 0;
|
||||
GLuint vbo = 0;
|
||||
glGenVertexArrays(1, &vao);
|
||||
|
@@ -23,11 +23,11 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
// IMPORTANT: This must match gol*.glsl GOL_WIDTH constant.
|
||||
// This must be a multiple of 16 (check golLogic compute dispatch).
|
||||
// IMPORTANT: This must match gol*.glsl GOL_WIDTH constant
|
||||
// This must be a multiple of 16 (check golLogic compute dispatch)
|
||||
#define GOL_WIDTH 768
|
||||
|
||||
// Maximum amount of queued draw commands (squares draw from mouse down events).
|
||||
// Maximum amount of queued draw commands (squares draw from mouse down events)
|
||||
#define MAX_BUFFERED_TRANSFERTS 48
|
||||
|
||||
// Game Of Life Update Command
|
||||
@@ -160,7 +160,7 @@ int main(void)
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Unload shader buffers objects.
|
||||
// Unload shader buffers objects
|
||||
rlUnloadShaderBuffer(ssboA);
|
||||
rlUnloadShaderBuffer(ssboB);
|
||||
rlUnloadShaderBuffer(ssboTransfert);
|
||||
|
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* Example originally created with raylib 1.6, last time updated with raylib 4.0
|
||||
*
|
||||
* WARNING: This example is intended only for PLATFORM_DESKTOP and OpenGL 3.3 Core profile.
|
||||
* WARNING: This example is intended only for PLATFORM_DESKTOP and OpenGL 3.3 Core profile
|
||||
* It could work on other platforms if redesigned for those platforms (out-of-scope)
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
@@ -48,7 +48,7 @@
|
||||
* 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.
|
||||
* 3. This notice may not be removed or altered from any source distribution
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
@@ -5,9 +5,9 @@
|
||||
* Example complexity rating: [★★★★] 4/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3).
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3)
|
||||
*
|
||||
* Example originally created with raylib 3.0, last time updated with raylib 4.2
|
||||
*
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
||||
|
@@ -99,44 +99,44 @@ int main(void)
|
||||
|
||||
// NOTE: Vertex positions are stored in a texture for simplicity. A better approach would use a depth texture
|
||||
// (instead of a detph renderbuffer) to reconstruct world positions in the final render shader via clip-space position,
|
||||
// depth, and the inverse view/projection matrices.
|
||||
// depth, and the inverse view/projection matrices
|
||||
|
||||
// 16-bit precision ensures OpenGL ES 3 compatibility, though it may lack precision for real scenarios.
|
||||
// 16-bit precision ensures OpenGL ES 3 compatibility, though it may lack precision for real scenarios
|
||||
// But as mentioned above, the positions could be reconstructed instead of stored. If not targeting OpenGL ES
|
||||
// and you wish to maintain this approach, consider using `RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32`.
|
||||
// and you wish to maintain this approach, consider using `RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32`
|
||||
gBuffer.positionTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1);
|
||||
|
||||
// Similarly, 16-bit precision is used for normals ensures OpenGL ES 3 compatibility.
|
||||
// This is generally sufficient, but a 16-bit fixed-point format offer a better uniform precision in all orientations.
|
||||
// Similarly, 16-bit precision is used for normals ensures OpenGL ES 3 compatibility
|
||||
// This is generally sufficient, but a 16-bit fixed-point format offer a better uniform precision in all orientations
|
||||
gBuffer.normalTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1);
|
||||
|
||||
// Albedo (diffuse color) and specular strength can be combined into one texture.
|
||||
// The color in RGB, and the specular strength in the alpha channel.
|
||||
// Albedo (diffuse color) and specular strength can be combined into one texture
|
||||
// The color in RGB, and the specular strength in the alpha channel
|
||||
gBuffer.albedoSpecTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1);
|
||||
|
||||
// Activate the draw buffers for our framebuffer
|
||||
rlActiveDrawBuffers(3);
|
||||
|
||||
// Now we attach our textures to the framebuffer.
|
||||
// Now we attach our textures to the framebuffer
|
||||
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.positionTexture, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D, 0);
|
||||
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.normalTexture, RL_ATTACHMENT_COLOR_CHANNEL1, RL_ATTACHMENT_TEXTURE2D, 0);
|
||||
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.albedoSpecTexture, RL_ATTACHMENT_COLOR_CHANNEL2, RL_ATTACHMENT_TEXTURE2D, 0);
|
||||
|
||||
// Finally we attach the depth buffer.
|
||||
// Finally we attach the depth buffer
|
||||
gBuffer.depthRenderbuffer = rlLoadTextureDepth(screenWidth, screenHeight, true);
|
||||
rlFramebufferAttach(gBuffer.framebuffer, gBuffer.depthRenderbuffer, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
|
||||
|
||||
// Make sure our framebuffer is complete.
|
||||
// Make sure our framebuffer is complete
|
||||
// NOTE: rlFramebufferComplete() automatically unbinds the framebuffer, so we don't have
|
||||
// to rlDisableFramebuffer() here.
|
||||
// to rlDisableFramebuffer() here
|
||||
if (!rlFramebufferComplete(gBuffer.framebuffer))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Framebuffer is not complete");
|
||||
}
|
||||
|
||||
// Now we initialize the sampler2D uniform's in the deferred shader.
|
||||
// Now we initialize the sampler2D uniform's in the deferred shader
|
||||
// We do this by setting the uniform's values to the texture units that
|
||||
// we later bind our g-buffer textures to.
|
||||
// we later bind our g-buffer textures to
|
||||
rlEnableShader(deferredShader.id);
|
||||
int texUnitPosition = 0;
|
||||
int texUnitNormal = 1;
|
||||
@@ -219,7 +219,7 @@ int main(void)
|
||||
rlDisableColorBlend();
|
||||
BeginMode3D(camera);
|
||||
// NOTE: We have to use rlEnableShader here. `BeginShaderMode` or thus `rlSetShader`
|
||||
// will not work, as they won't immediately load the shader program.
|
||||
// will not work, as they won't immediately load the shader program
|
||||
rlEnableShader(gbufferShader.id);
|
||||
// When drawing a model here, make sure that the material's shaders
|
||||
// are set to the gbuffer shader!
|
||||
@@ -236,7 +236,7 @@ int main(void)
|
||||
EndMode3D();
|
||||
rlEnableColorBlend();
|
||||
|
||||
// Go back to the default framebuffer (0) and draw our deferred shading.
|
||||
// Go back to the default framebuffer (0) and draw our deferred shading
|
||||
rlDisableFramebuffer();
|
||||
rlClearScreenBuffers(); // Clear color & depth buffer
|
||||
|
||||
@@ -264,7 +264,7 @@ int main(void)
|
||||
rlEnableColorBlend();
|
||||
EndMode3D();
|
||||
|
||||
// As a last step, we now copy over the depth buffer from our g-buffer to the default framebuffer.
|
||||
// As a last step, we now copy over the depth buffer from our g-buffer to the default framebuffer
|
||||
rlBindFramebuffer(RL_READ_FRAMEBUFFER, gBuffer.framebuffer);
|
||||
rlBindFramebuffer(RL_DRAW_FRAMEBUFFER, 0);
|
||||
rlBlitFramebuffer(0, 0, screenWidth, screenHeight, 0, 0, screenWidth, screenHeight, 0x00000100); // GL_DEPTH_BUFFER_BIT
|
||||
|
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: Sieve of Eratosthenes, the earliest known (ancient Greek) prime number sieve.
|
||||
* NOTE: Sieve of Eratosthenes, the earliest known (ancient Greek) prime number sieve
|
||||
*
|
||||
* "Sift the twos and sift the threes,
|
||||
* The Sieve of Eratosthenes.
|
||||
@@ -12,9 +12,9 @@
|
||||
* the numbers that are left are prime."
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3).
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3)
|
||||
*
|
||||
* Example originally created with raylib 2.5, last time updated with raylib 4.0
|
||||
*
|
||||
|
@@ -5,9 +5,9 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3).
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3)
|
||||
*
|
||||
* Example originally created with raylib 2.5, last time updated with raylib 3.7
|
||||
*
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330
|
||||
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment.
|
||||
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment
|
||||
*
|
||||
* Example originally created with raylib 3.0, last time updated with raylib 3.5
|
||||
*
|
||||
|
@@ -61,15 +61,15 @@ int main(void)
|
||||
// You are required to write depth for all shaders if one shader does it
|
||||
Shader shdrRaster = LoadShader(0, TextFormat("resources/shaders/glsl%i/hybrid_raster.fs", GLSL_VERSION));
|
||||
|
||||
// Declare Struct used to store camera locs.
|
||||
// Declare Struct used to store camera locs
|
||||
RayLocs marchLocs = {0};
|
||||
|
||||
// Fill the struct with shader locs.
|
||||
// Fill the struct with shader locs
|
||||
marchLocs.camPos = GetShaderLocation(shdrRaymarch, "camPos");
|
||||
marchLocs.camDir = GetShaderLocation(shdrRaymarch, "camDir");
|
||||
marchLocs.screenCenter = GetShaderLocation(shdrRaymarch, "screenCenter");
|
||||
|
||||
// Transfer screenCenter position to shader. Which is used to calculate ray direction.
|
||||
// Transfer screenCenter position to shader. Which is used to calculate ray direction
|
||||
Vector2 screenCenter = {.x = screenWidth/2.0f, .y = screenHeight/2.0f};
|
||||
SetShaderValue(shdrRaymarch, marchLocs.screenCenter , &screenCenter , SHADER_UNIFORM_VEC2);
|
||||
|
||||
@@ -85,7 +85,7 @@ int main(void)
|
||||
.projection = CAMERA_PERSPECTIVE // Camera projection type
|
||||
};
|
||||
|
||||
// Camera FOV is pre-calculated in the camera Distance.
|
||||
// Camera FOV is pre-calculated in the camera distance
|
||||
float camDist = 1.0f/(tanf(camera.fovy*0.5f*DEG2RAD));
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
@@ -98,10 +98,10 @@ int main(void)
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera, CAMERA_ORBITAL);
|
||||
|
||||
// Update Camera Postion in the ray march shader.
|
||||
// Update Camera Postion in the ray march shader
|
||||
SetShaderValue(shdrRaymarch, marchLocs.camPos, &(camera.position), RL_SHADER_UNIFORM_VEC3);
|
||||
|
||||
// Update Camera Looking Vector. Vector length determines FOV.
|
||||
// Update Camera Looking Vector. Vector length determines FOV
|
||||
Vector3 camDir = Vector3Scale( Vector3Normalize( Vector3Subtract(camera.target, camera.position)) , camDist);
|
||||
SetShaderValue(shdrRaymarch, marchLocs.camDir, &(camDir), RL_SHADER_UNIFORM_VEC3);
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -113,7 +113,7 @@ int main(void)
|
||||
ClearBackground(WHITE);
|
||||
|
||||
// Raymarch Scene
|
||||
rlEnableDepthTest(); //Manually enable Depth Test to handle multiple rendering methods.
|
||||
rlEnableDepthTest(); // Manually enable Depth Test to handle multiple rendering methods
|
||||
BeginShaderMode(shdrRaymarch);
|
||||
DrawRectangleRec((Rectangle){0,0, (float)screenWidth, (float)screenHeight},WHITE);
|
||||
EndShaderMode();
|
||||
|
@@ -5,9 +5,9 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3).
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3)
|
||||
*
|
||||
* Example originally created with raylib 2.5, last time updated with raylib 4.0
|
||||
*
|
||||
@@ -109,7 +109,7 @@ int main(void)
|
||||
SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);
|
||||
}
|
||||
|
||||
// If "R" is pressed, reset zoom and offset.
|
||||
// If "R" is pressed, reset zoom and offset
|
||||
if (IsKeyPressed(KEY_R))
|
||||
{
|
||||
zoom = startingZoom;
|
||||
@@ -125,17 +125,16 @@ int main(void)
|
||||
if (IsKeyPressed(KEY_RIGHT)) incrementSpeed++;
|
||||
else if (IsKeyPressed(KEY_LEFT)) incrementSpeed--;
|
||||
|
||||
// If either left or right button is pressed, zoom in/out.
|
||||
// If either left or right button is pressed, zoom in/out
|
||||
if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) || IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
|
||||
{
|
||||
// Change zoom. If Mouse left -> zoom in. Mouse right -> zoom out.
|
||||
// Change zoom. If Mouse left -> zoom in. Mouse right -> zoom out
|
||||
zoom *= IsMouseButtonDown(MOUSE_BUTTON_LEFT)? zoomSpeed : 1.0f/zoomSpeed;
|
||||
|
||||
const Vector2 mousePos = GetMousePosition();
|
||||
Vector2 offsetVelocity;
|
||||
// Find the velocity at which to change the camera. Take the distance of the mouse
|
||||
// from the center of the screen as the direction, and adjust magnitude based on
|
||||
// the current zoom.
|
||||
// from the center of the screen as the direction, and adjust magnitude based on the current zoom
|
||||
offsetVelocity.x = (mousePos.x/(float)screenWidth - 0.5f)*offsetSpeedMul/zoom;
|
||||
offsetVelocity.y = (mousePos.y/(float)screenHeight - 0.5f)*offsetSpeedMul/zoom;
|
||||
|
||||
|
@@ -5,9 +5,9 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3).
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3)
|
||||
*
|
||||
* Example originally created with raylib 4.5, last time updated with raylib 4.5
|
||||
*
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★★★] 4/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* Example originally created with raylib 5.6, last time updated with raylib 5.6
|
||||
*
|
||||
@@ -79,7 +79,7 @@ int main(void)
|
||||
SetTextureFilter(plane.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture, TEXTURE_FILTER_TRILINEAR);
|
||||
SetTextureFilter(plane.materials[0].maps[MATERIAL_MAP_NORMAL].texture, TEXTURE_FILTER_TRILINEAR);
|
||||
|
||||
// Specular exponent AKA shininess of the material.
|
||||
// Specular exponent AKA shininess of the material
|
||||
float specularExponent = 8.0f;
|
||||
int specularExponentLoc = GetShaderLocation(shader, "specularExponent");
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★★★] 4/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330
|
||||
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment.
|
||||
* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment
|
||||
*
|
||||
* Example originally created with raylib 2.0, last time updated with raylib 4.2
|
||||
*
|
||||
|
@@ -44,7 +44,7 @@ int main(void)
|
||||
SetConfigFlags(FLAG_MSAA_4X_HINT);
|
||||
// Shadows are a HUGE topic, and this example shows an extremely simple implementation of the shadowmapping algorithm,
|
||||
// which is the industry standard for shadows. This algorithm can be extended in a ridiculous number of ways to improve
|
||||
// realism and also adapt it for different scenes. This is pretty much the simplest possible implementation.
|
||||
// realism and also adapt it for different scenes. This is pretty much the simplest possible implementation
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shadowmap");
|
||||
|
||||
Camera3D cam = (Camera3D){ 0 };
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
||||
|
@@ -20,13 +20,13 @@
|
||||
*
|
||||
* The right hand side of the screen there is just enough light to see whats
|
||||
* going on without the spot light, great for a stealth type game where you
|
||||
* have to avoid the spotlights.
|
||||
* have to avoid the spotlights
|
||||
*
|
||||
* The left hand side of the screen is in pitch dark except for where the spotlights are.
|
||||
* The left hand side of the screen is in pitch dark except for where the spotlights are
|
||||
*
|
||||
* Although this example doesn't scale like the letterbox example, you could integrate
|
||||
* the two techniques, but by scaling the actual colour of the render texture rather
|
||||
* than using alpha as a mask.
|
||||
* than using alpha as a mask
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
@@ -115,7 +115,7 @@ int main(void)
|
||||
}
|
||||
|
||||
// Tell the shader how wide the screen is so we can have
|
||||
// a pitch black half and a dimly lit half.
|
||||
// a pitch black half and a dimly lit half
|
||||
unsigned int wLoc = GetShaderLocation(shdrSpot, "screenWidth");
|
||||
float sw = (float)GetScreenWidth();
|
||||
SetShaderValue(shdrSpot, wLoc, &sw, SHADER_UNIFORM_FLOAT);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* Example originally created with raylib 4.0, last time updated with raylib 4.0
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
* Example demonstrates how to tile a texture on a 3D model using raylib.
|
||||
* Example demonstrates how to tile a texture on a 3D model using raylib
|
||||
*
|
||||
* Example originally created with raylib 4.5, last time updated with raylib 4.5
|
||||
*
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★☆☆] 2/4
|
||||
*
|
||||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support,
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version.
|
||||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version
|
||||
*
|
||||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example
|
||||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Example complexity rating: [★★★☆] 3/4
|
||||
*
|
||||
* NOTE: This example requires 'easings.h' library, provided on raylib/src. Just copy
|
||||
* the library to same directory as example or make sure it's available on include path.
|
||||
* the library to same directory as example or make sure it's available on include path
|
||||
*
|
||||
* Example originally created with raylib 2.0, last time updated with raylib 2.5
|
||||
*
|
||||
|
@@ -265,10 +265,10 @@ static void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, fl
|
||||
rlSetTexture(0);
|
||||
#else
|
||||
|
||||
// Here we use the 'Diagram' to guide ourselves to which point receives what color.
|
||||
// Here we use the 'Diagram' to guide ourselves to which point receives what color
|
||||
// By choosing the color correctly associated with a pointe the gradient effect
|
||||
// will naturally come from OpenGL interpolation.
|
||||
// But this time instead of Quad, we think in triangles.
|
||||
// will naturally come from OpenGL interpolation
|
||||
// But this time instead of Quad, we think in triangles
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
// Draw all of the 4 corners: [1] Upper Left Corner, [3] Upper Right Corner, [5] Lower Right Corner, [7] Lower Left Corner
|
||||
|
@@ -39,7 +39,7 @@ int main(void)
|
||||
InitWindow(screenWidth, screenHeight, "raylib [text] example - codepoints loading");
|
||||
|
||||
// Convert each utf-8 character into its
|
||||
// corresponding codepoint in the font file.
|
||||
// corresponding codepoint in the font file
|
||||
int codepointCount = 0;
|
||||
int *codepoints = LoadCodepoints(text, &codepointCount);
|
||||
|
||||
|
@@ -6,12 +6,12 @@
|
||||
*
|
||||
* NOTE: Draw a 2D text in 3D space, each letter is drawn in a quad (or 2 quads if backface is set)
|
||||
* where the texture coodinates of each quad map to the texture coordinates of the glyphs
|
||||
* inside the font texture.
|
||||
* inside the font texture
|
||||
*
|
||||
* A more efficient approach, i believe, would be to render the text in a render texture and
|
||||
* map that texture to a plane and render that, or maybe a shader but my method allows more
|
||||
* flexibility...for example to change position of each letter individually to make somethink
|
||||
* like a wavy text effect.
|
||||
* like a wavy text effect
|
||||
*
|
||||
* Special thanks to:
|
||||
* @Nighten for the DrawTextStyle() code https://github.com/NightenDushi/Raylib_DrawTextStyle
|
||||
@@ -71,7 +71,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font
|
||||
// Draw a 2D text in 3D space and wave the parts that start with '~~' and end with '~~'
|
||||
// This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle
|
||||
static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig *config, float time, Color tint);
|
||||
// Measure a text in 3D ignoring the `~~` chars.
|
||||
// Measure a text in 3D ignoring the `~~` chars
|
||||
static Vector3 MeasureTextWave3D(Font font, const char *text, float fontSize, float fontSpacing, float lineSpacing);
|
||||
// Generates a nice color with a random hue
|
||||
static Color GenerateRandomColor(float s, float v);
|
||||
@@ -562,7 +562,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`.
|
||||
// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`
|
||||
// This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle
|
||||
static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig* config, float time, Color tint)
|
||||
{
|
||||
@@ -625,7 +625,7 @@ static void DrawTextWave3D(Font font, const char *text, Vector3 position, float
|
||||
}
|
||||
}
|
||||
|
||||
// Measure a text in 3D ignoring the `~~` chars.
|
||||
// Measure a text in 3D ignoring the `~~` chars
|
||||
static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, float fontSpacing, float lineSpacing)
|
||||
{
|
||||
int len = TextLength(text);
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* - Rectangles must be defined by a MAGENTA color background
|
||||
*
|
||||
* Following those constraints, a font can be provided just by an image,
|
||||
* this is quite handy to avoid additional font descriptor files (like BMFonts use).
|
||||
* this is quite handy to avoid additional font descriptor files (like BMFonts use)
|
||||
*
|
||||
* Example originally created with raylib 1.0, last time updated with raylib 1.0
|
||||
*
|
||||
|
@@ -63,7 +63,7 @@ int main(void)
|
||||
if ((key >= 32) && (key <= 125) && (letterCount < MAX_INPUT_CHARS))
|
||||
{
|
||||
name[letterCount] = (char)key;
|
||||
name[letterCount+1] = '\0'; // Add null terminator at the end of the string.
|
||||
name[letterCount+1] = '\0'; // Add null terminator at the end of the string
|
||||
letterCount++;
|
||||
}
|
||||
|
||||
|
@@ -179,9 +179,9 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
|
||||
|
||||
// NOTE: When wordWrap is ON we first measure how much of the text we can draw before going outside of the rec container
|
||||
// We store this info in startLine and endLine, then we change states, draw the text between those two variables
|
||||
// and change states again and again recursively until the end of the text (or until we get outside of the container).
|
||||
// and change states again and again recursively until the end of the text (or until we get outside of the container)
|
||||
// When wordWrap is OFF we don't need the measure state so we go to the drawing state immediately
|
||||
// and begin drawing on the next line before we can get outside the container.
|
||||
// and begin drawing on the next line before we can get outside the container
|
||||
if (state == MEASURE_STATE)
|
||||
{
|
||||
// TODO: There are multiple types of spaces in UNICODE, maybe it's a good idea to add support for more
|
||||
|
@@ -378,9 +378,9 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec,
|
||||
|
||||
// NOTE: When wordWrap is ON we first measure how much of the text we can draw before going outside of the rec container
|
||||
// We store this info in startLine and endLine, then we change states, draw the text between those two variables
|
||||
// and change states again and again recursively until the end of the text (or until we get outside of the container).
|
||||
// and change states again and again recursively until the end of the text (or until we get outside of the container)
|
||||
// When wordWrap is OFF we don't need the measure state so we go to the drawing state immediately
|
||||
// and begin drawing on the next line before we can get outside the container.
|
||||
// and begin drawing on the next line before we can get outside the container
|
||||
if (state == MEASURE_STATE)
|
||||
{
|
||||
// TODO: There are multiple types of spaces in UNICODE, maybe it's a good idea to add support for more
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#define MARGIN_SIZE 8 // Size for the margins
|
||||
#define COLOR_SIZE 16 // Size of the color select buttons
|
||||
|
||||
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
|
||||
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest
|
||||
void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint);
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
@@ -173,7 +173,7 @@ int main(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest.
|
||||
// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest
|
||||
void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint)
|
||||
{
|
||||
if ((texture.id <= 0) || (scale <= 0.0f)) return; // Wanna see a infinite loop?!...just delete this line!
|
||||
|
@@ -75,9 +75,9 @@ int main(void)
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
// Draw
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO...
|
||||
// Nothing to update...
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
@@ -71,7 +71,7 @@ int main(void)
|
||||
// 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.
|
||||
// NOTE: When a particle disappears, active = false and it can be reused
|
||||
for (int i = 0; i < MAX_PARTICLES; i++)
|
||||
{
|
||||
if (!mouseTail[i].active)
|
||||
|
6
src/external/rl_gputex.h
vendored
6
src/external/rl_gputex.h
vendored
@@ -5,10 +5,10 @@
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* Load GPU compressed image data from image files provided as memory data arrays,
|
||||
* data is loaded compressed, ready to be loaded into GPU.
|
||||
* data is loaded compressed, ready to be loaded into GPU
|
||||
*
|
||||
* Note that some file formats (DDS, PVR, KTX) also support uncompressed data storage.
|
||||
* In those cases data is loaded uncompressed and format is returned.
|
||||
* In those cases data is loaded uncompressed and format is returned
|
||||
*
|
||||
* FIXME: This library still depends on Raylib due to the following reasons:
|
||||
* - rl_save_ktx_to_memory() requires rlGetGlTextureFormats() from rlgl.h
|
||||
@@ -436,7 +436,7 @@ void *rl_load_pkm_from_memory(const unsigned char *file_data, unsigned int file_
|
||||
// version 10: format: 0=ETC1_RGB, [1=ETC1_RGBA, 2=ETC1_RGB_MIP, 3=ETC1_RGBA_MIP] (not used)
|
||||
// version 20: format: 0=ETC1_RGB, 1=ETC2_RGB, 2=ETC2_RGBA_OLD, 3=ETC2_RGBA, 4=ETC2_RGBA1, 5=ETC2_R, 6=ETC2_RG, 7=ETC2_SIGNED_R, 8=ETC2_SIGNED_R
|
||||
|
||||
// NOTE: The extended width and height are the widths rounded up to a multiple of 4.
|
||||
// NOTE: The extended width and height are the widths rounded up to a multiple of 4
|
||||
// NOTE: ETC is always 4bit per pixel (64 bit for each 4x4 block of pixels)
|
||||
|
||||
if (file_data_ptr != RL_GPUTEX_NULL)
|
||||
|
@@ -724,7 +724,7 @@ void *GetWindowHandle(void)
|
||||
return glfwGetWin32Window(platform.handle);
|
||||
#endif
|
||||
#if defined(__linux__)
|
||||
// Store the window handle localy and return a pointer to the variable instead.
|
||||
// Store the window handle localy and return a pointer to the variable instead
|
||||
// Reasoning detailed in the declaration of X11WindowHandle
|
||||
X11WindowHandle = glfwGetX11Window(platform.handle);
|
||||
return &X11WindowHandle;
|
||||
@@ -1066,9 +1066,9 @@ double GetTime(void)
|
||||
}
|
||||
|
||||
// Open URL with default system browser (if available)
|
||||
// NOTE: This function is only safe to use if you control the URL given.
|
||||
// A user could craft a malicious string performing another action.
|
||||
// Only call this function yourself not with user input or make sure to check the string yourself.
|
||||
// NOTE: This function is only safe to use if you control the URL given
|
||||
// A user could craft a malicious string performing another action
|
||||
// Only call this function yourself not with user input or make sure to check the string yourself
|
||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
||||
void OpenURL(const char *url)
|
||||
{
|
||||
@@ -1130,7 +1130,7 @@ void SetMouseCursor(int cursor)
|
||||
}
|
||||
}
|
||||
|
||||
// Get physical key name.
|
||||
// Get physical key name
|
||||
const char *GetKeyName(int key)
|
||||
{
|
||||
return glfwGetKeyName(key, glfwGetKeyScancode(key));
|
||||
@@ -1306,8 +1306,8 @@ static void SetDimensionsFromMonitor(GLFWmonitor *monitor)
|
||||
}
|
||||
|
||||
// Function wrappers around RL_*alloc macros, used by glfwInitAllocator() inside of InitPlatform()
|
||||
// We need to provide these because GLFWallocator expects function pointers with specific signatures.
|
||||
// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch.
|
||||
// We need to provide these because GLFWallocator expects function pointers with specific signatures
|
||||
// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch
|
||||
// https://www.glfw.org/docs/latest/intro_guide.html#init_allocator
|
||||
static void *AllocateWrapper(size_t size, void *user)
|
||||
{
|
||||
@@ -1394,14 +1394,14 @@ int InitPlatform(void)
|
||||
// HACK: Most of this was written before GLFW_SCALE_FRAMEBUFFER existed and
|
||||
// was enabled by default. Disabling it gets back the old behavior. A
|
||||
// complete fix will require removing a lot of CORE.Window.render
|
||||
// manipulation code.
|
||||
// manipulation code
|
||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
|
||||
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
||||
{
|
||||
// Resize window content area based on the monitor content scale.
|
||||
// NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11.
|
||||
// On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
|
||||
// Resize window content area based on the monitor content scale
|
||||
// NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11
|
||||
// On platforms like macOS the resolution of the framebuffer is changed independently of the window size
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); // Scale content area based on the monitor content scale where window is placed on
|
||||
#if defined(__APPLE__)
|
||||
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
||||
@@ -1421,8 +1421,8 @@ int InitPlatform(void)
|
||||
}
|
||||
|
||||
// NOTE: When asking for an OpenGL context version, most drivers provide the highest supported version
|
||||
// with backward compatibility to older OpenGL versions.
|
||||
// For example, if using OpenGL 1.1, driver can provide a 4.3 backwards compatible context.
|
||||
// with backward compatibility to older OpenGL versions
|
||||
// For example, if using OpenGL 1.1, driver can provide a 4.3 backwards compatible context
|
||||
|
||||
// Check selection OpenGL version
|
||||
if (rlGetVersion() == RL_OPENGL_21)
|
||||
@@ -1468,9 +1468,9 @@ int InitPlatform(void)
|
||||
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
|
||||
}
|
||||
|
||||
// NOTE: GLFW 3.4+ defers initialization of the Joystick subsystem on the first call to any Joystick related functions.
|
||||
// Forcing this initialization here avoids doing it on PollInputEvents() called by EndDrawing() after first frame has been just drawn.
|
||||
// The initialization will still happen and possible delays still occur, but before the window is shown, which is a nicer experience.
|
||||
// NOTE: GLFW 3.4+ defers initialization of the Joystick subsystem on the first call to any Joystick related functions
|
||||
// Forcing this initialization here avoids doing it on PollInputEvents() called by EndDrawing() after first frame has been just drawn
|
||||
// The initialization will still happen and possible delays still occur, but before the window is shown, which is a nicer experience
|
||||
// REF: https://github.com/raysan5/raylib/issues/1554
|
||||
glfwSetJoystickCallback(NULL);
|
||||
|
||||
@@ -1478,7 +1478,7 @@ int InitPlatform(void)
|
||||
if (CORE.Window.fullscreen)
|
||||
{
|
||||
// According to glfwCreateWindow(), if the user does not have a choice, fullscreen applications
|
||||
// should default to the primary monitor.
|
||||
// should default to the primary monitor
|
||||
|
||||
monitor = glfwGetPrimaryMonitor();
|
||||
if (!monitor)
|
||||
@@ -1492,8 +1492,8 @@ int InitPlatform(void)
|
||||
// Remember center for switching from fullscreen to window
|
||||
if ((CORE.Window.screen.height == CORE.Window.display.height) && (CORE.Window.screen.width == CORE.Window.display.width))
|
||||
{
|
||||
// If screen width/height equal to the display, we can't calculate the window pos for toggling full-screened/windowed.
|
||||
// Toggling full-screened/windowed with pos(0, 0) can cause problems in some platforms, such as X11.
|
||||
// If screen width/height equal to the display, we can't calculate the window pos for toggling full-screened/windowed
|
||||
// Toggling full-screened/windowed with pos(0, 0) can cause problems in some platforms, such as X11
|
||||
CORE.Window.position.x = CORE.Window.display.width/4;
|
||||
CORE.Window.position.y = CORE.Window.display.height/4;
|
||||
}
|
||||
@@ -1554,7 +1554,7 @@ int InitPlatform(void)
|
||||
// No-fullscreen window creation
|
||||
bool requestWindowedFullscreen = (CORE.Window.screen.height == 0) && (CORE.Window.screen.width == 0);
|
||||
|
||||
// Default to at least one pixel in size, as creation with a zero dimension is not allowed.
|
||||
// Default to at least one pixel in size, as creation with a zero dimension is not allowed
|
||||
int creationWidth = CORE.Window.screen.width != 0 ? CORE.Window.screen.width : 1;
|
||||
int creationHeight = CORE.Window.screen.height != 0 ? CORE.Window.screen.height : 1;
|
||||
|
||||
@@ -1566,8 +1566,8 @@ int InitPlatform(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// After the window was created, determine the monitor that the window manager assigned.
|
||||
// Derive display sizes, and, if possible, window size in case it was zero at beginning.
|
||||
// After the window was created, determine the monitor that the window manager assigned
|
||||
// Derive display sizes, and, if possible, window size in case it was zero at beginning
|
||||
|
||||
int monitorCount = 0;
|
||||
int monitorIndex = GetCurrentMonitor();
|
||||
@@ -1582,7 +1582,7 @@ int InitPlatform(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
// The monitor for the window-manager-created window can not be determined, so it can not be centered.
|
||||
// The monitor for the window-manager-created window can not be determined, so it can not be centered
|
||||
glfwTerminate();
|
||||
TRACELOG(LOG_WARNING, "GLFW: Failed to determine Monitor to center Window");
|
||||
return -1;
|
||||
@@ -1604,7 +1604,7 @@ int InitPlatform(void)
|
||||
|
||||
// Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS)
|
||||
// NOTE: V-Sync can be enabled by graphic driver configuration, it doesn't need
|
||||
// to be activated on web platforms since VSync is enforced there.
|
||||
// to be activated on web platforms since VSync is enforced there
|
||||
if (CORE.Window.flags & FLAG_VSYNC_HINT)
|
||||
{
|
||||
// WARNING: It seems to hit a critical render path in Intel HD Graphics
|
||||
@@ -1617,7 +1617,7 @@ int InitPlatform(void)
|
||||
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
||||
{
|
||||
// NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling.
|
||||
// NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling
|
||||
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
|
||||
#if !defined(__APPLE__)
|
||||
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
|
||||
@@ -1660,7 +1660,8 @@ int InitPlatform(void)
|
||||
int monitorHeight = 0;
|
||||
glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight);
|
||||
|
||||
// Here CORE.Window.render.width/height should be used instead of CORE.Window.screen.width/height to center the window correctly when the high dpi flag is enabled.
|
||||
// Here CORE.Window.render.width/height should be used instead of
|
||||
// CORE.Window.screen.width/height to center the window correctly when the high dpi flag is enabled
|
||||
int posX = monitorX + (monitorWidth - (int)CORE.Window.render.width)/2;
|
||||
int posY = monitorY + (monitorHeight - (int)CORE.Window.render.height)/2;
|
||||
if (posX < monitorX) posX = monitorX;
|
||||
|
@@ -252,7 +252,7 @@ static const int CursorsLUT[] = {
|
||||
//SDL_SYSTEM_CURSOR_WAITARROW, // No equivalent implemented on MouseCursor enum on raylib.h
|
||||
};
|
||||
|
||||
// SDL3 Migration Layer made to avoid 'ifdefs' inside functions when we can.
|
||||
// SDL3 Migration Layer made to avoid 'ifdefs' inside functions when we can
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
|
||||
// SDL3 Migration:
|
||||
@@ -269,7 +269,7 @@ static const int CursorsLUT[] = {
|
||||
// SDL3 Migration: SDL_INIT_TIMER - no longer needed before calling SDL_AddTimer()
|
||||
#define SDL_INIT_TIMER 0x0 // It's a flag, so no problem in setting it to zero if we use in a bitor (|)
|
||||
|
||||
// SDL3 Migration: The SDL_WINDOW_SHOWN flag has been removed. Windows are shown by default and can be created hidden by using the SDL_WINDOW_HIDDEN flag.
|
||||
// SDL3 Migration: The SDL_WINDOW_SHOWN flag has been removed. Windows are shown by default and can be created hidden by using the SDL_WINDOW_HIDDEN flag
|
||||
#define SDL_WINDOW_SHOWN 0x0 // It's a flag, so no problem in setting it to zero if we use in a bitor (|)
|
||||
|
||||
// SDL3 Migration: Renamed
|
||||
@@ -344,7 +344,7 @@ SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth
|
||||
// SDL3 Migration:
|
||||
// SDL_GetDisplayDPI() -
|
||||
// not reliable across platforms, approximately replaced by multiplying
|
||||
// SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms.
|
||||
// SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms
|
||||
// returns 0 on success or a negative error code on failure
|
||||
int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi)
|
||||
{
|
||||
@@ -382,7 +382,7 @@ int SDL_NumJoysticks(void)
|
||||
|
||||
// SDL_SetRelativeMouseMode
|
||||
// returns 0 on success or a negative error code on failure
|
||||
// If relative mode is not supported, this returns -1.
|
||||
// If relative mode is not supported, this returns -1
|
||||
int SDL_SetRelativeMouseMode_Adapter(SDL_bool enabled)
|
||||
{
|
||||
// SDL_SetWindowRelativeMouseMode(SDL_Window *window, bool enabled)
|
||||
@@ -841,7 +841,7 @@ void SetWindowMonitor(int monitor)
|
||||
// NOTE:
|
||||
// 1. SDL started supporting moving exclusive fullscreen windows between displays on SDL3,
|
||||
// see commit https://github.com/libsdl-org/SDL/commit/3f5ef7dd422057edbcf3e736107e34be4b75d9ba
|
||||
// 2. A workaround for SDL2 is leaving fullscreen, moving the window, then entering full screen again.
|
||||
// 2. A workaround for SDL2 is leaving fullscreen, moving the window, then entering full screen again
|
||||
const bool wasFullscreen = ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0)? true : false;
|
||||
|
||||
const int screenWidth = CORE.Window.screen.width;
|
||||
@@ -854,7 +854,7 @@ void SetWindowMonitor(int monitor)
|
||||
if (SDL_GetDisplayUsableBounds(monitor, &usableBounds) == 0)
|
||||
#endif
|
||||
{
|
||||
if (wasFullscreen == 1) ToggleFullscreen(); // Leave fullscreen.
|
||||
if (wasFullscreen == 1) ToggleFullscreen(); // Leave fullscreen
|
||||
|
||||
// If the screen size is larger than the monitor usable area, anchor it on the top left corner, otherwise, center it
|
||||
if ((screenWidth >= usableBounds.w) || (screenHeight >= usableBounds.h))
|
||||
@@ -862,11 +862,11 @@ void SetWindowMonitor(int monitor)
|
||||
// NOTE:
|
||||
// 1. There's a known issue where if the window larger than the target display bounds,
|
||||
// when moving the windows to that display, the window could be clipped back
|
||||
// ending up positioned partly outside the target display.
|
||||
// ending up positioned partly outside the target display
|
||||
// 2. The workaround for that is, previously to moving the window,
|
||||
// setting the window size to the target display size, so they match.
|
||||
// setting the window size to the target display size, so they match
|
||||
// 3. It wasn't done here because we can't assume changing the window size automatically
|
||||
// is acceptable behavior by the user.
|
||||
// is acceptable behavior by the user
|
||||
SDL_SetWindowPosition(platform.window, usableBounds.x, usableBounds.y);
|
||||
CORE.Window.position.x = usableBounds.x;
|
||||
CORE.Window.position.y = usableBounds.y;
|
||||
@@ -1099,7 +1099,7 @@ Vector2 GetWindowScaleDPI(void)
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
// NOTE: SDL_GetWindowDisplayScale was only added on SDL3
|
||||
// see https://wiki.libsdl.org/SDL3/SDL_GetWindowDisplayScale
|
||||
// TODO: Implement the window scale factor calculation manually.
|
||||
// TODO: Implement the window scale factor calculation manually
|
||||
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform");
|
||||
#else
|
||||
scale.x = SDL_GetWindowDisplayScale(platform.window);
|
||||
@@ -1245,9 +1245,9 @@ double GetTime(void)
|
||||
}
|
||||
|
||||
// Open URL with default system browser (if available)
|
||||
// NOTE: This function is only safe to use if you control the URL given.
|
||||
// A user could craft a malicious string performing another action.
|
||||
// Only call this function yourself not with user input or make sure to check the string yourself.
|
||||
// NOTE: This function is only safe to use if you control the URL given
|
||||
// A user could craft a malicious string performing another action
|
||||
// Only call this function yourself not with user input or make sure to check the string yourself
|
||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
||||
void OpenURL(const char *url)
|
||||
{
|
||||
@@ -1299,7 +1299,7 @@ void SetMouseCursor(int cursor)
|
||||
CORE.Input.Mouse.cursor = cursor;
|
||||
}
|
||||
|
||||
// Get physical key name.
|
||||
// Get physical key name
|
||||
const char *GetKeyName(int key)
|
||||
{
|
||||
return SDL_GetKeyName(key);
|
||||
@@ -1466,8 +1466,7 @@ void PollInputEvents(void)
|
||||
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
// SDL3 states:
|
||||
// The SDL_WINDOWEVENT_* events have been moved to top level events,
|
||||
// and SDL_WINDOWEVENT has been removed.
|
||||
// The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed
|
||||
// In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT
|
||||
// and then checking for window events. You can compare the event >= SDL_EVENT_WINDOW_FIRST and <= SDL_EVENT_WINDOW_LAST if you need to see whether it's a window event.
|
||||
case SDL_WINDOWEVENT:
|
||||
|
@@ -18,9 +18,9 @@
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_SSH_KEYBOARD_RPI (Raspberry Pi only)
|
||||
* Reconfigure standard input to receive key inputs, works with SSH connection.
|
||||
* Reconfigure standard input to receive key inputs, works with SSH connection
|
||||
* WARNING: Reconfiguring standard input could lead to undesired effects, like breaking other
|
||||
* running processes orblocking the device if not restored properly. Use with care.
|
||||
* running processes orblocking the device if not restored properly. Use with care
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* - DRM and GLM: System libraries for display initialization and configuration
|
||||
@@ -744,11 +744,11 @@ void SwapScreenBuffer()
|
||||
}
|
||||
|
||||
// Attempt page flip
|
||||
// NOTE: rmModePageFlip() schedules a buffer-flip for the next vblank and then notifies us about it.
|
||||
// It takes a CRTC-id, fb-id and an arbitrary data-pointer and then schedules the page-flip.
|
||||
// This is fully asynchronous and when the page-flip happens, the DRM-fd will become readable and we can call drmHandleEvent().
|
||||
// This will read all vblank/page-flip events and call our modeset_page_flip_event() callback with the data-pointer that we passed to drmModePageFlip().
|
||||
// We simply call modeset_draw_dev() then so the next frame is rendered... returns immediately.
|
||||
// NOTE: rmModePageFlip() schedules a buffer-flip for the next vblank and then notifies us about it
|
||||
// It takes a CRTC-id, fb-id and an arbitrary data-pointer and then schedules the page-flip
|
||||
// This is fully asynchronous and when the page-flip happens, the DRM-fd will become readable and we can call drmHandleEvent()
|
||||
// This will read all vblank/page-flip events and call our modeset_page_flip_event() callback with the data-pointer that we passed to drmModePageFlip()
|
||||
// We simply call modeset_draw_dev() then so the next frame is rendered... returns immediately
|
||||
if (drmModePageFlip(platform.fd, platform.crtc->crtc_id, fbId, DRM_MODE_PAGE_FLIP_EVENT, platform.prevBO))
|
||||
{
|
||||
if (errno == EBUSY) errCnt[3]++; // Display busy - skip flip
|
||||
@@ -824,9 +824,9 @@ double GetTime(void)
|
||||
}
|
||||
|
||||
// Open URL with default system browser (if available)
|
||||
// NOTE: This function is only safe to use if you control the URL given.
|
||||
// A user could craft a malicious string performing another action.
|
||||
// Only call this function yourself not with user input or make sure to check the string yourself.
|
||||
// NOTE: This function is only safe to use if you control the URL given
|
||||
// A user could craft a malicious string performing another action
|
||||
// Only call this function yourself not with user input or make sure to check the string yourself
|
||||
// Ref: https://github.com/raysan5/raylib/issues/686
|
||||
void OpenURL(const char *url)
|
||||
{
|
||||
@@ -863,7 +863,7 @@ void SetMouseCursor(int cursor)
|
||||
TRACELOG(LOG_WARNING, "SetMouseCursor() not implemented on target platform");
|
||||
}
|
||||
|
||||
// Get physical key name.
|
||||
// Get physical key name
|
||||
const char *GetKeyName(int key)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetKeyName() not implemented on target platform");
|
||||
@@ -897,7 +897,7 @@ void PollInputEvents(void)
|
||||
PollKeyboardEvents();
|
||||
|
||||
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||
// NOTE: Keyboard reading could be done using input_event(s) or just read from stdin, both methods are used here.
|
||||
// NOTE: Keyboard reading could be done using input_event(s) or just read from stdin, both methods are used here
|
||||
// stdin reading is still used for legacy purposes, it allows keyboard input trough SSH console
|
||||
if (!platform.eventKeyboardMode) ProcessKeyboard();
|
||||
#endif
|
||||
@@ -1003,8 +1003,8 @@ int InitPlatform(void)
|
||||
drmModeConnector *con = drmModeGetConnector(platform.fd, res->connectors[i]);
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: Connector modes detected: %i", con->count_modes);
|
||||
|
||||
// In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected.
|
||||
// This might be a hardware or software limitation like on Raspberry Pi Zero with composite output.
|
||||
// In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected
|
||||
// This might be a hardware or software limitation like on Raspberry Pi Zero with composite output
|
||||
if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->encoder_id))
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
|
||||
@@ -1160,7 +1160,7 @@ int InitPlatform(void)
|
||||
// Initialize the EGL device connection
|
||||
if (eglInitialize(platform.device, NULL, NULL) == EGL_FALSE)
|
||||
{
|
||||
// If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred.
|
||||
// If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred
|
||||
TRACELOG(LOG_WARNING, "DISPLAY: Failed to initialize EGL device");
|
||||
return -1;
|
||||
}
|
||||
@@ -1644,7 +1644,7 @@ static void ConfigureEvdevDevice(char *device)
|
||||
return;
|
||||
}
|
||||
|
||||
// At this point we have a connection to the device, but we don't yet know what the device is.
|
||||
// At this point we have a connection to the device, but we don't yet know what the device is
|
||||
// It could be many things, even as simple as a power button...
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
14
src/raudio.c
14
src/raudio.c
@@ -15,8 +15,8 @@
|
||||
* raudio module is included in the build
|
||||
*
|
||||
* #define RAUDIO_STANDALONE
|
||||
* Define to use the module as standalone library (independently of raylib).
|
||||
* Required types and functions are defined in the same module.
|
||||
* Define to use the module as standalone library (independently of raylib)
|
||||
* Required types and functions are defined in the same module
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_WAV
|
||||
* #define SUPPORT_FILEFORMAT_OGG
|
||||
@@ -89,7 +89,7 @@
|
||||
// by user at some point and won't be included...
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
// If defined, the following flags inhibit definition of the indicated items.
|
||||
// If defined, the following flags inhibit definition of the indicated items
|
||||
#define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
|
||||
#define NOVIRTUALKEYCODES // VK_*
|
||||
#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
|
||||
@@ -124,9 +124,9 @@
|
||||
#define NOWH // SetWindowsHook and WH_*
|
||||
#define NOWINOFFSETS // GWL_*, GCL_*, associated routines
|
||||
#define NOCOMM // COMM driver routines
|
||||
#define NOKANJI // Kanji support stuff.
|
||||
#define NOHELP // Help engine interface.
|
||||
#define NOPROFILER // Profiler interface.
|
||||
#define NOKANJI // Kanji support stuff
|
||||
#define NOHELP // Help engine interface
|
||||
#define NOPROFILER // Profiler interface
|
||||
#define NODEFERWINDOWPOS // DeferWindowPos routines
|
||||
#define NOMCX // Modem Configuration Extensions
|
||||
|
||||
@@ -1118,7 +1118,7 @@ bool ExportWaveAsCode(Wave wave, const char *fileName)
|
||||
|
||||
// NOTE: Text data buffer size is estimated considering wave data size in bytes
|
||||
// and requiring 12 char bytes for every byte; the actual size varies, but
|
||||
// the longest possible char being appended is "%.4ff,\n ", which is 12 bytes.
|
||||
// the longest possible char being appended is "%.4ff,\n ", which is 12 bytes
|
||||
char *txtData = (char *)RL_CALLOC(waveDataSize*12 + 2000, sizeof(char));
|
||||
|
||||
int byteCount = 0;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* FEATURES:
|
||||
* - NO external dependencies, all required libraries included with raylib
|
||||
* - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly,
|
||||
* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5.
|
||||
* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5
|
||||
* - Written in plain C code (C99) in PascalCase/camelCase notation
|
||||
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3, ES2, ES3 - choose at compile)
|
||||
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
|
||||
|
@@ -12,7 +12,7 @@
|
||||
* #define SUPPORT_FILEFORMAT_GLTF
|
||||
* #define SUPPORT_FILEFORMAT_VOX
|
||||
* #define SUPPORT_FILEFORMAT_M3D
|
||||
* Selected desired fileformats to be supported for model data loading.
|
||||
* Selected desired fileformats to be supported for model data loading
|
||||
*
|
||||
* #define SUPPORT_MESH_GENERATION
|
||||
* Support procedural mesh generation functions, uses external par_shapes.h library
|
||||
@@ -2298,7 +2298,7 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
|
||||
|
||||
if (firstMeshWithBones != -1)
|
||||
{
|
||||
// Update all bones and boneMatrices of first mesh with bones.
|
||||
// Update all bones and boneMatrices of first mesh with bones
|
||||
for (int boneId = 0; boneId < anim.boneCount; boneId++)
|
||||
{
|
||||
Transform *bindTransform = &model.bindPose[boneId];
|
||||
@@ -5291,8 +5291,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
> Texcoords: vec2: float
|
||||
> Colors: vec4: u8, u16, f32 (normalized)
|
||||
> Indices: u16, u32 (truncated to u16)
|
||||
- Scenes defined in the glTF file are ignored. All nodes in the file
|
||||
are used.
|
||||
- Scenes defined in the glTF file are ignored. All nodes in the file are used
|
||||
|
||||
***********************************************************************************************/
|
||||
|
||||
@@ -5347,8 +5346,8 @@ static Model LoadGLTF(const char *fileName)
|
||||
|
||||
int primitivesCount = 0;
|
||||
|
||||
// NOTE: We will load every primitive in the glTF as a separate raylib Mesh.
|
||||
// Determine total number of meshes needed from the node hierarchy.
|
||||
// NOTE: We will load every primitive in the glTF as a separate raylib Mesh
|
||||
// Determine total number of meshes needed from the node hierarchy
|
||||
for (unsigned int i = 0; i < data->nodes_count; i++)
|
||||
{
|
||||
cgltf_node *node = &(data->nodes[i]);
|
||||
@@ -5490,14 +5489,13 @@ static Model LoadGLTF(const char *fileName)
|
||||
// has_clearcoat, has_transmission, has_volume, has_ior, has specular, has_sheen
|
||||
}
|
||||
|
||||
// Visit each node in the hierarchy and process any mesh linked from it.
|
||||
// Each primitive within a glTF node becomes a Raylib Mesh.
|
||||
// Visit each node in the hierarchy and process any mesh linked from it
|
||||
// Each primitive within a glTF node becomes a Raylib Mesh
|
||||
// The local-to-world transform of each node is used to transform the
|
||||
// points/normals/tangents of the created Mesh(es).
|
||||
// points/normals/tangents of the created Mesh(es)
|
||||
// Any glTF mesh linked from more than one Node (i.e. instancing)
|
||||
// is turned into multiple Mesh's, as each Node will have its own
|
||||
// transform applied.
|
||||
// NOTE: The code below disregards the scenes defined in the file, all nodes are used.
|
||||
// is turned into multiple Mesh's, as each Node will have its own transform applied
|
||||
// NOTE: The code below disregards the scenes defined in the file, all nodes are used
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
int meshIndex = 0;
|
||||
for (unsigned int i = 0; i < data->nodes_count; i++)
|
||||
|
@@ -3,17 +3,17 @@
|
||||
* rshapes - Basic functions to draw 2d shapes and check collisions
|
||||
*
|
||||
* ADDITIONAL NOTES:
|
||||
* Shapes can be draw using 3 types of primitives: LINES, TRIANGLES and QUADS.
|
||||
* Shapes can be draw using 3 types of primitives: LINES, TRIANGLES and QUADS
|
||||
* Some functions implement two drawing options: TRIANGLES and QUADS, by default TRIANGLES
|
||||
* are used but QUADS implementation can be selected with SUPPORT_QUADS_DRAW_MODE define
|
||||
*
|
||||
* Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a
|
||||
* user-provided texture with SetShapesTexture(), the pourpouse of this implementation
|
||||
* is allowing to reduce draw calls when combined with a texture-atlas.
|
||||
* is allowing to reduce draw calls when combined with a texture-atlas
|
||||
*
|
||||
* By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one
|
||||
* white character of default font [rtext], this way, raylib text and shapes can be draw with
|
||||
* a single draw call and it also allows users to configure it the same way with their own fonts.
|
||||
* a single draw call and it also allows users to configure it the same way with their own fonts
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_MODULE_RSHAPES
|
||||
|
@@ -7,8 +7,8 @@
|
||||
* rtext module is included in the build
|
||||
*
|
||||
* #define SUPPORT_DEFAULT_FONT
|
||||
* Load default raylib font on initialization to be used by DrawText() and MeasureText().
|
||||
* If no default font loaded, DrawTextEx() and MeasureTextEx() are required.
|
||||
* Load default raylib font on initialization to be used by DrawText() and MeasureText()
|
||||
* If no default font loaded, DrawTextEx() and MeasureTextEx() are required
|
||||
*
|
||||
* #define SUPPORT_FILEFORMAT_FNT
|
||||
* #define SUPPORT_FILEFORMAT_TTF
|
||||
@@ -19,7 +19,7 @@
|
||||
* #define SUPPORT_FONT_ATLAS_WHITE_REC
|
||||
* On font atlas image generation [GenImageFontAtlas()], add a 3x3 pixels white rectangle
|
||||
* at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow
|
||||
* drawing text and shapes with a single draw call [SetShapesTexture()].
|
||||
* drawing text and shapes with a single draw call [SetShapesTexture()]
|
||||
*
|
||||
* #define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH
|
||||
* TextSplit() function static buffer max size
|
||||
|
@@ -36,7 +36,7 @@
|
||||
*
|
||||
* DEPENDENCIES:
|
||||
* stb_image - Multiple image formats loading (JPEG, PNG, BMP, TGA, PSD, GIF, PIC)
|
||||
* NOTE: stb_image has been slightly modified to support Android platform.
|
||||
* NOTE: stb_image has been slightly modified to support Android platform
|
||||
* stb_image_resize - Multiple image resize algorithms
|
||||
*
|
||||
*
|
||||
|
Reference in New Issue
Block a user