Merge branch 'master' of https://github.com/raysan5/raylib
merge with the raylib origin
This commit is contained in:
commit
c284f53487
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
precision mediump float;
|
||||
|
||||
const int colors = 8;
|
||||
const int MAX_INDEXED_COLORS = 8;
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
varying vec2 fragTexCoord;
|
||||
|
|
@ -10,7 +10,8 @@ varying vec4 fragColor;
|
|||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform ivec3 palette[colors];
|
||||
uniform ivec3 palette[MAX_INDEXED_COLORS];
|
||||
//uniform sampler2D palette; // Alternative to ivec3, palette provided as a 256x1 texture
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -18,13 +19,13 @@ void main()
|
|||
vec4 texelColor = texture2D(texture0, fragTexCoord)*fragColor;
|
||||
|
||||
// Convert the (normalized) texel color RED component (GB would work, too)
|
||||
// to the palette index by scaling up from [0, 1] to [0, 255].
|
||||
// to the palette index by scaling up from [0..1] to [0..255]
|
||||
int index = int(texelColor.r*255.0);
|
||||
|
||||
ivec3 color = ivec3(0);
|
||||
|
||||
// NOTE: On GLSL 100 we are not allowed to index a uniform array by a variable value,
|
||||
// a constantmust be used, so this logic...
|
||||
// a constant must be used, so this logic...
|
||||
if (index == 0) color = palette[0];
|
||||
else if (index == 1) color = palette[1];
|
||||
else if (index == 2) color = palette[2];
|
||||
|
|
@ -34,8 +35,9 @@ void main()
|
|||
else if (index == 6) color = palette[6];
|
||||
else if (index == 7) color = palette[7];
|
||||
|
||||
//gl_FragColor = texture2D(palette, texelColor.xy); // Alternative to ivec3
|
||||
|
||||
// Calculate final fragment color. Note that the palette color components
|
||||
// are defined in the range [0, 255] and need to be normalized to [0, 1]
|
||||
// for OpenGL to work.
|
||||
// are defined in the range [0..255] and need to be normalized to [0..1]
|
||||
gl_FragColor = vec4(float(color.x)/255.0, float(color.y)/255.0, float(color.z)/255.0, texelColor.a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#version 330
|
||||
|
||||
const int colors = 8;
|
||||
const int MAX_INDEXED_COLORS = 8;
|
||||
|
||||
// Input fragment attributes (from fragment shader)
|
||||
in vec2 fragTexCoord;
|
||||
|
|
@ -8,7 +8,8 @@ in vec4 fragColor;
|
|||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform ivec3 palette[colors];
|
||||
uniform ivec3 palette[MAX_INDEXED_COLORS];
|
||||
//uniform sampler2D palette; // Alternative to ivec3, palette provided as a 256x1 texture
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
|
@ -16,15 +17,17 @@ out vec4 finalColor;
|
|||
void main()
|
||||
{
|
||||
// Texel color fetching from texture sampler
|
||||
// NOTE: The texel is actually the a GRAYSCALE index color
|
||||
vec4 texelColor = texture(texture0, fragTexCoord)*fragColor;
|
||||
|
||||
// Convert the (normalized) texel color RED component (GB would work, too)
|
||||
// to the palette index by scaling up from [0, 1] to [0, 255].
|
||||
// to the palette index by scaling up from [0..1] to [0..255]
|
||||
int index = int(texelColor.r*255.0);
|
||||
ivec3 color = palette[index];
|
||||
|
||||
//finalColor = texture(palette, texelColor.xy); // Alternative to ivec3
|
||||
|
||||
// Calculate final fragment color. Note that the palette color components
|
||||
// are defined in the range [0, 255] and need to be normalized to [0, 1]
|
||||
// for OpenGL to work.
|
||||
// are defined in the range [0..255] and need to be normalized to [0..1]
|
||||
finalColor = vec4(color/255.0, texelColor.a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2254,7 +2254,7 @@
|
|||
{
|
||||
"name": "GAMEPAD_BUTTON_RIGHT_TRIGGER_1",
|
||||
"value": 11,
|
||||
"description": "Gamepad top/back trigger right (one), it could be a trailing button"
|
||||
"description": "Gamepad top/back trigger right (first), it could be a trailing button"
|
||||
},
|
||||
{
|
||||
"name": "GAMEPAD_BUTTON_RIGHT_TRIGGER_2",
|
||||
|
|
|
|||
|
|
@ -2254,7 +2254,7 @@ return {
|
|||
{
|
||||
name = "GAMEPAD_BUTTON_RIGHT_TRIGGER_1",
|
||||
value = 11,
|
||||
description = "Gamepad top/back trigger right (one), it could be a trailing button"
|
||||
description = "Gamepad top/back trigger right (first), it could be a trailing button"
|
||||
},
|
||||
{
|
||||
name = "GAMEPAD_BUTTON_RIGHT_TRIGGER_2",
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@
|
|||
<Value name="GAMEPAD_BUTTON_RIGHT_FACE_LEFT" integer="8" desc="Gamepad right button left (i.e. PS3: Square, Xbox: X)" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_TRIGGER_1" integer="9" desc="Gamepad top/back trigger left (first), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_LEFT_TRIGGER_2" integer="10" desc="Gamepad top/back trigger left (second), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_TRIGGER_1" integer="11" desc="Gamepad top/back trigger right (one), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_TRIGGER_1" integer="11" desc="Gamepad top/back trigger right (first), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_RIGHT_TRIGGER_2" integer="12" desc="Gamepad top/back trigger right (second), it could be a trailing button" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE_LEFT" integer="13" desc="Gamepad center buttons, left one (i.e. PS3: Select)" />
|
||||
<Value name="GAMEPAD_BUTTON_MIDDLE" integer="14" desc="Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)" />
|
||||
|
|
|
|||
4
src/external/rl_gputex.h
vendored
4
src/external/rl_gputex.h
vendored
|
|
@ -229,7 +229,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (header->ddspf.flags == 0x40 && header->ddspf.rgb_bit_count == 24) // DDS_RGB, no compressed
|
||||
else if ((header->ddspf.flags == 0x40) && (header->ddspf.rgb_bit_count == 24)) // DDS_RGB, no compressed
|
||||
{
|
||||
int data_size = image_pixel_size*3*sizeof(unsigned char);
|
||||
image_data = RL_MALLOC(data_size);
|
||||
|
|
@ -238,7 +238,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
|||
|
||||
*format = PIXELFORMAT_UNCOMPRESSED_R8G8B8;
|
||||
}
|
||||
else if (header->ddspf.flags == 0x41 && header->ddspf.rgb_bit_count == 32) // DDS_RGBA, no compressed
|
||||
else if ((header->ddspf.flags == 0x41) && (header->ddspf.rgb_bit_count == 32)) // DDS_RGBA, no compressed
|
||||
{
|
||||
int data_size = image_pixel_size*4*sizeof(unsigned char);
|
||||
image_data = RL_MALLOC(data_size);
|
||||
|
|
|
|||
11
src/external/rprand.h
vendored
11
src/external/rprand.h
vendored
|
|
@ -147,8 +147,13 @@ RPRANDAPI void rprand_unload_sequence(int *sequence); // Unload pseudo
|
|||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
static uint64_t rprand_seed = 0; // SplitMix64 actual seed
|
||||
static uint32_t rprand_state[4] = { 0 }; // Xoshiro128** state, nitialized by SplitMix64
|
||||
static uint64_t rprand_seed = 0xAABBCCDD; // SplitMix64 default seed (aligned to rprand_state)
|
||||
static uint32_t rprand_state[4] = { // Xoshiro128** state, initialized by SplitMix64
|
||||
0x96ea83c1,
|
||||
0x218b21e5,
|
||||
0xaa91febd,
|
||||
0x976414d4
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module internal functions declaration
|
||||
|
|
@ -202,7 +207,7 @@ int *rprand_load_sequence(unsigned int count, int min, int max)
|
|||
{
|
||||
value = ((unsigned int)rprand_xoshiro()%(abs(max - min) + 1)) + min;
|
||||
|
||||
for (int j = 0; j < i; j++)
|
||||
for (unsigned int j = 0; j < i; j++)
|
||||
{
|
||||
if (sequence[j] == value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1218,6 +1218,19 @@ void PollInputEvents(void)
|
|||
// Module Internal Functions Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
static void SetDimensionsFromMonitor(GLFWmonitor *monitor)
|
||||
{
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitor);
|
||||
|
||||
// Default display resolution to that of the current mode
|
||||
CORE.Window.display.width = mode->width;
|
||||
CORE.Window.display.height = mode->height;
|
||||
|
||||
// Set screen width/height to the display width/height if they are 0
|
||||
if (CORE.Window.screen.width == 0) CORE.Window.screen.width = CORE.Window.display.width;
|
||||
if (CORE.Window.screen.height == 0) CORE.Window.screen.height = CORE.Window.display.height;
|
||||
}
|
||||
|
||||
// Initialize platform: graphics, inputs and more
|
||||
int InitPlatform(void)
|
||||
{
|
||||
|
|
@ -1358,26 +1371,22 @@ int InitPlatform(void)
|
|||
// REF: https://github.com/raysan5/raylib/issues/1554
|
||||
glfwSetJoystickCallback(NULL);
|
||||
|
||||
// Find monitor resolution
|
||||
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||
if (!monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GLFW: Failed to get primary monitor");
|
||||
return -1;
|
||||
}
|
||||
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitor);
|
||||
|
||||
CORE.Window.display.width = mode->width;
|
||||
CORE.Window.display.height = mode->height;
|
||||
|
||||
// Set screen width/height to the display width/height if they are 0
|
||||
if (CORE.Window.screen.width == 0) CORE.Window.screen.width = CORE.Window.display.width;
|
||||
if (CORE.Window.screen.height == 0) CORE.Window.screen.height = CORE.Window.display.height;
|
||||
|
||||
GLFWmonitor *monitor = NULL;
|
||||
if (CORE.Window.fullscreen)
|
||||
{
|
||||
// Remember center for switchinging from fullscreen to window
|
||||
// According to glfwCreateWindow(), if the user does not have a choice, fullscreen applications
|
||||
// should default to the primary monitor.
|
||||
|
||||
monitor = glfwGetPrimaryMonitor();
|
||||
if (!monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GLFW: Failed to get primary monitor");
|
||||
return -1;
|
||||
}
|
||||
|
||||
SetDimensionsFromMonitor(monitor);
|
||||
|
||||
// Remember center for switching from fullscreen to window
|
||||
if ((CORE.Window.screen.height == CORE.Window.display.height) && (CORE.Window.screen.width == CORE.Window.display.width))
|
||||
{
|
||||
// If screen width/height equal to the display, we can't calculate the window pos for toggling full-screened/windowed.
|
||||
|
|
@ -1396,7 +1405,7 @@ int InitPlatform(void)
|
|||
|
||||
// Obtain recommended CORE.Window.display.width/CORE.Window.display.height from a valid videomode for the monitor
|
||||
int count = 0;
|
||||
const GLFWvidmode *modes = glfwGetVideoModes(glfwGetPrimaryMonitor(), &count);
|
||||
const GLFWvidmode *modes = glfwGetVideoModes(monitor, &count);
|
||||
|
||||
// Get closest video mode to desired CORE.Window.screen.width/CORE.Window.screen.height
|
||||
for (int i = 0; i < count; i++)
|
||||
|
|
@ -1426,21 +1435,55 @@ int InitPlatform(void)
|
|||
// HighDPI monitors are properly considered in a following similar function: SetupViewport()
|
||||
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
platform.handle = glfwCreateWindow(CORE.Window.display.width, CORE.Window.display.height, (CORE.Window.title != 0)? CORE.Window.title : " ", glfwGetPrimaryMonitor(), NULL);
|
||||
platform.handle = glfwCreateWindow(CORE.Window.display.width, CORE.Window.display.height, (CORE.Window.title != 0)? CORE.Window.title : " ", monitor, NULL);
|
||||
|
||||
// NOTE: Full-screen change, not working properly...
|
||||
//glfwSetWindowMonitor(platform.handle, glfwGetPrimaryMonitor(), 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we are windowed fullscreen, ensures that window does not minimize when focus is lost
|
||||
if ((CORE.Window.screen.height == CORE.Window.display.height) && (CORE.Window.screen.width == CORE.Window.display.width))
|
||||
// No-fullscreen window creation
|
||||
bool wantWindowedFullscreen = (CORE.Window.screen.height == 0) && (CORE.Window.screen.width == 0);
|
||||
|
||||
// If we are windowed fullscreen, ensures that window does not minimize when focus is lost.
|
||||
// This hinting code will not work if the user already specified the correct monitor dimensions;
|
||||
// at this point we don't know the monitor's dimensions. (Though, how did the user then?)
|
||||
if (wantWindowedFullscreen)
|
||||
{
|
||||
glfwWindowHint(GLFW_AUTO_ICONIFY, 0);
|
||||
}
|
||||
|
||||
// No-fullscreen window creation
|
||||
platform.handle = glfwCreateWindow(CORE.Window.screen.width, CORE.Window.screen.height, (CORE.Window.title != 0)? CORE.Window.title : " ", NULL, NULL);
|
||||
// Default to at least one pixel in size, as creation with a zero dimension is not allowed.
|
||||
int creationWidth = CORE.Window.screen.width != 0 ? CORE.Window.screen.width : 1;
|
||||
int creationHeight = CORE.Window.screen.height != 0 ? CORE.Window.screen.height : 1;
|
||||
|
||||
platform.handle = glfwCreateWindow(creationWidth, creationHeight, (CORE.Window.title != 0)? CORE.Window.title : " ", NULL, NULL);
|
||||
|
||||
// After the window was created, determine the monitor that the window manager assigned.
|
||||
// Derive display sizes, and, if possible, window size in case it was zero at beginning.
|
||||
|
||||
int monitorCount = 0;
|
||||
int monitorIndex = GetCurrentMonitor();
|
||||
GLFWmonitor **monitors = glfwGetMonitors(&monitorCount);
|
||||
|
||||
if (monitorIndex < monitorCount)
|
||||
{
|
||||
monitor = monitors[monitorIndex];
|
||||
SetDimensionsFromMonitor(monitor);
|
||||
|
||||
TRACELOG(LOG_INFO, "wantWindowed: %d, size: %dx%d", wantWindowedFullscreen, CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
if (wantWindowedFullscreen)
|
||||
{
|
||||
glfwSetWindowSize(platform.handle, CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The monitor for the window-manager-created window can not be determined, so it can not be centered.
|
||||
glfwTerminate();
|
||||
TRACELOG(LOG_WARNING, "GLFW: Failed to determine Monitor to center Window");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (platform.handle)
|
||||
{
|
||||
|
|
@ -1524,8 +1567,8 @@ int InitPlatform(void)
|
|||
int monitorHeight = 0;
|
||||
glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight);
|
||||
|
||||
int posX = monitorX + (monitorWidth - CORE.Window.screen.width)/2;
|
||||
int posY = monitorY + (monitorHeight - CORE.Window.screen.height)/2;
|
||||
int posX = monitorX + (monitorWidth - (int)CORE.Window.screen.width)/2;
|
||||
int posY = monitorY + (monitorHeight - (int)CORE.Window.screen.height)/2;
|
||||
if (posX < monitorX) posX = monitorX;
|
||||
if (posY < monitorY) posY = monitorY;
|
||||
SetWindowPosition(posX, posY);
|
||||
|
|
|
|||
|
|
@ -726,7 +726,7 @@ typedef enum {
|
|||
GAMEPAD_BUTTON_RIGHT_FACE_LEFT, // Gamepad right button left (i.e. PS3: Square, Xbox: X)
|
||||
GAMEPAD_BUTTON_LEFT_TRIGGER_1, // Gamepad top/back trigger left (first), it could be a trailing button
|
||||
GAMEPAD_BUTTON_LEFT_TRIGGER_2, // Gamepad top/back trigger left (second), it could be a trailing button
|
||||
GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // Gamepad top/back trigger right (one), it could be a trailing button
|
||||
GAMEPAD_BUTTON_RIGHT_TRIGGER_1, // Gamepad top/back trigger right (first), it could be a trailing button
|
||||
GAMEPAD_BUTTON_RIGHT_TRIGGER_2, // Gamepad top/back trigger right (second), it could be a trailing button
|
||||
GAMEPAD_BUTTON_MIDDLE_LEFT, // Gamepad center buttons, left one (i.e. PS3: Select)
|
||||
GAMEPAD_BUTTON_MIDDLE, // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
|
||||
|
|
|
|||
42
src/rlgl.h
42
src/rlgl.h
|
|
@ -322,6 +322,26 @@
|
|||
#define RL_READ_FRAMEBUFFER 0x8CA8 // GL_READ_FRAMEBUFFER
|
||||
#define RL_DRAW_FRAMEBUFFER 0x8CA9 // GL_DRAW_FRAMEBUFFER
|
||||
|
||||
// Default shader vertex attribute locations
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -934,26 +954,6 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// Default shader vertex attribute locations
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR 3
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT 4
|
||||
#endif
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 5
|
||||
#endif
|
||||
|
||||
// Default shader vertex attribute names to set location points
|
||||
#ifndef RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION
|
||||
|
|
@ -1296,7 +1296,7 @@ void rlMultMatrixf(const float *matf)
|
|||
matf[2], matf[6], matf[10], matf[14],
|
||||
matf[3], matf[7], matf[11], matf[15] };
|
||||
|
||||
*RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, mat);
|
||||
*RLGL.State.currentMatrix = rlMatrixMultiply(mat, *RLGL.State.currentMatrix);
|
||||
}
|
||||
|
||||
// Multiply the current matrix by a perspective matrix generated by parameters
|
||||
|
|
|
|||
|
|
@ -5549,7 +5549,7 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
|
|||
}
|
||||
}
|
||||
|
||||
float duration = fmax((tend - tstart), EPSILON);
|
||||
float duration = fmaxf((tend - tstart), EPSILON);
|
||||
float t = (time - tstart)/duration;
|
||||
t = (t < 0.0f)? 0.0f : t;
|
||||
t = (t > 1.0f)? 1.0f : t;
|
||||
|
|
|
|||
|
|
@ -815,17 +815,17 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
|||
{
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlVertex2f(posX, posY);
|
||||
rlVertex2f(posX + width, posY + 1);
|
||||
rlVertex2f((float)posX, (float)posY);
|
||||
rlVertex2f((float)posX + (float)width, (float)posY + 1);
|
||||
|
||||
rlVertex2f(posX + width, posY + 1);
|
||||
rlVertex2f(posX + width, posY + height);
|
||||
rlVertex2f((float)posX + (float)width, (float)posY + 1);
|
||||
rlVertex2f((float)posX + (float)width, (float)posY + (float)height);
|
||||
|
||||
rlVertex2f(posX + width, posY + height);
|
||||
rlVertex2f(posX + 1, posY + height);
|
||||
rlVertex2f((float)posX + (float)width, (float)posY + (float)height);
|
||||
rlVertex2f((float)posX + 1, (float)posY + (float)height);
|
||||
|
||||
rlVertex2f(posX + 1, posY + height);
|
||||
rlVertex2f(posX + 1, posY + 1);
|
||||
rlVertex2f((float)posX + 1, (float)posY + (float)height);
|
||||
rlVertex2f((float)posX + 1, (float)posY + 1);
|
||||
rlEnd();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1151,7 +1151,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 linebreak '\n')
|
||||
float 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
|
||||
|
|
@ -1225,7 +1225,7 @@ void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSiz
|
|||
// Draw multiple character (codepoints)
|
||||
void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Vector2 position, float fontSize, float spacing, Color tint)
|
||||
{
|
||||
int textOffsetY = 0; // Offset between lines (on linebreak '\n')
|
||||
float 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
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
|
|||
if (fileData != NULL)
|
||||
{
|
||||
unsigned char *dataPtr = fileData;
|
||||
unsigned int size = GetPixelDataSize(width, height, format);
|
||||
int size = GetPixelDataSize(width, height, format);
|
||||
|
||||
if (size <= dataSize) // Security check
|
||||
{
|
||||
|
|
@ -697,8 +697,8 @@ Image LoadImageFromScreen(void)
|
|||
Vector2 scale = GetWindowScaleDPI();
|
||||
Image image = { 0 };
|
||||
|
||||
image.width = GetScreenWidth()*scale.x;
|
||||
image.height = GetScreenHeight()*scale.y;
|
||||
image.width = (int)(GetScreenWidth()*scale.x);
|
||||
image.height = (int)(GetScreenHeight()*scale.y);
|
||||
image.mipmaps = 1;
|
||||
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
||||
image.data = rlReadScreenPixels(image.width, image.height);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user