Fixed some grammar mistakes and typos. (#2914)
* Fixed some grammar mistakes. * Fixed some typos.
This commit is contained in:
parent
5c6a756014
commit
6ae21d6581
18
src/config.h
18
src/config.h
@ -50,7 +50,7 @@
|
||||
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
|
||||
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
|
||||
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
||||
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is setup and used
|
||||
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is set up and used
|
||||
//#define SUPPORT_BUSY_WAIT_LOOP 1
|
||||
// Use a partial-busy wait loop, in this case frame sleeps for most of the time, but then runs a busy loop at the end for accuracy
|
||||
#define SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||
@ -65,7 +65,7 @@
|
||||
// Support automatic generated events, loading and recording of those events when required
|
||||
//#define SUPPORT_EVENTS_AUTOMATION 1
|
||||
// Support custom frame control, only for advance users
|
||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents()
|
||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||
// Enabling this flag allows manual control of the frame processes, use at your own risk
|
||||
//#define SUPPORT_CUSTOM_FRAME_CONTROL 1
|
||||
|
||||
@ -110,12 +110,12 @@
|
||||
|
||||
// Default shader vertex attribute names to set location points
|
||||
// NOTE: When a new shader is loaded, the following locations are tried to be set for convenience
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Binded by default to shader location: 0
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Binded by default to shader location: 1
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Binded by default to shader location: 2
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Binded by default to shader location: 3
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Binded by default to shader location: 4
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Binded by default to shader location: 5
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: 0
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: 1
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: 2
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: 3
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: 4
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: 5
|
||||
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||
@ -139,7 +139,7 @@
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: rtextures - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Selecte desired fileformats to be supported for image data loading
|
||||
// Select the desired fileformats to be supported for image data loading
|
||||
#define SUPPORT_FILEFORMAT_PNG 1
|
||||
//#define SUPPORT_FILEFORMAT_BMP 1
|
||||
//#define SUPPORT_FILEFORMAT_TGA 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<html lang="EN-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
20
src/raudio.c
20
src/raudio.c
@ -314,7 +314,7 @@ typedef enum {
|
||||
#endif
|
||||
|
||||
// NOTE: Different logic is used when feeding data to the playback device
|
||||
// depending on whether or not data is streamed (Music vs Sound)
|
||||
// depending on whether data is streamed (Music vs Sound)
|
||||
typedef enum {
|
||||
AUDIO_BUFFER_USAGE_STATIC = 0,
|
||||
AUDIO_BUFFER_USAGE_STREAM
|
||||
@ -474,7 +474,7 @@ void InitAudioDevice(void)
|
||||
return;
|
||||
}
|
||||
|
||||
// Mixing happens on a seperate thread which means we need to synchronize. I'm using a mutex here to make things simple, but may
|
||||
// Mixing happens on a separate thread which means we need to synchronize. I'm using a mutex here to make things simple, but may
|
||||
// want to look at something a bit smarter later on to keep everything real-time, if that's necessary.
|
||||
if (ma_mutex_init(&AUDIO.System.lock) != MA_SUCCESS)
|
||||
{
|
||||
@ -1089,7 +1089,7 @@ void PlaySoundMulti(Sound sound)
|
||||
unsigned int oldAge = 0;
|
||||
int oldIndex = -1;
|
||||
|
||||
// find the first non playing pool entry
|
||||
// find the first non-playing pool entry
|
||||
for (int i = 0; i < MAX_AUDIO_BUFFER_POOL_CHANNELS; i++)
|
||||
{
|
||||
if (AUDIO.MultiChannel.channels[i] > oldAge)
|
||||
@ -1105,7 +1105,7 @@ void PlaySoundMulti(Sound sound)
|
||||
}
|
||||
}
|
||||
|
||||
// If no none playing pool members can be index choose the oldest
|
||||
// If no none playing pool members can be indexed choose the oldest
|
||||
if (index == -1)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SOUND: Buffer pool is already full, count: %i", AUDIO.MultiChannel.poolCounter);
|
||||
@ -1113,7 +1113,7 @@ void PlaySoundMulti(Sound sound)
|
||||
if (oldIndex == -1)
|
||||
{
|
||||
// Shouldn't be able to get here... but just in case something odd happens!
|
||||
TRACELOG(LOG_WARNING, "SOUND: Buffer pool could not determine oldest buffer not playing sound");
|
||||
TRACELOG(LOG_WARNING, "SOUND: Buffer pool could not determine the oldest buffer not playing sound");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2107,8 +2107,8 @@ void UnloadAudioStream(AudioStream stream)
|
||||
}
|
||||
|
||||
// Update audio stream buffers with data
|
||||
// NOTE 1: Only updates one buffer of the stream source: unqueue -> update -> queue
|
||||
// NOTE 2: To unqueue a buffer it needs to be processed: IsAudioStreamProcessed()
|
||||
// NOTE 1: Only updates one buffer of the stream source: dequeue -> update -> queue
|
||||
// NOTE 2: To dequeue a buffer it needs to be processed: IsAudioStreamProcessed()
|
||||
void UpdateAudioStream(AudioStream stream, const void *data, int frameCount)
|
||||
{
|
||||
if (stream.buffer != NULL)
|
||||
@ -2305,7 +2305,7 @@ static ma_uint32 ReadAudioBufferFramesInInternalFormat(AudioBuffer *audioBuffer,
|
||||
|
||||
if (currentSubBufferIndex > 1) return 0;
|
||||
|
||||
// Another thread can update the processed state of buffers so
|
||||
// Another thread can update the processed state of buffers, so
|
||||
// we just take a copy here to try and avoid potential synchronization problems
|
||||
bool isSubBufferProcessed[2] = { 0 };
|
||||
isSubBufferProcessed[0] = audioBuffer->isSubBufferProcessed[0];
|
||||
@ -2319,7 +2319,7 @@ static ma_uint32 ReadAudioBufferFramesInInternalFormat(AudioBuffer *audioBuffer,
|
||||
{
|
||||
// We break from this loop differently depending on the buffer's usage
|
||||
// - For static buffers, we simply fill as much data as we can
|
||||
// - For streaming buffers we only fill the halves of the buffer that are processed
|
||||
// - For streaming buffers we only fill half of the buffer that are processed
|
||||
// Unprocessed halves must keep their audio data in-tact
|
||||
if (audioBuffer->usage == AUDIO_BUFFER_USAGE_STATIC)
|
||||
{
|
||||
@ -2376,7 +2376,7 @@ static ma_uint32 ReadAudioBufferFramesInInternalFormat(AudioBuffer *audioBuffer,
|
||||
|
||||
// For static buffers we can fill the remaining frames with silence for safety, but we don't want
|
||||
// to report those frames as "read". The reason for this is that the caller uses the return value
|
||||
// to know whether or not a non-looping sound has finished playback.
|
||||
// to know whether a non-looping sound has finished playback.
|
||||
if (audioBuffer->usage != AUDIO_BUFFER_USAGE_STATIC) framesRead += totalFramesRemaining;
|
||||
}
|
||||
|
||||
|
16
src/raylib.h
16
src/raylib.h
@ -216,7 +216,7 @@ typedef struct Vector4 {
|
||||
// Quaternion, 4 components (Vector4 alias)
|
||||
typedef Vector4 Quaternion;
|
||||
|
||||
// Matrix, 4x4 components, column major, OpenGL style, right handed
|
||||
// Matrix, 4x4 components, column major, OpenGL style, right-handed
|
||||
typedef struct Matrix {
|
||||
float m0, m4, m8, m12; // Matrix first row (4 components)
|
||||
float m1, m5, m9, m13; // Matrix second row (4 components)
|
||||
@ -413,8 +413,8 @@ typedef struct Ray {
|
||||
// RayCollision, ray hit information
|
||||
typedef struct RayCollision {
|
||||
bool hit; // Did the ray hit something?
|
||||
float distance; // Distance to nearest hit
|
||||
Vector3 point; // Point of nearest hit
|
||||
float distance; // Distance to the nearest hit
|
||||
Vector3 point; // Point of the nearest hit
|
||||
Vector3 normal; // Surface normal of hit
|
||||
} RayCollision;
|
||||
|
||||
@ -681,7 +681,7 @@ typedef enum {
|
||||
MOUSE_CURSOR_RESIZE_NS = 6, // Vertical resize/move arrow shape
|
||||
MOUSE_CURSOR_RESIZE_NWSE = 7, // Top-left to bottom-right diagonal resize/move arrow shape
|
||||
MOUSE_CURSOR_RESIZE_NESW = 8, // The top-right to bottom-left diagonal resize/move arrow shape
|
||||
MOUSE_CURSOR_RESIZE_ALL = 9, // The omni-directional resize/move cursor shape
|
||||
MOUSE_CURSOR_RESIZE_ALL = 9, // The omnidirectional resize/move cursor shape
|
||||
MOUSE_CURSOR_NOT_ALLOWED = 10 // The operation-not-allowed shape
|
||||
} MouseCursor;
|
||||
|
||||
@ -839,10 +839,10 @@ typedef enum {
|
||||
typedef enum {
|
||||
CUBEMAP_LAYOUT_AUTO_DETECT = 0, // Automatically detect layout type
|
||||
CUBEMAP_LAYOUT_LINE_VERTICAL, // Layout is defined by a vertical line with faces
|
||||
CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by an horizontal line with faces
|
||||
CUBEMAP_LAYOUT_LINE_HORIZONTAL, // Layout is defined by a horizontal line with faces
|
||||
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces
|
||||
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces
|
||||
CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirectangular map)
|
||||
CUBEMAP_LAYOUT_PANORAMA // Layout is defined by a panorama image (equirrectangular map)
|
||||
} CubemapLayout;
|
||||
|
||||
// Font type, defines generation method
|
||||
@ -903,7 +903,7 @@ typedef enum {
|
||||
} NPatchLayout;
|
||||
|
||||
// Callbacks to hook some internal functions
|
||||
// WARNING: This callbacks are intended for advance users
|
||||
// WARNING: These callbacks are intended for advance users
|
||||
typedef void (*TraceLogCallback)(int logLevel, const char *text, va_list args); // Logging: Redirect trace log messages
|
||||
typedef unsigned char *(*LoadFileDataCallback)(const char *fileName, unsigned int *bytesRead); // FileIO: Load binary data
|
||||
typedef bool (*SaveFileDataCallback)(const char *fileName, void *data, unsigned int bytesToWrite); // FileIO: Save binary data
|
||||
@ -1228,7 +1228,7 @@ RLAPI Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2);
|
||||
//------------------------------------------------------------------------------------
|
||||
|
||||
// Image loading functions
|
||||
// NOTE: This functions do not require GPU access
|
||||
// NOTE: These functions do not require GPU access
|
||||
RLAPI Image LoadImage(const char *fileName); // Load image from file into CPU memory (RAM)
|
||||
RLAPI Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image from RAW file data
|
||||
RLAPI Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
|
||||
|
@ -150,7 +150,7 @@ void SetCameraMoveControls(int keyFront, int keyBack,
|
||||
#endif
|
||||
|
||||
// Camera mouse movement sensitivity
|
||||
#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.5f // TODO: it should be independant of framerate
|
||||
#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.5f // TODO: it should be independent of framerate
|
||||
#define CAMERA_MOUSE_SCROLL_SENSITIVITY 1.5f
|
||||
|
||||
// FREE_CAMERA
|
||||
|
52
src/rcore.c
52
src/rcore.c
@ -865,7 +865,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
LoadFontDefault();
|
||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||
Rectangle rec = GetFontDefault().recs[95];
|
||||
// NOTE: We setup a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering
|
||||
// NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering
|
||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 }); // WARNING: Module required: rshapes
|
||||
#endif
|
||||
#else
|
||||
@ -1318,7 +1318,7 @@ void MaximizeWindow(void)
|
||||
void MinimizeWindow(void)
|
||||
{
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
// NOTE: Following function launches callback that sets appropiate flag!
|
||||
// NOTE: Following function launches callback that sets appropriate flag!
|
||||
glfwIconifyWindow(CORE.Window.handle);
|
||||
#endif
|
||||
}
|
||||
@ -1417,13 +1417,13 @@ void SetWindowState(unsigned int flags)
|
||||
// State change: FLAG_WINDOW_TRANSPARENT
|
||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) != (flags & FLAG_WINDOW_TRANSPARENT)) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||
}
|
||||
|
||||
// State change: FLAG_WINDOW_HIGHDPI
|
||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) != (flags & FLAG_WINDOW_HIGHDPI)) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||
}
|
||||
|
||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||
@ -1436,13 +1436,13 @@ void SetWindowState(unsigned int flags)
|
||||
// State change: FLAG_MSAA_4X_HINT
|
||||
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) != (flags & FLAG_MSAA_4X_HINT)) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||
}
|
||||
|
||||
// State change: FLAG_INTERLACED_HINT
|
||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) != (flags & FLAG_INTERLACED_HINT)) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1525,13 +1525,13 @@ void ClearWindowState(unsigned int flags)
|
||||
// State change: FLAG_WINDOW_TRANSPARENT
|
||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "WINDOW: Framebuffer transparency can only be configured before window initialization");
|
||||
}
|
||||
|
||||
// State change: FLAG_WINDOW_HIGHDPI
|
||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "WINDOW: High DPI can only be configured before window initialization");
|
||||
}
|
||||
|
||||
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||
@ -1544,13 +1544,13 @@ void ClearWindowState(unsigned int flags)
|
||||
// State change: FLAG_MSAA_4X_HINT
|
||||
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) > 0) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "WINDOW: MSAA can only be configured before window initialization");
|
||||
}
|
||||
|
||||
// State change: FLAG_INTERLACED_HINT
|
||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) > 0) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only by configured before window initialization");
|
||||
TRACELOG(LOG_WARNING, "RPI: Interlaced mode can only be configured before window initialization");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -2482,10 +2482,10 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||
|
||||
shader.locs = (int *)RL_CALLOC(RL_MAX_SHADER_LOCATIONS, sizeof(int));
|
||||
|
||||
// All locations reseted to -1 (no location)
|
||||
// All locations reset to -1 (no location)
|
||||
for (int i = 0; i < RL_MAX_SHADER_LOCATIONS; i++) shader.locs[i] = -1;
|
||||
|
||||
// Get handles to GLSL input attibute locations
|
||||
// Get handles to GLSL input attribute locations
|
||||
shader.locs[SHADER_LOC_VERTEX_POSITION] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION);
|
||||
shader.locs[SHADER_LOC_VERTEX_TEXCOORD01] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD);
|
||||
shader.locs[SHADER_LOC_VERTEX_TEXCOORD02] = rlGetLocationAttrib(shader.id, RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2);
|
||||
@ -2553,7 +2553,7 @@ void SetShaderValueV(Shader shader, int locIndex, const void *value, int uniform
|
||||
{
|
||||
rlEnableShader(shader.id);
|
||||
rlSetUniform(locIndex, value, uniformType, count);
|
||||
//rlDisableShader(); // Avoid reseting current shader program, in case other uniforms are set
|
||||
//rlDisableShader(); // Avoid resetting current shader program, in case other uniforms are set
|
||||
}
|
||||
}
|
||||
|
||||
@ -2618,7 +2618,7 @@ Ray GetMouseRay(Vector2 mouse, Camera camera)
|
||||
Vector3 farPoint = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, 1.0f }, matProj, matView);
|
||||
|
||||
// Unproject the mouse cursor in the near plane.
|
||||
// We need this as the source position because orthographic projects, compared to perspect doesn't have a
|
||||
// We need this as the source position because orthographic projects, compared to perspective doesn't have a
|
||||
// convergence point, meaning that the "eye" of the camera is more like a plane than a point.
|
||||
Vector3 cameraPlanePointerPos = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, -1.0f }, matProj, matView);
|
||||
|
||||
@ -2808,7 +2808,7 @@ double GetTime(void)
|
||||
|
||||
// Setup window configuration flags (view FLAGS)
|
||||
// NOTE: This function is expected to be called before window creation,
|
||||
// because it setups some flags for the window creation process.
|
||||
// because it sets up some flags for the window creation process.
|
||||
// To configure window states after creation, just use SetWindowState()
|
||||
void SetConfigFlags(unsigned int flags)
|
||||
{
|
||||
@ -3929,7 +3929,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.screenScale = MatrixIdentity(); // No draw scaling required by default
|
||||
|
||||
// NOTE: Framebuffer (render area - CORE.Window.render.width, CORE.Window.render.height) could include black bars...
|
||||
// ...in top-down or left-right to match display aspect ratio (no weird scalings)
|
||||
// ...in top-down or left-right to match display aspect ratio (no weird scaling)
|
||||
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
glfwSetErrorCallback(ErrorCallback);
|
||||
@ -4100,8 +4100,8 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
// remember center for switchinging 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 dislpay, we can't calclulate the window pos for toggling fullscreened/windowed.
|
||||
// Toggling fullscreened/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;
|
||||
}
|
||||
@ -4138,7 +4138,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
// framebuffer is rendered correctly but once displayed on a 16:9 monitor, it gets stretched
|
||||
// by the sides to fit all monitor space...
|
||||
|
||||
// Try to setup the most appropiate fullscreen framebuffer for the requested screenWidth/screenHeight
|
||||
// Try to setup the most appropriate fullscreen framebuffer for the requested screenWidth/screenHeight
|
||||
// It considers device display resolution mode and setups a framebuffer with black bars if required (render size/offset)
|
||||
// Modified global variables: CORE.Window.screen.width/CORE.Window.screen.height - CORE.Window.render.width/CORE.Window.render.height - CORE.Window.renderOffset.x/CORE.Window.renderOffset.y - CORE.Window.screenScale
|
||||
// TODO: It is a quite cumbersome solution to display size vs requested size, it should be reviewed or removed...
|
||||
@ -4205,7 +4205,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
// NOTE: V-Sync can be enabled by graphic driver configuration
|
||||
if (CORE.Window.flags & FLAG_VSYNC_HINT)
|
||||
{
|
||||
// WARNING: It seems to hits a critical render path in Intel HD Graphics
|
||||
// WARNING: It seems to hit a critical render path in Intel HD Graphics
|
||||
glfwSwapInterval(1);
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable VSYNC");
|
||||
}
|
||||
@ -4216,12 +4216,12 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
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_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE);
|
||||
#if !defined(__APPLE__)
|
||||
glfwGetFramebufferSize(CORE.Window.handle, &fbWidth, &fbHeight);
|
||||
|
||||
// Screen scaling matrix is required in case desired screen area is different than display area
|
||||
// Screen scaling matrix is required in case desired screen area is different from display area
|
||||
CORE.Window.screenScale = MatrixScale((float)fbWidth/CORE.Window.screen.width, (float)fbHeight/CORE.Window.screen.height, 1.0f);
|
||||
|
||||
// Mouse input scaling for the new screen size
|
||||
@ -4819,7 +4819,7 @@ static void InitTimer(void)
|
||||
// NOTE: Sleep() granularity could be around 10 ms, it means, Sleep() could
|
||||
// take longer than expected... for that reason we use the busy wait loop
|
||||
// Ref: http://stackoverflow.com/questions/43057578/c-programming-win32-games-sleep-taking-longer-than-expected
|
||||
// Ref: http://www.geisswerks.com/ryan/FAQS/timing.html --> All about timming on Win32!
|
||||
// Ref: http://www.geisswerks.com/ryan/FAQS/timing.html --> All about timing on Win32!
|
||||
void WaitTime(double seconds)
|
||||
{
|
||||
#if defined(SUPPORT_BUSY_WAIT_LOOP) || defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
||||
@ -5414,7 +5414,7 @@ static void CharCallback(GLFWwindow *window, unsigned int key)
|
||||
//TRACELOG(LOG_DEBUG, "Char Callback: KEY:%i(%c)", key, key);
|
||||
|
||||
// NOTE: Registers any key down considering OS keyboard layout but
|
||||
// do not detects action events, those should be managed by user...
|
||||
// does not detect action events, those should be managed by user...
|
||||
// Ref: https://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
||||
// Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
||||
|
||||
@ -5457,7 +5457,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
|
||||
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
||||
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
||||
|
||||
// Gesture data is sent to gestures system for processing
|
||||
// Gesture data is sent to gestures-system for processing
|
||||
ProcessGestureEvent(gestureEvent);
|
||||
#endif
|
||||
}
|
||||
@ -5488,7 +5488,7 @@ static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
|
||||
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
||||
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
||||
|
||||
// Gesture data is sent to gestures system for processing
|
||||
// Gesture data is sent to gestures-system for processing
|
||||
ProcessGestureEvent(gestureEvent);
|
||||
#endif
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ static double rgGetCurrentTime(void);
|
||||
// Module Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Enable only desired getures to be detected
|
||||
// Enable only desired gestures to be detected
|
||||
void SetGesturesEnabled(unsigned int flags)
|
||||
{
|
||||
GESTURES.enabledFlags = flags;
|
||||
@ -300,7 +300,7 @@ void ProcessGestureEvent(GestureEvent event)
|
||||
{
|
||||
if (GESTURES.current == GESTURE_DRAG) GESTURES.Touch.upPosition = event.position[0];
|
||||
|
||||
// NOTE: GESTURES.Drag.intensity dependend on the resolution of the screen
|
||||
// NOTE: GESTURES.Drag.intensity dependent on the resolution of the screen
|
||||
GESTURES.Drag.distance = rgVector2Distance(GESTURES.Touch.downPositionA, GESTURES.Touch.upPosition);
|
||||
GESTURES.Drag.intensity = GESTURES.Drag.distance/(float)((rgGetCurrentTime() - GESTURES.Swipe.timeDuration));
|
||||
|
||||
@ -472,7 +472,7 @@ Vector2 GetGestureDragVector(void)
|
||||
}
|
||||
|
||||
// Get drag angle
|
||||
// NOTE: Angle in degrees, horizontal-right is 0, counterclock-wise
|
||||
// NOTE: Angle in degrees, horizontal-right is 0, counterclockwise
|
||||
float GetGestureDragAngle(void)
|
||||
{
|
||||
// NOTE: drag angle is calculated on one touch points TOUCH_ACTION_UP
|
||||
@ -488,8 +488,8 @@ Vector2 GetGesturePinchVector(void)
|
||||
return GESTURES.Pinch.vector;
|
||||
}
|
||||
|
||||
// Get angle beween two pinch points
|
||||
// NOTE: Angle in degrees, horizontal-right is 0, counterclock-wise
|
||||
// Get angle between two pinch points
|
||||
// NOTE: Angle in degrees, horizontal-right is 0, counterclockwise
|
||||
float GetGesturePinchAngle(void)
|
||||
{
|
||||
// NOTE: pinch angle is calculated on two touch points TOUCH_ACTION_MOVE
|
||||
|
@ -502,7 +502,7 @@ typedef enum {
|
||||
} rlShaderAttributeDataType;
|
||||
|
||||
// Framebuffer attachment type
|
||||
// NOTE: By default up to 8 color channels defined but it can be more
|
||||
// NOTE: By default up to 8 color channels defined, but it can be more
|
||||
typedef enum {
|
||||
RL_ATTACHMENT_COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0
|
||||
RL_ATTACHMENT_COLOR_CHANNEL1, // Framebuffer attachment type: color 1
|
||||
|
@ -1125,7 +1125,7 @@ void UnloadModel(Model model)
|
||||
|
||||
// Unload materials maps
|
||||
// NOTE: As the user could be sharing shaders and textures between models,
|
||||
// we don't unload the material but just free it's maps,
|
||||
// we don't unload the material but just free its maps,
|
||||
// the user is responsible for freeing models shaders and textures
|
||||
for (int i = 0; i < model.materialCount; i++) RL_FREE(model.materials[i].maps);
|
||||
|
||||
@ -1146,7 +1146,7 @@ void UnloadModelKeepMeshes(Model model)
|
||||
{
|
||||
// Unload materials maps
|
||||
// NOTE: As the user could be sharing shaders and textures between models,
|
||||
// we don't unload the material but just free it's maps,
|
||||
// we don't unload the material but just free its maps,
|
||||
// the user is responsible for freeing models shaders and textures
|
||||
for (int i = 0; i < model.materialCount; i++) RL_FREE(model.materials[i].maps);
|
||||
|
||||
@ -1230,7 +1230,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
|
||||
rlEnableVertexAttribute(1);
|
||||
|
||||
// WARNING: When setting default vertex attribute values, the values for each generic vertex attribute
|
||||
// is part of current state and it is maintained even if a different program object is used
|
||||
// is part of current state, and it is maintained even if a different program object is used
|
||||
|
||||
if (mesh->normals != NULL)
|
||||
{
|
||||
@ -1383,7 +1383,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||
}
|
||||
|
||||
// Get a copy of current matrices to work with,
|
||||
// just in case stereo render is required and we need to modify them
|
||||
// just in case stereo render is required, and we need to modify them
|
||||
// NOTE: At this point the modelview matrix just contains the view matrix (camera)
|
||||
// That's because BeginMode3D() sets it and there is no model-drawing function
|
||||
// that modifies it, all use rlPushMatrix() and rlPopMatrix()
|
||||
@ -1396,7 +1396,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||
if (material.shader.locs[SHADER_LOC_MATRIX_VIEW] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_VIEW], matView);
|
||||
if (material.shader.locs[SHADER_LOC_MATRIX_PROJECTION] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_PROJECTION], matProjection);
|
||||
|
||||
// Model transformation matrix is send to shader uniform location: SHADER_LOC_MATRIX_MODEL
|
||||
// Model transformation matrix is sent to shader uniform location: SHADER_LOC_MATRIX_MODEL
|
||||
if (material.shader.locs[SHADER_LOC_MATRIX_MODEL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_MODEL], transform);
|
||||
|
||||
// Accumulate several model transformations:
|
||||
@ -1517,7 +1517,7 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||
else rlDrawVertexArray(0, mesh.vertexCount);
|
||||
}
|
||||
|
||||
// Unbind all binded texture maps
|
||||
// Unbind all bound texture maps
|
||||
for (int i = 0; i < MAX_MATERIAL_MAPS; i++)
|
||||
{
|
||||
if (material.maps[i].texture.id > 0)
|
||||
@ -1587,7 +1587,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||
}
|
||||
|
||||
// Get a copy of current matrices to work with,
|
||||
// just in case stereo render is required and we need to modify them
|
||||
// just in case stereo render is required, and we need to modify them
|
||||
// NOTE: At this point the modelview matrix just contains the view matrix (camera)
|
||||
// That's because BeginMode3D() sets it and there is no model-drawing function
|
||||
// that modifies it, all use rlPushMatrix() and rlPopMatrix()
|
||||
@ -1738,7 +1738,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||
else rlDrawVertexArrayInstanced(0, mesh.vertexCount, instances);
|
||||
}
|
||||
|
||||
// Unbind all binded texture maps
|
||||
// Unbind all bound texture maps
|
||||
for (int i = 0; i < MAX_MATERIAL_MAPS; i++)
|
||||
{
|
||||
if (material.maps[i].texture.id > 0)
|
||||
@ -2559,7 +2559,7 @@ Mesh GenMeshSphere(float radius, int rings, int slices)
|
||||
return mesh;
|
||||
}
|
||||
|
||||
// Generate hemi-sphere mesh (half sphere, no bottom cap)
|
||||
// Generate hemisphere mesh (half sphere, no bottom cap)
|
||||
Mesh GenMeshHemiSphere(float radius, int rings, int slices)
|
||||
{
|
||||
Mesh mesh = { 0 };
|
||||
@ -3242,7 +3242,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
|
||||
}
|
||||
}
|
||||
|
||||
// Move data from mapVertices temp arays to vertices float array
|
||||
// Move data from mapVertices temp arrays to vertices float array
|
||||
mesh.vertexCount = vCounter;
|
||||
mesh.triangleCount = vCounter/3;
|
||||
|
||||
@ -3742,7 +3742,7 @@ RayCollision GetRayCollisionBox(Ray ray, BoundingBox box)
|
||||
// NOTE: We use an additional .01 to fix numerical errors
|
||||
collision.normal = Vector3Scale(collision.normal, 2.01f);
|
||||
collision.normal = Vector3Divide(collision.normal, Vector3Subtract(box.max, box.min));
|
||||
// The relevant elemets of the vector are now slightly larger than 1.0f (or smaller than -1.0f)
|
||||
// The relevant elements of the vector are now slightly larger than 1.0f (or smaller than -1.0f)
|
||||
// and the others are somewhere between -1.0 and 1.0 casting to int is exactly our wanted normal!
|
||||
collision.normal.x = (float)((int)collision.normal.x);
|
||||
collision.normal.y = (float)((int)collision.normal.y);
|
||||
@ -3842,7 +3842,7 @@ RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3
|
||||
// Calculate u parameter and test bound
|
||||
u = Vector3DotProduct(tv, p)*invDet;
|
||||
|
||||
// The intersection lies outside of the triangle
|
||||
// The intersection lies outside the triangle
|
||||
if ((u < 0.0f) || (u > 1.0f)) return collision;
|
||||
|
||||
// Prepare to test v parameter
|
||||
@ -3851,7 +3851,7 @@ RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3
|
||||
// Calculate V parameter and test bound
|
||||
v = Vector3DotProduct(ray.direction, q)*invDet;
|
||||
|
||||
// The intersection lies outside of the triangle
|
||||
// The intersection lies outside the triangle
|
||||
if ((v < 0.0f) || ((u + v) > 1.0f)) return collision;
|
||||
|
||||
t = Vector3DotProduct(edge2, q)*invDet;
|
||||
@ -4671,7 +4671,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
|
||||
{
|
||||
Image image = { 0 };
|
||||
|
||||
if (cgltfImage->uri != NULL) // Check if image data is provided as a uri (base64 or path)
|
||||
if (cgltfImage->uri != NULL) // Check if image data is provided as an uri (base64 or path)
|
||||
{
|
||||
if ((strlen(cgltfImage->uri) > 5) &&
|
||||
(cgltfImage->uri[0] == 'd') &&
|
||||
@ -4959,7 +4959,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
|
||||
for (unsigned int j = 0; j < data->meshes[i].primitives[p].attributes_count; j++)
|
||||
{
|
||||
// Check the different attributes for every pimitive
|
||||
// Check the different attributes for every primitive
|
||||
if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_position) // POSITION
|
||||
{
|
||||
cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
|
||||
@ -5110,7 +5110,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
{
|
||||
// The primitive actually keeps the pointer to the corresponding material,
|
||||
// raylib instead assigns to the mesh the by its index, as loaded in model.materials array
|
||||
// To get the index, we check if material pointers match and we assign the corresponding index,
|
||||
// To get the index, we check if material pointers match, and we assign the corresponding index,
|
||||
// skipping index 0, the default material
|
||||
if (&data->materials[m] == data->meshes[i].primitives[p].material)
|
||||
{
|
||||
@ -5613,7 +5613,7 @@ static Model LoadM3D(const char *fileName)
|
||||
// Materials are grouped together
|
||||
if (mi != m3d->face[i].materialid)
|
||||
{
|
||||
// there should be only one material switch per material kind, but be bulletproof for unoptimal model files
|
||||
// there should be only one material switch per material kind, but be bulletproof for non-optimal model files
|
||||
if (k + 1 >= model.meshCount)
|
||||
{
|
||||
model.meshCount++;
|
||||
@ -5838,7 +5838,7 @@ static Model LoadM3D(const char *fileName)
|
||||
}
|
||||
|
||||
// Load bone-pose default mesh into animation vertices. These will be updated when UpdateModelAnimation gets
|
||||
// called, but not before, however DrawMesh uses these if they exists (so not good if they are left empty).
|
||||
// called, but not before, however DrawMesh uses these if they exist (so not good if they are left empty).
|
||||
if (m3d->numbone && m3d->numskin)
|
||||
{
|
||||
for(i = 0; i < model.meshCount; i++)
|
||||
|
@ -978,7 +978,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co
|
||||
rlSetTexture(texShapes.id);
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
// Draw all of the 4 corners: [1] Upper Left Corner, [3] Upper Right Corner, [5] Lower Right Corner, [7] Lower Left Corner
|
||||
// Draw all the 4 corners: [1] Upper Left Corner, [3] Upper Right Corner, [5] Lower Right Corner, [7] Lower Left Corner
|
||||
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
|
||||
{
|
||||
float angle = angles[k];
|
||||
@ -1207,7 +1207,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo
|
||||
|
||||
rlBegin(RL_QUADS);
|
||||
|
||||
// Draw all of the 4 corners first: Upper Left Corner, Upper Right Corner, Lower Right Corner, Lower Left Corner
|
||||
// Draw all the 4 corners first: Upper Left Corner, Upper Right Corner, Lower Right Corner, Lower Left Corner
|
||||
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
|
||||
{
|
||||
float angle = angles[k];
|
||||
@ -1342,7 +1342,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo
|
||||
// Use LINES to draw the outline
|
||||
rlBegin(RL_LINES);
|
||||
|
||||
// Draw all of the 4 corners first: Upper Left Corner, Upper Right Corner, Lower Right Corner, Lower Left Corner
|
||||
// Draw all the 4 corners first: Upper Left Corner, Upper Right Corner, Lower Right Corner, Lower Left Corner
|
||||
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
|
||||
{
|
||||
float angle = angles[k];
|
||||
|
22
src/rtext.c
22
src/rtext.c
@ -65,7 +65,7 @@
|
||||
#include <stdio.h> // Required for: vsprintf()
|
||||
#include <string.h> // Required for: strcmp(), strstr(), strcpy(), strncpy() [Used in TextReplace()], sscanf() [Used in LoadBMFont()]
|
||||
#include <stdarg.h> // Required for: va_list, va_start(), vsprintf(), va_end() [Used in TextFormat()]
|
||||
#include <ctype.h> // Requried for: toupper(), tolower() [Used in TextToUpper(), TextToLower()]
|
||||
#include <ctype.h> // Required for: toupper(), tolower() [Used in TextToUpper(), TextToLower()]
|
||||
|
||||
#if defined(SUPPORT_FILEFORMAT_TTF)
|
||||
#define STB_RECT_PACK_IMPLEMENTATION
|
||||
@ -336,7 +336,7 @@ Font LoadFont(const char *fileName)
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextureFilter(font.texture, TEXTURE_FILTER_POINT); // By default we set point filter (best performance)
|
||||
SetTextureFilter(font.texture, TEXTURE_FILTER_POINT); // By default, we set point filter (the best performance)
|
||||
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", FONT_TTF_DEFAULT_SIZE, FONT_TTF_DEFAULT_NUMCHARS);
|
||||
}
|
||||
|
||||
@ -584,7 +584,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
|
||||
glyphCount = (glyphCount > 0)? glyphCount : 95;
|
||||
|
||||
// Fill fontChars in case not provided externally
|
||||
// NOTE: By default we fill glyphCount consecutevely, starting at 32 (Space)
|
||||
// NOTE: By default we fill glyphCount consecutively, starting at 32 (Space)
|
||||
|
||||
if (fontChars == NULL)
|
||||
{
|
||||
@ -647,7 +647,7 @@ GlyphInfo *LoadFontData(const unsigned char *fileData, int dataSize, int fontSiz
|
||||
}
|
||||
}
|
||||
|
||||
// Get bounding box for character (may be offset to account for chars that dip above or below the line)
|
||||
// Get bounding box for character (maybe offset to account for chars that dip above or below the line)
|
||||
/*
|
||||
int chX1, chY1, chX2, chY2;
|
||||
stbtt_GetCodepointBitmapBox(&fontInfo, ch, scaleFactor, scaleFactor, &chX1, &chY1, &chX2, &chY2);
|
||||
@ -777,7 +777,7 @@ Image GenImageFontAtlas(const GlyphInfo *chars, Rectangle **charRecs, int glyphC
|
||||
|
||||
for (int i = 0; i < glyphCount; i++)
|
||||
{
|
||||
// It return char rectangles in atlas
|
||||
// It returns char rectangles in atlas
|
||||
recs[i].x = rects[i].x + (float)padding;
|
||||
recs[i].y = rects[i].y + (float)padding;
|
||||
recs[i].width = (float)chars[i].image.width;
|
||||
@ -1040,7 +1040,7 @@ void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, f
|
||||
|
||||
int size = TextLength(text); // Total size in bytes of the text, scanned by codepoints in loop
|
||||
|
||||
int textOffsetY = 0; // Offset between lines (on line break '\n')
|
||||
int textOffsetY = 0; // Offset between lines (on linebreak '\n')
|
||||
float textOffsetX = 0.0f; // Offset X to next character to draw
|
||||
|
||||
float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
|
||||
@ -1053,7 +1053,7 @@ void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, f
|
||||
int index = GetGlyphIndex(font, codepoint);
|
||||
|
||||
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||
// but we need to draw all of the bad bytes using the '?' symbol moving one byte
|
||||
// but we need to draw all the bad bytes using the '?' symbol moving one byte
|
||||
if (codepoint == 0x3f) codepointByteCount = 1;
|
||||
|
||||
if (codepoint == '\n')
|
||||
@ -1119,7 +1119,7 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz
|
||||
// Draw multiple character (codepoints)
|
||||
void DrawTextCodepoints(Font font, const int *codepoints, int count, Vector2 position, float fontSize, float spacing, Color tint)
|
||||
{
|
||||
int textOffsetY = 0; // Offset between lines (on line break '\n')
|
||||
int textOffsetY = 0; // Offset between lines (on linebreak '\n')
|
||||
float textOffsetX = 0.0f; // Offset X to next character to draw
|
||||
|
||||
float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
|
||||
@ -1195,7 +1195,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
|
||||
index = GetGlyphIndex(font, letter);
|
||||
|
||||
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||
// but we need to draw all of the bad bytes using the '?' symbol so to not skip any we set next = 1
|
||||
// but we need to draw all the bad bytes using the '?' symbol so to not skip any we set next = 1
|
||||
if (letter == 0x3f) next = 1;
|
||||
i += next - 1;
|
||||
|
||||
@ -1410,7 +1410,7 @@ char *TextReplace(char *text, const char *replace, const char *by)
|
||||
char *insertPoint = NULL; // Next insert point
|
||||
char *temp = NULL; // Temp pointer
|
||||
int replaceLen = 0; // Replace string length of (the string to remove)
|
||||
int byLen = 0; // Replacement length (the string to replace replace by)
|
||||
int byLen = 0; // Replacement length (the string to replace by)
|
||||
int lastReplacePos = 0; // Distance between replace and end of last replace
|
||||
int count = 0; // Number of replacements
|
||||
|
||||
@ -1756,7 +1756,7 @@ const char *CodepointToUTF8(int codepoint, int *utf8Size)
|
||||
#endif // SUPPORT_TEXT_MANIPULATION
|
||||
|
||||
// Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found
|
||||
// When a invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned
|
||||
// When an invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned
|
||||
// Total number of bytes processed are returned as a parameter
|
||||
// NOTE: The standard says U+FFFD should be returned in case of errors
|
||||
// but that character is not supported by the default font in raylib
|
||||
|
@ -751,7 +751,7 @@ Image GenImageGradientRadial(int width, int height, float density, Color inner,
|
||||
float factor = (dist - radius*density)/(radius*(1.0f - density));
|
||||
|
||||
factor = (float)fmax(factor, 0.0f);
|
||||
factor = (float)fmin(factor, 1.f); // dist can be bigger than radius so we have to check
|
||||
factor = (float)fmin(factor, 1.f); // dist can be bigger than radius, so we have to check
|
||||
|
||||
pixels[y*width + x].r = (int)((float)outer.r*factor + (float)inner.r*(1.0f - factor));
|
||||
pixels[y*width + x].g = (int)((float)outer.g*factor + (float)inner.g*(1.0f - factor));
|
||||
@ -898,7 +898,7 @@ Image GenImageCellular(int width, int height, int tileSize)
|
||||
}
|
||||
}
|
||||
|
||||
// I made this up but it seems to give good results at all tile sizes
|
||||
// I made this up, but it seems to give good results at all tile sizes
|
||||
int intensity = (int)(minDistance*256.0f/tileSize);
|
||||
if (intensity > 255) intensity = 255;
|
||||
|
||||
@ -1176,7 +1176,7 @@ void ImageFormat(Image *image, int newFormat)
|
||||
} break;
|
||||
case PIXELFORMAT_UNCOMPRESSED_R32:
|
||||
{
|
||||
// WARNING: Image is converted to GRAYSCALE eqeuivalent 32bit
|
||||
// WARNING: Image is converted to GRAYSCALE equivalent 32bit
|
||||
|
||||
image->data = (float *)RL_MALLOC(image->width*image->height*sizeof(float));
|
||||
|
||||
@ -1214,7 +1214,7 @@ void ImageFormat(Image *image, int newFormat)
|
||||
RL_FREE(pixels);
|
||||
pixels = NULL;
|
||||
|
||||
// In case original image had mipmaps, generate mipmaps for formated image
|
||||
// In case original image had mipmaps, generate mipmaps for formatted image
|
||||
// NOTE: Original mipmaps are replaced by new ones, if custom mipmaps were used, they are lost
|
||||
if (image->mipmaps > 1)
|
||||
{
|
||||
@ -1269,7 +1269,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
||||
int size = (int)strlen(text); // Get size in bytes of text
|
||||
|
||||
int textOffsetX = 0; // Image drawing position X
|
||||
int textOffsetY = 0; // Offset between lines (on line break '\n')
|
||||
int textOffsetY = 0; // Offset between lines (on linebreak '\n')
|
||||
|
||||
// NOTE: Text image is generated at font base size, later scaled to desired font size
|
||||
Vector2 imSize = MeasureTextEx(font, text, (float)font.baseSize, spacing); // WARNING: Module required: rtext
|
||||
@ -1286,7 +1286,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
||||
int index = GetGlyphIndex(font, codepoint); // WARNING: Module required: rtext
|
||||
|
||||
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||
// but we need to draw all of the bad bytes using the '?' symbol moving one byte
|
||||
// but we need to draw all the bad bytes using the '?' symbol moving one byte
|
||||
if (codepoint == 0x3f) codepointByteCount = 1;
|
||||
|
||||
if (codepoint == '\n')
|
||||
@ -1331,7 +1331,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
||||
}
|
||||
|
||||
// Crop image depending on alpha value
|
||||
// NOTE: Threshold is defined as a percentatge: 0.0f -> 1.0f
|
||||
// NOTE: Threshold is defined as a percentage: 0.0f -> 1.0f
|
||||
void ImageAlphaCrop(Image *image, float threshold)
|
||||
{
|
||||
// Security check to avoid program crash
|
||||
@ -1711,7 +1711,7 @@ void ImageResize(Image *image, int newWidth, int newHeight)
|
||||
Color *pixels = LoadImageColors(*image);
|
||||
Color *output = (Color *)RL_MALLOC(newWidth*newHeight*sizeof(Color));
|
||||
|
||||
// NOTE: Color data is casted to (unsigned char *), there shouldn't been any problem...
|
||||
// NOTE: Color data is cast to (unsigned char *), there shouldn't been any problem...
|
||||
stbir_resize_uint8((unsigned char *)pixels, image->width, image->height, 0, (unsigned char *)output, newWidth, newHeight, 0, 4);
|
||||
|
||||
int format = image->format;
|
||||
@ -1891,7 +1891,7 @@ void ImageMipmaps(Image *image)
|
||||
}
|
||||
|
||||
// Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
// NOTE: In case selected bpp do not represent an known 16bit format,
|
||||
// NOTE: In case selected bpp do not represent a known 16bit format,
|
||||
// dithered data is stored in the LSB part of the unsigned short
|
||||
void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
||||
{
|
||||
@ -2531,7 +2531,7 @@ void UnloadImagePalette(Color *colors)
|
||||
}
|
||||
|
||||
// Get image alpha border rectangle
|
||||
// NOTE: Threshold is defined as a percentatge: 0.0f -> 1.0f
|
||||
// NOTE: Threshold is defined as a percentage: 0.0f -> 1.0f
|
||||
Rectangle GetImageAlphaBorder(Image image, float threshold)
|
||||
{
|
||||
Rectangle crop = { 0 };
|
||||
@ -3049,7 +3049,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
|
||||
if ((srcRec.y + srcRec.height) > src.height) srcRec.height = src.height - srcRec.y;
|
||||
|
||||
// Check if source rectangle needs to be resized to destination rectangle
|
||||
// In that case, we make a copy of source and we apply all required transform
|
||||
// In that case, we make a copy of source, and we apply all required transform
|
||||
if (((int)srcRec.width != (int)dstRec.width) || ((int)srcRec.height != (int)dstRec.height))
|
||||
{
|
||||
srcMod = ImageFromImage(src, srcRec); // Create image from another image
|
||||
@ -3273,7 +3273,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
|
||||
faces = GenImageColor(size, size*6, MAGENTA);
|
||||
ImageFormat(&faces, image.format);
|
||||
|
||||
// NOTE: Image formating does not work with compressed textures
|
||||
// NOTE: Image formatting does not work with compressed textures
|
||||
|
||||
for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
|
||||
}
|
||||
@ -3606,7 +3606,7 @@ void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2
|
||||
// NOTE: Vertex position can be transformed using matrices
|
||||
// but the process is way more costly than just calculating
|
||||
// the vertex positions manually, like done above.
|
||||
// I leave here the old implementation for educational pourposes,
|
||||
// I leave here the old implementation for educational purposes,
|
||||
// just in case someone wants to do some performance test
|
||||
/*
|
||||
rlSetTexture(texture.id);
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<html lang="EN-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
@ -63,10 +63,10 @@
|
||||
static int logTypeLevel = LOG_INFO; // Minimum log type level
|
||||
|
||||
static TraceLogCallback traceLog = NULL; // TraceLog callback function pointer
|
||||
static LoadFileDataCallback loadFileData = NULL; // LoadFileData callback funtion pointer
|
||||
static SaveFileDataCallback saveFileData = NULL; // SaveFileText callback funtion pointer
|
||||
static LoadFileTextCallback loadFileText = NULL; // LoadFileText callback funtion pointer
|
||||
static SaveFileTextCallback saveFileText = NULL; // SaveFileText callback funtion pointer
|
||||
static LoadFileDataCallback loadFileData = NULL; // LoadFileData callback function pointer
|
||||
static SaveFileDataCallback saveFileData = NULL; // SaveFileText callback function pointer
|
||||
static LoadFileTextCallback loadFileText = NULL; // LoadFileText callback function pointer
|
||||
static SaveFileTextCallback saveFileText = NULL; // SaveFileText callback function pointer
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Functions to set internal callbacks
|
||||
|
Loading…
x
Reference in New Issue
Block a user