Fixed some grammar mistakes.
This commit is contained in:
parent
e187b693ea
commit
3b5b6ccd18
|
|
@ -50,7 +50,7 @@
|
||||||
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
|
// 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.
|
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
|
||||||
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
#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
|
//#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
|
// 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
|
#define SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en-us">
|
<html lang="EN-us">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
|
|
||||||
14
src/raudio.c
14
src/raudio.c
|
|
@ -314,7 +314,7 @@ typedef enum {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOTE: Different logic is used when feeding data to the playback device
|
// 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 {
|
typedef enum {
|
||||||
AUDIO_BUFFER_USAGE_STATIC = 0,
|
AUDIO_BUFFER_USAGE_STATIC = 0,
|
||||||
AUDIO_BUFFER_USAGE_STREAM
|
AUDIO_BUFFER_USAGE_STREAM
|
||||||
|
|
@ -1089,7 +1089,7 @@ void PlaySoundMulti(Sound sound)
|
||||||
unsigned int oldAge = 0;
|
unsigned int oldAge = 0;
|
||||||
int oldIndex = -1;
|
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++)
|
for (int i = 0; i < MAX_AUDIO_BUFFER_POOL_CHANNELS; i++)
|
||||||
{
|
{
|
||||||
if (AUDIO.MultiChannel.channels[i] > oldAge)
|
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)
|
if (index == -1)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "SOUND: Buffer pool is already full, count: %i", AUDIO.MultiChannel.poolCounter);
|
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)
|
if (oldIndex == -1)
|
||||||
{
|
{
|
||||||
// Shouldn't be able to get here... but just in case something odd happens!
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2305,7 +2305,7 @@ static ma_uint32 ReadAudioBufferFramesInInternalFormat(AudioBuffer *audioBuffer,
|
||||||
|
|
||||||
if (currentSubBufferIndex > 1) return 0;
|
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
|
// we just take a copy here to try and avoid potential synchronization problems
|
||||||
bool isSubBufferProcessed[2] = { 0 };
|
bool isSubBufferProcessed[2] = { 0 };
|
||||||
isSubBufferProcessed[0] = audioBuffer->isSubBufferProcessed[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
|
// 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 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
|
// Unprocessed halves must keep their audio data in-tact
|
||||||
if (audioBuffer->usage == AUDIO_BUFFER_USAGE_STATIC)
|
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
|
// 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 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;
|
if (audioBuffer->usage != AUDIO_BUFFER_USAGE_STATIC) framesRead += totalFramesRemaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
14
src/raylib.h
14
src/raylib.h
|
|
@ -216,7 +216,7 @@ typedef struct Vector4 {
|
||||||
// Quaternion, 4 components (Vector4 alias)
|
// Quaternion, 4 components (Vector4 alias)
|
||||||
typedef Vector4 Quaternion;
|
typedef Vector4 Quaternion;
|
||||||
|
|
||||||
// Matrix, 4x4 components, column major, OpenGL style, right handed
|
// Matrix, 4x4 components, column major, OpenGL style, right-handed
|
||||||
typedef struct Matrix {
|
typedef struct Matrix {
|
||||||
float m0, m4, m8, m12; // Matrix first row (4 components)
|
float m0, m4, m8, m12; // Matrix first row (4 components)
|
||||||
float m1, m5, m9, m13; // Matrix second row (4 components)
|
float m1, m5, m9, m13; // Matrix second row (4 components)
|
||||||
|
|
@ -413,8 +413,8 @@ typedef struct Ray {
|
||||||
// RayCollision, ray hit information
|
// RayCollision, ray hit information
|
||||||
typedef struct RayCollision {
|
typedef struct RayCollision {
|
||||||
bool hit; // Did the ray hit something?
|
bool hit; // Did the ray hit something?
|
||||||
float distance; // Distance to nearest hit
|
float distance; // Distance to the nearest hit
|
||||||
Vector3 point; // Point of nearest hit
|
Vector3 point; // Point of the nearest hit
|
||||||
Vector3 normal; // Surface normal of hit
|
Vector3 normal; // Surface normal of hit
|
||||||
} RayCollision;
|
} RayCollision;
|
||||||
|
|
||||||
|
|
@ -681,7 +681,7 @@ typedef enum {
|
||||||
MOUSE_CURSOR_RESIZE_NS = 6, // Vertical resize/move arrow shape
|
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_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_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
|
MOUSE_CURSOR_NOT_ALLOWED = 10 // The operation-not-allowed shape
|
||||||
} MouseCursor;
|
} MouseCursor;
|
||||||
|
|
||||||
|
|
@ -839,7 +839,7 @@ typedef enum {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CUBEMAP_LAYOUT_AUTO_DETECT = 0, // Automatically detect layout type
|
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_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_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_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 (equirectangular map)
|
||||||
|
|
@ -903,7 +903,7 @@ typedef enum {
|
||||||
} NPatchLayout;
|
} NPatchLayout;
|
||||||
|
|
||||||
// Callbacks to hook some internal functions
|
// 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 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 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
|
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
|
// 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 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 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)
|
RLAPI Image LoadImageAnim(const char *fileName, int *frames); // Load image sequence from file (frames appended to image.data)
|
||||||
|
|
|
||||||
32
src/rcore.c
32
src/rcore.c
|
|
@ -864,7 +864,7 @@ void InitWindow(int width, int height, const char *title)
|
||||||
LoadFontDefault();
|
LoadFontDefault();
|
||||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||||
Rectangle rec = GetFontDefault().recs[95];
|
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
|
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 }); // WARNING: Module required: rshapes
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
@ -1416,13 +1416,13 @@ void SetWindowState(unsigned int flags)
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) != (flags & FLAG_WINDOW_TRANSPARENT)) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
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
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) != (flags & FLAG_WINDOW_HIGHDPI)) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
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
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
|
|
@ -1435,13 +1435,13 @@ void SetWindowState(unsigned int flags)
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
// 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))
|
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
|
// State change: FLAG_INTERLACED_HINT
|
||||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) != (flags & FLAG_INTERLACED_HINT)) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -1524,13 +1524,13 @@ void ClearWindowState(unsigned int flags)
|
||||||
// State change: FLAG_WINDOW_TRANSPARENT
|
// State change: FLAG_WINDOW_TRANSPARENT
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) && ((flags & FLAG_WINDOW_TRANSPARENT) > 0))
|
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
|
// State change: FLAG_WINDOW_HIGHDPI
|
||||||
if (((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) && ((flags & FLAG_WINDOW_HIGHDPI) > 0))
|
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
|
// State change: FLAG_WINDOW_MOUSE_PASSTHROUGH
|
||||||
|
|
@ -1543,13 +1543,13 @@ void ClearWindowState(unsigned int flags)
|
||||||
// State change: FLAG_MSAA_4X_HINT
|
// State change: FLAG_MSAA_4X_HINT
|
||||||
if (((CORE.Window.flags & FLAG_MSAA_4X_HINT) > 0) && ((flags & FLAG_MSAA_4X_HINT) > 0))
|
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
|
// State change: FLAG_INTERLACED_HINT
|
||||||
if (((CORE.Window.flags & FLAG_INTERLACED_HINT) > 0) && ((flags & FLAG_INTERLACED_HINT) > 0))
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -2807,7 +2807,7 @@ double GetTime(void)
|
||||||
|
|
||||||
// Setup window configuration flags (view FLAGS)
|
// Setup window configuration flags (view FLAGS)
|
||||||
// NOTE: This function is expected to be called before window creation,
|
// 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()
|
// To configure window states after creation, just use SetWindowState()
|
||||||
void SetConfigFlags(unsigned int flags)
|
void SetConfigFlags(unsigned int flags)
|
||||||
{
|
{
|
||||||
|
|
@ -4204,7 +4204,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
// NOTE: V-Sync can be enabled by graphic driver configuration
|
// NOTE: V-Sync can be enabled by graphic driver configuration
|
||||||
if (CORE.Window.flags & FLAG_VSYNC_HINT)
|
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);
|
glfwSwapInterval(1);
|
||||||
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable VSYNC");
|
TRACELOG(LOG_INFO, "DISPLAY: Trying to enable VSYNC");
|
||||||
}
|
}
|
||||||
|
|
@ -4215,12 +4215,12 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
|
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);
|
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE);
|
||||||
#if !defined(__APPLE__)
|
#if !defined(__APPLE__)
|
||||||
glfwGetFramebufferSize(CORE.Window.handle, &fbWidth, &fbHeight);
|
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);
|
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
|
// Mouse input scaling for the new screen size
|
||||||
|
|
@ -5413,7 +5413,7 @@ static void CharCallback(GLFWwindow *window, unsigned int key)
|
||||||
//TRACELOG(LOG_DEBUG, "Char Callback: KEY:%i(%c)", key, key);
|
//TRACELOG(LOG_DEBUG, "Char Callback: KEY:%i(%c)", key, key);
|
||||||
|
|
||||||
// NOTE: Registers any key down considering OS keyboard layout but
|
// 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://github.com/glfw/glfw/issues/668#issuecomment-166794907
|
||||||
// Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
// Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char
|
||||||
|
|
||||||
|
|
@ -5456,7 +5456,7 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
|
||||||
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
||||||
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
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);
|
ProcessGestureEvent(gestureEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -5487,7 +5487,7 @@ static void MouseCursorPosCallback(GLFWwindow *window, double x, double y)
|
||||||
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
gestureEvent.position[0].x /= (float)GetScreenWidth();
|
||||||
gestureEvent.position[0].y /= (float)GetScreenHeight();
|
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);
|
ProcessGestureEvent(gestureEvent);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -502,7 +502,7 @@ typedef enum {
|
||||||
} rlShaderAttributeDataType;
|
} rlShaderAttributeDataType;
|
||||||
|
|
||||||
// Framebuffer attachment type
|
// 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 {
|
typedef enum {
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0
|
RL_ATTACHMENT_COLOR_CHANNEL0 = 0, // Framebuffer attachment type: color 0
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL1, // Framebuffer attachment type: color 1
|
RL_ATTACHMENT_COLOR_CHANNEL1, // Framebuffer attachment type: color 1
|
||||||
|
|
|
||||||
|
|
@ -1125,7 +1125,7 @@ void UnloadModel(Model model)
|
||||||
|
|
||||||
// Unload materials maps
|
// Unload materials maps
|
||||||
// NOTE: As the user could be sharing shaders and textures between models,
|
// 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
|
// the user is responsible for freeing models shaders and textures
|
||||||
for (int i = 0; i < model.materialCount; i++) RL_FREE(model.materials[i].maps);
|
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
|
// Unload materials maps
|
||||||
// NOTE: As the user could be sharing shaders and textures between models,
|
// 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
|
// the user is responsible for freeing models shaders and textures
|
||||||
for (int i = 0; i < model.materialCount; i++) RL_FREE(model.materials[i].maps);
|
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);
|
rlEnableVertexAttribute(1);
|
||||||
|
|
||||||
// WARNING: When setting default vertex attribute values, the values for each generic vertex attribute
|
// 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)
|
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,
|
// 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)
|
// 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's because BeginMode3D() sets it and there is no model-drawing function
|
||||||
// that modifies it, all use rlPushMatrix() and rlPopMatrix()
|
// 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_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);
|
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);
|
if (material.shader.locs[SHADER_LOC_MATRIX_MODEL] != -1) rlSetUniformMatrix(material.shader.locs[SHADER_LOC_MATRIX_MODEL], transform);
|
||||||
|
|
||||||
// Accumulate several model transformations:
|
// Accumulate several model transformations:
|
||||||
|
|
@ -1587,7 +1587,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a copy of current matrices to work with,
|
// 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)
|
// 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's because BeginMode3D() sets it and there is no model-drawing function
|
||||||
// that modifies it, all use rlPushMatrix() and rlPopMatrix()
|
// that modifies it, all use rlPushMatrix() and rlPopMatrix()
|
||||||
|
|
@ -3842,7 +3842,7 @@ RayCollision GetRayCollisionTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3
|
||||||
// Calculate u parameter and test bound
|
// Calculate u parameter and test bound
|
||||||
u = Vector3DotProduct(tv, p)*invDet;
|
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;
|
if ((u < 0.0f) || (u > 1.0f)) return collision;
|
||||||
|
|
||||||
// Prepare to test v parameter
|
// 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
|
// Calculate V parameter and test bound
|
||||||
v = Vector3DotProduct(ray.direction, q)*invDet;
|
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;
|
if ((v < 0.0f) || ((u + v) > 1.0f)) return collision;
|
||||||
|
|
||||||
t = Vector3DotProduct(edge2, q)*invDet;
|
t = Vector3DotProduct(edge2, q)*invDet;
|
||||||
|
|
@ -4671,7 +4671,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat
|
||||||
{
|
{
|
||||||
Image image = { 0 };
|
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) &&
|
if ((strlen(cgltfImage->uri) > 5) &&
|
||||||
(cgltfImage->uri[0] == 'd') &&
|
(cgltfImage->uri[0] == 'd') &&
|
||||||
|
|
@ -5110,7 +5110,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
{
|
{
|
||||||
// The primitive actually keeps the pointer to the corresponding material,
|
// 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
|
// 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
|
// skipping index 0, the default material
|
||||||
if (&data->materials[m] == data->meshes[i].primitives[p].material)
|
if (&data->materials[m] == data->meshes[i].primitives[p].material)
|
||||||
{
|
{
|
||||||
|
|
@ -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
|
// 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)
|
if (m3d->numbone && m3d->numskin)
|
||||||
{
|
{
|
||||||
for(i = 0; i < model.meshCount; i++)
|
for(i = 0; i < model.meshCount; i++)
|
||||||
|
|
|
||||||
|
|
@ -978,7 +978,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co
|
||||||
rlSetTexture(texShapes.id);
|
rlSetTexture(texShapes.id);
|
||||||
|
|
||||||
rlBegin(RL_QUADS);
|
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
|
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
|
||||||
{
|
{
|
||||||
float angle = angles[k];
|
float angle = angles[k];
|
||||||
|
|
@ -1207,7 +1207,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo
|
||||||
|
|
||||||
rlBegin(RL_QUADS);
|
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
|
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
|
||||||
{
|
{
|
||||||
float angle = angles[k];
|
float angle = angles[k];
|
||||||
|
|
@ -1342,7 +1342,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, flo
|
||||||
// Use LINES to draw the outline
|
// Use LINES to draw the outline
|
||||||
rlBegin(RL_LINES);
|
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
|
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
|
||||||
{
|
{
|
||||||
float angle = angles[k];
|
float angle = angles[k];
|
||||||
|
|
|
||||||
18
src/rtext.c
18
src/rtext.c
|
|
@ -336,7 +336,7 @@ Font LoadFont(const char *fileName)
|
||||||
}
|
}
|
||||||
else
|
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);
|
TRACELOG(LOG_INFO, "FONT: Data loaded successfully (%i pixel size | %i glyphs)", FONT_TTF_DEFAULT_SIZE, FONT_TTF_DEFAULT_NUMCHARS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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;
|
int chX1, chY1, chX2, chY2;
|
||||||
stbtt_GetCodepointBitmapBox(&fontInfo, ch, scaleFactor, scaleFactor, &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++)
|
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].x = rects[i].x + (float)padding;
|
||||||
recs[i].y = rects[i].y + (float)padding;
|
recs[i].y = rects[i].y + (float)padding;
|
||||||
recs[i].width = (float)chars[i].image.width;
|
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 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 textOffsetX = 0.0f; // Offset X to next character to draw
|
||||||
|
|
||||||
float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
|
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);
|
int index = GetGlyphIndex(font, codepoint);
|
||||||
|
|
||||||
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
// NOTE: Normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||||
// 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 == 0x3f) codepointByteCount = 1;
|
||||||
|
|
||||||
if (codepoint == '\n')
|
if (codepoint == '\n')
|
||||||
|
|
@ -1119,7 +1119,7 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz
|
||||||
// Draw multiple character (codepoints)
|
// Draw multiple character (codepoints)
|
||||||
void DrawTextCodepoints(Font font, const int *codepoints, int count, Vector2 position, float fontSize, float spacing, Color tint)
|
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 textOffsetX = 0.0f; // Offset X to next character to draw
|
||||||
|
|
||||||
float scaleFactor = fontSize/font.baseSize; // Character quad scaling factor
|
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);
|
index = GetGlyphIndex(font, letter);
|
||||||
|
|
||||||
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
// NOTE: normally we exit the decoding sequence as soon as a bad byte is found (and return 0x3f)
|
||||||
// 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;
|
if (letter == 0x3f) next = 1;
|
||||||
i += 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 *insertPoint = NULL; // Next insert point
|
||||||
char *temp = NULL; // Temp pointer
|
char *temp = NULL; // Temp pointer
|
||||||
int replaceLen = 0; // Replace string length of (the string to remove)
|
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 lastReplacePos = 0; // Distance between replace and end of last replace
|
||||||
int count = 0; // Number of replacements
|
int count = 0; // Number of replacements
|
||||||
|
|
||||||
|
|
@ -1756,7 +1756,7 @@ const char *CodepointToUTF8(int codepoint, int *utf8Size)
|
||||||
#endif // SUPPORT_TEXT_MANIPULATION
|
#endif // SUPPORT_TEXT_MANIPULATION
|
||||||
|
|
||||||
// Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found
|
// 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
|
// Total number of bytes processed are returned as a parameter
|
||||||
// NOTE: The standard says U+FFFD should be returned in case of errors
|
// 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
|
// 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));
|
float factor = (dist - radius*density)/(radius*(1.0f - density));
|
||||||
|
|
||||||
factor = (float)fmax(factor, 0.0f);
|
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].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));
|
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);
|
int intensity = (int)(minDistance*256.0f/tileSize);
|
||||||
if (intensity > 255) intensity = 255;
|
if (intensity > 255) intensity = 255;
|
||||||
|
|
||||||
|
|
@ -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 size = (int)strlen(text); // Get size in bytes of text
|
||||||
|
|
||||||
int textOffsetX = 0; // Image drawing position X
|
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
|
// 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
|
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
|
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)
|
// 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 == 0x3f) codepointByteCount = 1;
|
||||||
|
|
||||||
if (codepoint == '\n')
|
if (codepoint == '\n')
|
||||||
|
|
@ -1711,7 +1711,7 @@ void ImageResize(Image *image, int newWidth, int newHeight)
|
||||||
Color *pixels = LoadImageColors(*image);
|
Color *pixels = LoadImageColors(*image);
|
||||||
Color *output = (Color *)RL_MALLOC(newWidth*newHeight*sizeof(Color));
|
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);
|
stbir_resize_uint8((unsigned char *)pixels, image->width, image->height, 0, (unsigned char *)output, newWidth, newHeight, 0, 4);
|
||||||
|
|
||||||
int format = image->format;
|
int format = image->format;
|
||||||
|
|
@ -1891,7 +1891,7 @@ void ImageMipmaps(Image *image)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
// 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
|
// dithered data is stored in the LSB part of the unsigned short
|
||||||
void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
||||||
{
|
{
|
||||||
|
|
@ -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;
|
if ((srcRec.y + srcRec.height) > src.height) srcRec.height = src.height - srcRec.y;
|
||||||
|
|
||||||
// Check if source rectangle needs to be resized to destination rectangle
|
// 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))
|
if (((int)srcRec.width != (int)dstRec.width) || ((int)srcRec.height != (int)dstRec.height))
|
||||||
{
|
{
|
||||||
srcMod = ImageFromImage(src, srcRec); // Create image from another image
|
srcMod = ImageFromImage(src, srcRec); // Create image from another image
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en-us">
|
<html lang="EN-us">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user