Merge branch 'master' of github.com:raysan5/raylib
This commit is contained in:
commit
a126ff8c95
|
|
@ -82,6 +82,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to
|
|||
| Raylib.lean | 4.5 | [Lean4](https://lean-lang.org/) | BSD-3-Clause | https://github.com/KislyjKisel/Raylib.lean |
|
||||
| Raylib-CSharp-Vinculum | 5.0 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MPL-2.0 | https://github.com/ZeroElectric/Raylib-CSharp-Vinculum |
|
||||
| raylib-cobol | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain | https://codeberg.org/glowiak/raylib-cobol |
|
||||
| Raylib-CSharp | 5.0 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | MIT | https://github.com/MrScautHD/Raylib-CSharp |
|
||||
|
||||
### Utility Wrapers
|
||||
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@
|
|||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11/Wayland desktop mode)
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_DESKTOP_RGFW (RGFW backend):
|
||||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11 desktop mode)
|
||||
# - macOS/OSX (x64, arm64 (not tested))
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_WEB:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_DRM:
|
||||
|
|
@ -86,7 +91,7 @@ BUILD_WEB_RESOURCES ?= TRUE
|
|||
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
||||
|
||||
# Determine PLATFORM_OS when required
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB))
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_DESKTOP_RGFW))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
# ifeq ($(UNAME),Msys) -> Windows
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
@ -416,6 +421,31 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
|
|||
LDLIBS += -latomic
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
# Libraries for Windows desktop compilation
|
||||
LDLIBS = ..\src\libraylib.a -lgdi32 -lwinmm -lopengl32
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
# Libraries for Debian GNU/Linux desktop compipling
|
||||
# NOTE: Required packages: libegl1-mesa-dev
|
||||
LDLIBS = ../src/libraylib.a -lGL -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -lpthread -ldl -lrt
|
||||
|
||||
# Explicit link to libc
|
||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||
LDLIBS += -lc
|
||||
endif
|
||||
|
||||
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
|
||||
LDLIBS += -latomic
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),OSX)
|
||||
# Libraries for Debian GNU/Linux desktop compiling
|
||||
# NOTE: Required packages: libegl1-mesa-dev
|
||||
LDLIBS = ../src/libraylib.a -lm
|
||||
LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
# Libraries for DRM compiling
|
||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
@ -33,9 +34,10 @@ void main()
|
|||
else if (index == 5) color = palette[5];
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
44
src/Makefile
44
src/Makefile
|
|
@ -13,6 +13,11 @@
|
|||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11/Wayland desktop mode)
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_DESKTOP_RGFW (RGFW backend):
|
||||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11 desktop mode)
|
||||
# - macOS/OSX (x64, arm64 (not tested))
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_WEB:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_DRM:
|
||||
|
|
@ -114,7 +119,7 @@ HOST_PLATFORM_OS ?= WINDOWS
|
|||
PLATFORM_OS ?= WINDOWS
|
||||
|
||||
# Determine PLATFORM_OS when required
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_ANDROID))
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_ANDROID PLATFORM_DESKTOP_RGFW))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
# ifeq ($(UNAME),Msys) -> Windows
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
@ -224,6 +229,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||
# By default use OpenGL 3.3 on desktop platforms
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||
# By default use OpenGL 3.3 on desktop platform with SDL backend
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||
|
|
@ -576,6 +589,30 @@ endif
|
|||
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
# Libraries for Windows desktop compilation
|
||||
LDLIBS = -lgdi32 -lwinmm -lopengl32
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
# Libraries for Debian GNU/Linux desktop compipling
|
||||
# NOTE: Required packages: libegl1-mesa-dev
|
||||
LDLIBS = -lGL -lX11 -lXrandr -lXinerama -lXi -lXcursor -lm -lpthread -ldl -lrt
|
||||
|
||||
# Explicit link to libc
|
||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||
LDLIBS += -lc
|
||||
endif
|
||||
|
||||
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
|
||||
LDLIBS += -latomic
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),OSX)
|
||||
# Libraries for Debian MacOS desktop compiling
|
||||
# NOTE: Required packages: libegl1-mesa-dev
|
||||
LDLIBS += -lm -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
|
||||
endif
|
||||
endif
|
||||
|
||||
# Define source code object files required
|
||||
#------------------------------------------------------------------------------------------------
|
||||
|
|
@ -583,7 +620,8 @@ OBJS = rcore.o \
|
|||
rshapes.o \
|
||||
rtextures.o \
|
||||
rtext.o \
|
||||
utils.o
|
||||
utils.o
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
||||
|
|
@ -619,7 +657,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||
@echo "raylib library generated (lib$(RAYLIB_LIB_NAME).a)!"
|
||||
else
|
||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL))
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
# NOTE: Linking with provided resource file
|
||||
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS)
|
||||
|
|
|
|||
6348
src/external/RGFW.h
vendored
Normal file
6348
src/external/RGFW.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
1530
src/platforms/rcore_desktop_rgfw.c
Normal file
1530
src/platforms/rcore_desktop_rgfw.c
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -388,29 +388,69 @@ Vector2 GetMonitorPosition(int monitor)
|
|||
// Get selected monitor width (currently used by monitor)
|
||||
int GetMonitorWidth(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorWidth() not implemented on target platform");
|
||||
return 0;
|
||||
int width = 0;
|
||||
|
||||
if (monitor != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorWidth() implemented for first monitor only");
|
||||
}
|
||||
else if ((platform.connector) && (platform.modeIndex >= 0))
|
||||
{
|
||||
width = platform.connector->modes[platform.modeIndex].hdisplay;
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
// Get selected monitor height (currently used by monitor)
|
||||
int GetMonitorHeight(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorHeight() not implemented on target platform");
|
||||
return 0;
|
||||
int height = 0;
|
||||
|
||||
if (monitor != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorHeight() implemented for first monitor only");
|
||||
}
|
||||
else if ((platform.connector) && (platform.modeIndex >= 0))
|
||||
{
|
||||
height = platform.connector->modes[platform.modeIndex].vdisplay;
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
// Get selected monitor physical width in millimetres
|
||||
int GetMonitorPhysicalWidth(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() not implemented on target platform");
|
||||
return 0;
|
||||
int physicalWidth = 0;
|
||||
|
||||
if (monitor != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() implemented for first monitor only");
|
||||
}
|
||||
else if ((platform.connector) && (platform.modeIndex >= 0))
|
||||
{
|
||||
physicalWidth = platform.connector->mmWidth;
|
||||
}
|
||||
|
||||
return physicalWidth;
|
||||
}
|
||||
|
||||
// Get selected monitor physical height in millimetres
|
||||
int GetMonitorPhysicalHeight(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() not implemented on target platform");
|
||||
return 0;
|
||||
int physicalHeight = 0;
|
||||
|
||||
if (monitor != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() implemented for first monitor only");
|
||||
}
|
||||
else if ((platform.connector) && (platform.modeIndex >= 0))
|
||||
{
|
||||
physicalHeight = platform.connector->mmHeight;
|
||||
}
|
||||
|
||||
return physicalHeight;
|
||||
}
|
||||
|
||||
// Get selected monitor refresh rate
|
||||
|
|
@ -429,8 +469,18 @@ int GetMonitorRefreshRate(int monitor)
|
|||
// Get the human-readable, UTF-8 encoded name of the selected monitor
|
||||
const char *GetMonitorName(int monitor)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorName() not implemented on target platform");
|
||||
return "";
|
||||
const char *name = "";
|
||||
|
||||
if (monitor != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GetMonitorName() implemented for first monitor only");
|
||||
}
|
||||
else if ((platform.connector) && (platform.modeIndex >= 0))
|
||||
{
|
||||
name = platform.connector->modes[platform.modeIndex].name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
// Get window position XY on monitor
|
||||
|
|
|
|||
193
src/raudio.c
193
src/raudio.c
|
|
@ -1334,11 +1334,10 @@ Music LoadMusicStream(const char *fileName)
|
|||
drwav *ctxWav = RL_CALLOC(1, sizeof(drwav));
|
||||
bool success = drwav_init_file(ctxWav, fileName, NULL);
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_WAV;
|
||||
music.ctxData = ctxWav;
|
||||
|
||||
if (success)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_WAV;
|
||||
music.ctxData = ctxWav;
|
||||
int sampleSize = ctxWav->bitsPerSample;
|
||||
if (ctxWav->bitsPerSample == 24) sampleSize = 16; // Forcing conversion to s16 on UpdateMusicStream()
|
||||
|
||||
|
|
@ -1347,17 +1346,23 @@ Music LoadMusicStream(const char *fileName)
|
|||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
drwav_uninit(ctxWav);
|
||||
RL_FREE(ctxWav);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_OGG)
|
||||
else if (IsFileExtension(fileName, ".ogg"))
|
||||
{
|
||||
// Open ogg audio stream
|
||||
music.ctxType = MUSIC_AUDIO_OGG;
|
||||
music.ctxData = stb_vorbis_open_filename(fileName, NULL, NULL);
|
||||
stb_vorbis *ctxOgg = stb_vorbis_open_filename(fileName, NULL, NULL);
|
||||
|
||||
if (music.ctxData != NULL)
|
||||
if (ctxOgg != NULL)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_OGG;
|
||||
music.ctxData = ctxOgg;
|
||||
stb_vorbis_info info = stb_vorbis_get_info((stb_vorbis *)music.ctxData); // Get Ogg file info
|
||||
|
||||
// OGG bit rate defaults to 16 bit, it's enough for compressed format
|
||||
|
|
@ -1368,6 +1373,10 @@ Music LoadMusicStream(const char *fileName)
|
|||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
stb_vorbis_close(ctxOgg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
|
|
@ -1376,27 +1385,30 @@ Music LoadMusicStream(const char *fileName)
|
|||
drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3));
|
||||
int result = drmp3_init_file(ctxMp3, fileName, NULL);
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_MP3;
|
||||
music.ctxData = ctxMp3;
|
||||
|
||||
if (result > 0)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_MP3;
|
||||
music.ctxData = ctxMp3;
|
||||
music.stream = LoadAudioStream(ctxMp3->sampleRate, 32, ctxMp3->channels);
|
||||
music.frameCount = (unsigned int)drmp3_get_pcm_frame_count(ctxMp3);
|
||||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RL_FREE(ctxMp3);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_QOA)
|
||||
else if (IsFileExtension(fileName, ".qoa"))
|
||||
{
|
||||
qoaplay_desc *ctxQoa = qoaplay_open(fileName);
|
||||
music.ctxType = MUSIC_AUDIO_QOA;
|
||||
music.ctxData = ctxQoa;
|
||||
|
||||
if (ctxQoa->file != NULL)
|
||||
if (ctxQoa != NULL)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_QOA;
|
||||
music.ctxData = ctxQoa;
|
||||
// NOTE: We are loading samples are 32bit float normalized data, so,
|
||||
// we configure the output audio stream to also use float 32bit
|
||||
music.stream = LoadAudioStream(ctxQoa->info.samplerate, 32, ctxQoa->info.channels);
|
||||
|
|
@ -1404,23 +1416,27 @@ Music LoadMusicStream(const char *fileName)
|
|||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else{} //No uninit required
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (IsFileExtension(fileName, ".flac"))
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_FLAC;
|
||||
music.ctxData = drflac_open_file(fileName, NULL);
|
||||
drflac *ctxFlac = drflac_open_file(fileName, NULL);
|
||||
|
||||
if (music.ctxData != NULL)
|
||||
if (ctxFlac != NULL)
|
||||
{
|
||||
drflac *ctxFlac = (drflac *)music.ctxData;
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_FLAC;
|
||||
music.ctxData = ctxFlac;
|
||||
music.stream = LoadAudioStream(ctxFlac->sampleRate, ctxFlac->bitsPerSample, ctxFlac->channels);
|
||||
music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount;
|
||||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
drflac_free(ctxFlac, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
|
|
@ -1429,11 +1445,10 @@ Music LoadMusicStream(const char *fileName)
|
|||
jar_xm_context_t *ctxXm = NULL;
|
||||
int result = jar_xm_create_context_from_file(&ctxXm, AUDIO.System.device.sampleRate, fileName);
|
||||
|
||||
music.ctxType = MUSIC_MODULE_XM;
|
||||
music.ctxData = ctxXm;
|
||||
|
||||
if (result == 0) // XM AUDIO.System.context created successfully
|
||||
{
|
||||
music.ctxType = MUSIC_MODULE_XM;
|
||||
music.ctxData = ctxXm;
|
||||
jar_xm_set_max_loop_count(ctxXm, 0); // Set infinite number of loops
|
||||
|
||||
unsigned int bits = 32;
|
||||
|
|
@ -1447,6 +1462,10 @@ Music LoadMusicStream(const char *fileName)
|
|||
jar_xm_reset(ctxXm); // Make sure we start at the beginning of the song
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
jar_xm_free_context(ctxXm);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||
|
|
@ -1456,48 +1475,27 @@ Music LoadMusicStream(const char *fileName)
|
|||
jar_mod_init(ctxMod);
|
||||
int result = jar_mod_load_file(ctxMod, fileName);
|
||||
|
||||
music.ctxType = MUSIC_MODULE_MOD;
|
||||
music.ctxData = ctxMod;
|
||||
|
||||
if (result > 0)
|
||||
{
|
||||
music.ctxType = MUSIC_MODULE_MOD;
|
||||
music.ctxData = ctxMod;
|
||||
// NOTE: Only stereo is supported for MOD
|
||||
music.stream = LoadAudioStream(AUDIO.System.device.sampleRate, 16, AUDIO_DEVICE_CHANNELS);
|
||||
music.frameCount = (unsigned int)jar_mod_max_samples(ctxMod); // NOTE: Always 2 channels (stereo)
|
||||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
jar_mod_unload(ctxMod);
|
||||
RL_FREE(ctxMod);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else TRACELOG(LOG_WARNING, "STREAM: [%s] File format not supported", fileName);
|
||||
|
||||
if (!musicLoaded)
|
||||
{
|
||||
if (false) { }
|
||||
#if defined(SUPPORT_FILEFORMAT_WAV)
|
||||
else if (music.ctxType == MUSIC_AUDIO_WAV) drwav_uninit((drwav *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_OGG)
|
||||
else if (music.ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close((stb_vorbis *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
else if (music.ctxType == MUSIC_AUDIO_MP3) { drmp3_uninit((drmp3 *)music.ctxData); RL_FREE(music.ctxData); }
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_QOA)
|
||||
else if (music.ctxType == MUSIC_AUDIO_QOA) qoaplay_close((qoaplay_desc *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (music.ctxType == MUSIC_AUDIO_FLAC) drflac_free((drflac *)music.ctxData, NULL);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||
else if (music.ctxType == MUSIC_MODULE_MOD) { jar_mod_unload((jar_mod_context_t *)music.ctxData); RL_FREE(music.ctxData); }
|
||||
#endif
|
||||
|
||||
music.ctxData = NULL;
|
||||
music.ctxType = MUSIC_AUDIO_NONE;
|
||||
TRACELOG(LOG_WARNING, "FILEIO: [%s] Music file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
|
|
@ -1528,11 +1526,10 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
|
||||
bool success = drwav_init_memory(ctxWav, (const void *)data, dataSize, NULL);
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_WAV;
|
||||
music.ctxData = ctxWav;
|
||||
|
||||
if (success)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_WAV;
|
||||
music.ctxData = ctxWav;
|
||||
int sampleSize = ctxWav->bitsPerSample;
|
||||
if (ctxWav->bitsPerSample == 24) sampleSize = 16; // Forcing conversion to s16 on UpdateMusicStream()
|
||||
|
||||
|
|
@ -1541,18 +1538,22 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else {
|
||||
drwav_uninit(ctxWav);
|
||||
RL_FREE(ctxWav);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_OGG)
|
||||
else if ((strcmp(fileType, ".ogg") == 0) || (strcmp(fileType, ".OGG") == 0))
|
||||
{
|
||||
// Open ogg audio stream
|
||||
music.ctxType = MUSIC_AUDIO_OGG;
|
||||
//music.ctxData = stb_vorbis_open_filename(fileName, NULL, NULL);
|
||||
music.ctxData = stb_vorbis_open_memory((const unsigned char *)data, dataSize, NULL, NULL);
|
||||
stb_vorbis* ctxOgg = stb_vorbis_open_memory((const unsigned char*)data, dataSize, NULL, NULL);
|
||||
|
||||
if (music.ctxData != NULL)
|
||||
if (ctxOgg != NULL)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_OGG;
|
||||
music.ctxData = ctxOgg;
|
||||
stb_vorbis_info info = stb_vorbis_get_info((stb_vorbis *)music.ctxData); // Get Ogg file info
|
||||
|
||||
// OGG bit rate defaults to 16 bit, it's enough for compressed format
|
||||
|
|
@ -1563,6 +1564,10 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
stb_vorbis_close(ctxOgg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
|
|
@ -1571,27 +1576,35 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
drmp3 *ctxMp3 = RL_CALLOC(1, sizeof(drmp3));
|
||||
int success = drmp3_init_memory(ctxMp3, (const void*)data, dataSize, NULL);
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_MP3;
|
||||
music.ctxData = ctxMp3;
|
||||
|
||||
if (success)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_MP3;
|
||||
music.ctxData = ctxMp3;
|
||||
music.stream = LoadAudioStream(ctxMp3->sampleRate, 32, ctxMp3->channels);
|
||||
music.frameCount = (unsigned int)drmp3_get_pcm_frame_count(ctxMp3);
|
||||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
drmp3_uninit(ctxMp3);
|
||||
RL_FREE(ctxMp3);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_QOA)
|
||||
else if ((strcmp(fileType, ".qoa") == 0) || (strcmp(fileType, ".QOA") == 0))
|
||||
{
|
||||
qoaplay_desc *ctxQoa = qoaplay_open_memory(data, dataSize);
|
||||
music.ctxType = MUSIC_AUDIO_QOA;
|
||||
music.ctxData = ctxQoa;
|
||||
|
||||
if ((ctxQoa->file_data != NULL) && (ctxQoa->file_data_size != 0))
|
||||
qoaplay_desc *ctxQoa = NULL;
|
||||
if ((data != NULL) && (dataSize > 0))
|
||||
{
|
||||
ctxQoa = qoaplay_open_memory(data, dataSize);
|
||||
}
|
||||
|
||||
if (ctxQoa != NULL)
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_QOA;
|
||||
music.ctxData = ctxQoa;
|
||||
// NOTE: We are loading samples are 32bit float normalized data, so,
|
||||
// we configure the output audio stream to also use float 32bit
|
||||
music.stream = LoadAudioStream(ctxQoa->info.samplerate, 32, ctxQoa->info.channels);
|
||||
|
|
@ -1599,23 +1612,27 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else{} //No uninit required
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if ((strcmp(fileType, ".flac") == 0) || (strcmp(fileType, ".FLAC") == 0))
|
||||
{
|
||||
music.ctxType = MUSIC_AUDIO_FLAC;
|
||||
music.ctxData = drflac_open_memory((const void*)data, dataSize, NULL);
|
||||
drflac *ctxFlac = drflac_open_memory((const void*)data, dataSize, NULL);
|
||||
|
||||
if (music.ctxData != NULL)
|
||||
if (ctxFlac != NULL)
|
||||
{
|
||||
drflac *ctxFlac = (drflac *)music.ctxData;
|
||||
|
||||
music.ctxType = MUSIC_AUDIO_FLAC;
|
||||
music.ctxData = ctxFlac;
|
||||
music.stream = LoadAudioStream(ctxFlac->sampleRate, ctxFlac->bitsPerSample, ctxFlac->channels);
|
||||
music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount;
|
||||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
drflac_free(ctxFlac, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
|
|
@ -1626,6 +1643,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
if (result == 0) // XM AUDIO.System.context created successfully
|
||||
{
|
||||
music.ctxType = MUSIC_MODULE_XM;
|
||||
music.ctxData = ctxXm;
|
||||
jar_xm_set_max_loop_count(ctxXm, 0); // Set infinite number of loops
|
||||
|
||||
unsigned int bits = 32;
|
||||
|
|
@ -1638,9 +1656,12 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
music.looping = true; // Looping enabled by default
|
||||
jar_xm_reset(ctxXm); // Make sure we start at the beginning of the song
|
||||
|
||||
music.ctxData = ctxXm;
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
jar_xm_free_context(ctxXm);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||
|
|
@ -1667,15 +1688,18 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
if (result > 0)
|
||||
{
|
||||
music.ctxType = MUSIC_MODULE_MOD;
|
||||
music.ctxData = ctxMod;
|
||||
|
||||
// NOTE: Only stereo is supported for MOD
|
||||
music.stream = LoadAudioStream(AUDIO.System.device.sampleRate, 16, 2);
|
||||
music.frameCount = (unsigned int)jar_mod_max_samples(ctxMod); // NOTE: Always 2 channels (stereo)
|
||||
music.looping = true; // Looping enabled by default
|
||||
musicLoaded = true;
|
||||
|
||||
music.ctxData = ctxMod;
|
||||
musicLoaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
jar_mod_unload(ctxMod);
|
||||
RL_FREE(ctxMod);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1683,31 +1707,6 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
|||
|
||||
if (!musicLoaded)
|
||||
{
|
||||
if (false) { }
|
||||
#if defined(SUPPORT_FILEFORMAT_WAV)
|
||||
else if (music.ctxType == MUSIC_AUDIO_WAV) drwav_uninit((drwav *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_OGG)
|
||||
else if (music.ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close((stb_vorbis *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
else if (music.ctxType == MUSIC_AUDIO_MP3) { drmp3_uninit((drmp3 *)music.ctxData); RL_FREE(music.ctxData); }
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_QOA)
|
||||
else if (music.ctxType == MUSIC_AUDIO_QOA) qoaplay_close((qoaplay_desc *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (music.ctxType == MUSIC_AUDIO_FLAC) drflac_free((drflac *)music.ctxData, NULL);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_XM)
|
||||
else if (music.ctxType == MUSIC_MODULE_XM) jar_xm_free_context((jar_xm_context_t *)music.ctxData);
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_MOD)
|
||||
else if (music.ctxType == MUSIC_MODULE_MOD) { jar_mod_unload((jar_mod_context_t *)music.ctxData); RL_FREE(music.ctxData); }
|
||||
#endif
|
||||
|
||||
music.ctxData = NULL;
|
||||
music.ctxType = MUSIC_AUDIO_NONE;
|
||||
TRACELOG(LOG_WARNING, "FILEIO: Music data could not be loaded");
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -154,13 +154,15 @@
|
|||
#endif
|
||||
|
||||
// Platform specific defines to handle GetApplicationDirectory()
|
||||
#if defined(_WIN32)
|
||||
#if (defined(_WIN32) && !defined(PLATFORM_DESKTOP_RGFW)) || (defined(_MSC_VER) && defined(PLATFORM_DESKTOP_RGFW))
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 1025
|
||||
#endif
|
||||
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameA(void *hModule, void *lpFilename, unsigned long nSize);
|
||||
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameW(void *hModule, void *lpFilename, unsigned long nSize);
|
||||
__declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, void *widestr, int cchwide, void *str, int cbmb, void *defchar, int *used_default);
|
||||
unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
|
||||
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
||||
#elif defined(__linux__)
|
||||
#include <unistd.h>
|
||||
#elif defined(__APPLE__)
|
||||
|
|
@ -482,7 +484,7 @@ static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *li
|
|||
static void RecordAutomationEvent(void); // Record frame events (to internal events array)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(PLATFORM_DESKTOP_RGFW)
|
||||
// NOTE: We declare Sleep() function symbol to avoid including windows.h (kernel32.lib linkage required)
|
||||
void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime()
|
||||
#endif
|
||||
|
|
@ -496,6 +498,8 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
|
|||
#include "platforms/rcore_desktop.c"
|
||||
#elif defined(PLATFORM_DESKTOP_SDL)
|
||||
#include "platforms/rcore_desktop_sdl.c"
|
||||
#elif defined(PLATFORM_DESKTOP_RGFW)
|
||||
#include "platforms/rcore_desktop_rgfw.c"
|
||||
#elif defined(PLATFORM_WEB)
|
||||
#include "platforms/rcore_web.c"
|
||||
#elif defined(PLATFORM_DRM)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user