Merge branch 'master' into overridable_config
This commit is contained in:
commit
f2bfdeab97
|
|
@ -401,6 +401,7 @@ pub fn build(b: *std.Build) !void {
|
|||
const lib = try compileRaylib(b, target, optimize, Options.getOptions(b));
|
||||
|
||||
lib.installHeader(b.path("src/raylib.h"), "raylib.h");
|
||||
lib.installHeader(b.path("src/rcamera.h"), "rcamera.h");
|
||||
lib.installHeader(b.path("src/raymath.h"), "raymath.h");
|
||||
lib.installHeader(b.path("src/rlgl.h"), "rlgl.h");
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
# - Linux (X11 desktop mode)
|
||||
# - macOS/OSX (x64, arm64 (not tested))
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_WEB_RGFW:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_WEB:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_DRM:
|
||||
|
|
@ -51,7 +53,7 @@
|
|||
|
||||
# Define required environment variables
|
||||
#------------------------------------------------------------------------------------------------
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB, PLATFORM_WEB_RGFW
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
|
||||
|
|
@ -107,7 +109,7 @@ BUILD_WEB_RESOURCES ?= TRUE
|
|||
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
||||
|
||||
# Determine PLATFORM_OS when required
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB))
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
# ifeq ($(UNAME),Msys) -> Windows
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
@ -158,7 +160,7 @@ endif
|
|||
# Define raylib release directory for compiled library
|
||||
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
|
||||
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
# Emscripten required variables
|
||||
EMSDK_PATH ?= C:/raylib/emsdk
|
||||
|
|
@ -184,7 +186,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
|||
CC = clang
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# HTML5 emscripten compiler
|
||||
# WARNING: To compile to HTML5, code must be redesigned
|
||||
# to use emscripten.h and emscripten_set_main_loop()
|
||||
|
|
@ -203,7 +205,7 @@ endif
|
|||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(OS),Windows_NT)
|
||||
MAKE = mingw32-make
|
||||
else
|
||||
|
|
@ -231,11 +233,11 @@ CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
|||
|
||||
ifeq ($(BUILD_MODE),DEBUG)
|
||||
CFLAGS += -g -D_DEBUG
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
CFLAGS += -sASSERTIONS=1 --profiling
|
||||
endif
|
||||
else
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||
CFLAGS += -O3
|
||||
else
|
||||
|
|
@ -325,7 +327,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
|||
endif
|
||||
LDFLAGS += -L$(SDL_LIBRARY_PATH)
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# -Os # size optimization
|
||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
|
||||
|
|
@ -341,7 +343,12 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
|||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||
# --preload-file resources # specify a resources folder for data compilation
|
||||
# --source-map-base # allow debugging in browser with source map
|
||||
LDFLAGS += -sUSE_GLFW=3 -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1
|
||||
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
LDFLAGS += -sUSE_GLFW=3
|
||||
endif
|
||||
|
||||
LDFLAGS += -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1
|
||||
|
||||
# Build using asyncify
|
||||
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||
|
|
@ -480,9 +487,9 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# Libraries for web (HTML5) compiling
|
||||
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
||||
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.web.a
|
||||
endif
|
||||
|
||||
# Define source code object files required
|
||||
|
|
@ -681,7 +688,7 @@ others: $(OTHERS)
|
|||
%: %.c
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||
$(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
|
||||
else ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
else ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
$(MAKE) -f Makefile.Web $@
|
||||
else
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM)
|
||||
|
|
@ -710,7 +717,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||
find . -type f -executable -delete
|
||||
rm -fv *.o
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
del *.wasm *.html *.js *.data
|
||||
else
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ BUILD_WEB_HEAP_SIZE ?= 134217728
|
|||
USE_WEBGL2 ?= FALSE
|
||||
|
||||
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
# ifeq ($(UNAME),Msys) -> Windows
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
@ -116,7 +116,7 @@ endif
|
|||
# Define raylib release directory for compiled library
|
||||
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
# Emscripten required variables
|
||||
EMSDK_PATH ?= C:/raylib/emsdk
|
||||
|
|
@ -142,7 +142,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
CC = clang
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# HTML5 emscripten compiler
|
||||
# WARNING: To compile to HTML5, code must be redesigned
|
||||
# to use emscripten.h and emscripten_set_main_loop()
|
||||
|
|
@ -161,7 +161,7 @@ endif
|
|||
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||
MAKE = mingw32-make
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(OS),Windows_NT)
|
||||
MAKE = mingw32-make
|
||||
else
|
||||
|
|
@ -189,11 +189,11 @@ CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
|||
|
||||
ifeq ($(BUILD_MODE),DEBUG)
|
||||
CFLAGS += -g -D_DEBUG
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
CFLAGS += -sASSERTIONS=1 --profiling
|
||||
endif
|
||||
else
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||
CFLAGS += -O3
|
||||
else
|
||||
|
|
@ -263,7 +263,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# -Os # size optimization
|
||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
|
||||
|
|
@ -279,7 +279,12 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
|||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||
# --preload-file resources # specify a resources folder for data compilation
|
||||
# --source-map-base # allow debugging in browser with source map
|
||||
LDFLAGS += -sUSE_GLFW=3 -sEXPORTED_RUNTIME_METHODS=ccall
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
LDFLAGS += -sUSE_GLFW=3
|
||||
endif
|
||||
|
||||
LDFLAGS += -sEXPORTED_RUNTIME_METHODS=ccall
|
||||
|
||||
# Build using asyncify
|
||||
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||
|
|
@ -363,9 +368,9 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
|
|||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# Libraries for web (HTML5) compiling
|
||||
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
||||
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.web.a
|
||||
endif
|
||||
|
||||
# Define source code object files required
|
||||
|
|
@ -1225,7 +1230,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
|
|||
find . -type f -executable -delete
|
||||
rm -fv *.o
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
del *.o *.html *.js
|
||||
endif
|
||||
@echo Cleaning done
|
||||
|
|
|
|||
|
|
@ -9801,7 +9801,7 @@
|
|||
},
|
||||
{
|
||||
"name": "TextToInteger",
|
||||
"description": "Get integer value from text (negative values not supported)",
|
||||
"description": "Get integer value from text",
|
||||
"returnType": "int",
|
||||
"params": [
|
||||
{
|
||||
|
|
@ -9812,7 +9812,7 @@
|
|||
},
|
||||
{
|
||||
"name": "TextToFloat",
|
||||
"description": "Get float value from text (negative values not supported)",
|
||||
"description": "Get float value from text",
|
||||
"returnType": "float",
|
||||
"params": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6969,7 +6969,7 @@ return {
|
|||
},
|
||||
{
|
||||
name = "TextToInteger",
|
||||
description = "Get integer value from text (negative values not supported)",
|
||||
description = "Get integer value from text",
|
||||
returnType = "int",
|
||||
params = {
|
||||
{type = "const char *", name = "text"}
|
||||
|
|
@ -6977,7 +6977,7 @@ return {
|
|||
},
|
||||
{
|
||||
name = "TextToFloat",
|
||||
description = "Get float value from text (negative values not supported)",
|
||||
description = "Get float value from text",
|
||||
returnType = "float",
|
||||
params = {
|
||||
{type = "const char *", name = "text"}
|
||||
|
|
|
|||
|
|
@ -3757,12 +3757,12 @@ Function 438: TextToCamel() (1 input parameters)
|
|||
Function 439: TextToInteger() (1 input parameters)
|
||||
Name: TextToInteger
|
||||
Return type: int
|
||||
Description: Get integer value from text (negative values not supported)
|
||||
Description: Get integer value from text
|
||||
Param[1]: text (type: const char *)
|
||||
Function 440: TextToFloat() (1 input parameters)
|
||||
Name: TextToFloat
|
||||
Return type: float
|
||||
Description: Get float value from text (negative values not supported)
|
||||
Description: Get float value from text
|
||||
Param[1]: text (type: const char *)
|
||||
Function 441: DrawLine3D() (3 input parameters)
|
||||
Name: DrawLine3D
|
||||
|
|
|
|||
|
|
@ -2487,10 +2487,10 @@
|
|||
<Function name="TextToCamel" retType="const char *" paramCount="1" desc="Get Camel case notation version of provided string">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToInteger" retType="int" paramCount="1" desc="Get integer value from text (negative values not supported)">
|
||||
<Function name="TextToInteger" retType="int" paramCount="1" desc="Get integer value from text">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToFloat" retType="float" paramCount="1" desc="Get float value from text (negative values not supported)">
|
||||
<Function name="TextToFloat" retType="float" paramCount="1" desc="Get float value from text">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="DrawLine3D" retType="void" paramCount="3" desc="Draw a line in 3D world space">
|
||||
|
|
|
|||
|
|
@ -693,16 +693,12 @@ Global
|
|||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Debug|x64.Build.0 = Debug|x64
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Debug|x86.Build.0 = Debug|Win32
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Release.DLL|x64.ActiveCfg = Release.DLL|x64
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Release.DLL|x86.Build.0 = Release.DLL|Win32
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Release|x64.ActiveCfg = Release|x64
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Release|x64.Build.0 = Release|x64
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F026020F-7B00-40C8-91C3-5DE85EC45A95}.Release|x86.Build.0 = Release|Win32
|
||||
{6B8BAAF1-75C7-4C68-80B8-0E2A9EABBD9A}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64
|
||||
{6B8BAAF1-75C7-4C68-80B8-0E2A9EABBD9A}.Debug.DLL|x64.Build.0 = Debug.DLL|x64
|
||||
{6B8BAAF1-75C7-4C68-80B8-0E2A9EABBD9A}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ endif()
|
|||
# Used as public API to be included into other projects
|
||||
set(raylib_public_headers
|
||||
raylib.h
|
||||
rcamera.h
|
||||
rlgl.h
|
||||
raymath.h
|
||||
)
|
||||
|
|
|
|||
24
src/Makefile
24
src/Makefile
|
|
@ -20,6 +20,8 @@
|
|||
# - Linux (X11 desktop mode)
|
||||
# - macOS/OSX (x64, arm64 (not tested))
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_WEB_RGFW:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_WEB:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_DRM:
|
||||
|
|
@ -130,7 +132,7 @@ HOST_PLATFORM_OS ?= WINDOWS
|
|||
PLATFORM_OS ?= WINDOWS
|
||||
|
||||
# Determine PLATFORM_OS when required
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_ANDROID))
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW PLATFORM_WEB PLATFORM_WEB_RGFW PLATFORM_ANDROID))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
# ifeq ($(UNAME),Msys) -> Windows
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
@ -172,7 +174,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||
PLATFORM_SHELL = sh
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
ifndef PLATFORM_SHELL
|
||||
PLATFORM_SHELL = sh
|
||||
|
|
@ -180,7 +182,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
ifeq ($(PLATFORM_OS), WINDOWS)
|
||||
# Emscripten required variables
|
||||
EMSDK_PATH ?= C:/raylib/emsdk
|
||||
|
|
@ -254,7 +256,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||
# On DRM OpenGL ES 2.0 must be used
|
||||
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0
|
||||
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES3
|
||||
|
|
@ -288,7 +290,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# HTML5 emscripten compiler
|
||||
CC = emcc
|
||||
AR = emar
|
||||
|
|
@ -331,7 +333,7 @@ ifneq ($(RAYLIB_CONFIG_FLAGS), NONE)
|
|||
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_PLATFORM), PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# NOTE: When using multi-threading in the user code, it requires -pthread enabled
|
||||
CFLAGS += -std=gnu99
|
||||
else
|
||||
|
|
@ -347,7 +349,7 @@ ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
|||
endif
|
||||
|
||||
ifeq ($(RAYLIB_BUILD_MODE),RELEASE)
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
CFLAGS += -Os
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||
|
|
@ -366,7 +368,7 @@ endif
|
|||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||
CFLAGS += -Werror=implicit-function-declaration
|
||||
endif
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# -Os # size optimization
|
||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||
# -sUSE_GLFW=3 # Use glfw3 library (context/input management) -> Only for linker!
|
||||
|
|
@ -659,11 +661,11 @@ all: raylib
|
|||
# Compile raylib library
|
||||
# NOTE: Release directory is created if not exist
|
||||
raylib: $(OBJS)
|
||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||
# Compile raylib libray for web
|
||||
#$(CC) $(OBJS) -r -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc
|
||||
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS)
|
||||
@echo "raylib library generated (lib$(RAYLIB_LIB_NAME).a)!"
|
||||
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).web.a $(OBJS)
|
||||
@echo "raylib library generated (lib$(RAYLIB_LIB_NAME).web.a)!"
|
||||
else
|
||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
|
||||
|
|
|
|||
610
src/external/RGFW.h
vendored
610
src/external/RGFW.h
vendored
File diff suppressed because it is too large
Load Diff
|
|
@ -699,7 +699,7 @@ void PollInputEvents(void)
|
|||
|
||||
// Poll Events (registered events) until we reach TIMEOUT which indicates there are no events left to poll
|
||||
// NOTE: Activity is paused if not enabled (platform.appEnabled)
|
||||
while ((pollResult = ALooper_pollOnce(platform.appEnabled? 0 : -1, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||
while ((pollResult = ALooper_pollOnce(platform.appEnabled? 0 : -1, NULL, &pollEvents, ((void **)&platform.source)) > ALOOPER_POLL_TIMEOUT))
|
||||
{
|
||||
// Process this event
|
||||
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
||||
|
|
@ -786,7 +786,7 @@ int InitPlatform(void)
|
|||
while (!CORE.Window.ready)
|
||||
{
|
||||
// Process events until we reach TIMEOUT, which indicates no more events queued.
|
||||
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, ((void **)&platform.source)) > ALOOPER_POLL_TIMEOUT))
|
||||
{
|
||||
// Process this event
|
||||
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
||||
|
|
@ -1226,7 +1226,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
|||
return 1; // Handled gamepad button
|
||||
}
|
||||
|
||||
KeyboardKey key = (keycode > 0 && keycode < KEYCODE_MAP_SIZE)? mapKeycode[keycode] : KEY_NULL;
|
||||
KeyboardKey key = ((keycode > 0) && (keycode < KEYCODE_MAP_SIZE))? mapKeycode[keycode] : KEY_NULL;
|
||||
if (key != KEY_NULL)
|
||||
{
|
||||
// Save current key and its state
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
* - Windows (Win32, Win64)
|
||||
* - Linux (X11/Wayland desktop mode)
|
||||
* - MacOS (Cocoa)
|
||||
* - HTML5 (Emscripten)
|
||||
* - Others (untested)
|
||||
*
|
||||
* LIMITATIONS:
|
||||
* - TODO
|
||||
|
|
@ -46,7 +48,11 @@
|
|||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
#if defined(PLATFORM_WEB_RGFW)
|
||||
#define RGFW_NO_GL_HEADER
|
||||
#endif
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2) && !defined(PLATFORM_WEB_RGFW)
|
||||
#define RGFW_OPENGL_ES2
|
||||
#endif
|
||||
|
||||
|
|
@ -80,6 +86,10 @@ void CloseWindow(void);
|
|||
#define Size NSSIZE
|
||||
#endif
|
||||
|
||||
#define RGFW_MALLOC RL_MALLOC
|
||||
#define RGFW_FREE RL_FREE
|
||||
#define RGFW_CALLOC RL_CALLOC
|
||||
|
||||
#include "../external/RGFW.h"
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
|
@ -118,6 +128,7 @@ static bool RGFW_disableCursor = false;
|
|||
|
||||
static const unsigned short keyMappingRGFW[] = {
|
||||
[RGFW_KEY_NULL] = KEY_NULL,
|
||||
[RGFW_Return] = KEY_ENTER,
|
||||
[RGFW_Quote] = KEY_APOSTROPHE,
|
||||
[RGFW_Comma] = KEY_COMMA,
|
||||
[RGFW_Minus] = KEY_MINUS,
|
||||
|
|
@ -611,7 +622,7 @@ int GetMonitorPhysicalWidth(int monitor)
|
|||
{
|
||||
RGFW_monitor *mons = RGFW_getMonitors();
|
||||
|
||||
return (int)mons[monitor].physW;
|
||||
return mons[monitor].physW;
|
||||
}
|
||||
|
||||
// Get selected monitor physical height in millimetres
|
||||
|
|
@ -654,7 +665,7 @@ Vector2 GetWindowScaleDPI(void)
|
|||
// Set clipboard text content
|
||||
void SetClipboardText(const char *text)
|
||||
{
|
||||
RGFW_writeClipboard(text, (u32)strlen(text));
|
||||
RGFW_writeClipboard(text, strlen(text));
|
||||
}
|
||||
|
||||
// Get clipboard text content
|
||||
|
|
@ -672,7 +683,7 @@ const char *GetClipboardText(void)
|
|||
#define WINGDI_ALREADY_INCLUDED
|
||||
#include "../external/win32_clipboard.h"
|
||||
#endif
|
||||
#endif // SUPPORT_CLIPBOARD_IMAGE
|
||||
#endif
|
||||
|
||||
// Get clipboard image
|
||||
Image GetClipboardImage(void)
|
||||
|
|
@ -683,15 +694,13 @@ Image GetClipboardImage(void)
|
|||
#if defined(_WIN32)
|
||||
unsigned long long int dataSize = 0;
|
||||
void *fileData = NULL;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
int width, height;
|
||||
fileData = (void *)Win32GetClipboardImageData(&width, &height, &dataSize);
|
||||
|
||||
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
|
||||
else image = LoadImageFromMemory(".bmp", fileData, (int)dataSize);
|
||||
else image = LoadImageFromMemory(".bmp", fileData, dataSize);
|
||||
#else
|
||||
TRACELOG(LOG_WARNING, "GetClipboardImage() not implemented on target platform");
|
||||
TRACELOG(LOG_WARNING, "Clipboard image: PLATFORM_DESKTOP_RGFW does not implement `GetClipboardImage()` for this OS");
|
||||
#endif
|
||||
#endif // SUPPORT_CLIPBOARD_IMAGE
|
||||
|
||||
|
|
@ -780,6 +789,12 @@ int SetGamepadMappings(const char *mappings)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Set gamepad vibration
|
||||
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GamepadSetVibration() not available on target platform");
|
||||
}
|
||||
|
||||
// Set mouse position XY
|
||||
void SetMousePosition(int x, int y)
|
||||
{
|
||||
|
|
@ -855,6 +870,28 @@ char RSGL_keystrToChar(const char *str)
|
|||
return '\0';
|
||||
}
|
||||
|
||||
int RGFW_gpConvTable[18] = {
|
||||
[RGFW_GP_Y] = GAMEPAD_BUTTON_RIGHT_FACE_UP,
|
||||
[RGFW_GP_B] = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT,
|
||||
[RGFW_GP_A] = GAMEPAD_BUTTON_RIGHT_FACE_DOWN,
|
||||
[RGFW_GP_X] = GAMEPAD_BUTTON_RIGHT_FACE_LEFT,
|
||||
[RGFW_GP_L1] = GAMEPAD_BUTTON_LEFT_TRIGGER_1,
|
||||
[RGFW_GP_R1] = GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
|
||||
[RGFW_GP_L2] = GAMEPAD_BUTTON_LEFT_TRIGGER_2,
|
||||
[RGFW_GP_R2] = GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
|
||||
[RGFW_GP_SELECT] = GAMEPAD_BUTTON_MIDDLE_LEFT,
|
||||
[RGFW_GP_HOME] = GAMEPAD_BUTTON_MIDDLE,
|
||||
[RGFW_GP_START] = GAMEPAD_BUTTON_MIDDLE_RIGHT,
|
||||
[RGFW_GP_UP] = GAMEPAD_BUTTON_LEFT_FACE_UP,
|
||||
[RGFW_GP_RIGHT] = GAMEPAD_BUTTON_LEFT_FACE_RIGHT,
|
||||
[RGFW_GP_DOWN] = GAMEPAD_BUTTON_LEFT_FACE_DOWN,
|
||||
[RGFW_GP_LEFT] = GAMEPAD_BUTTON_LEFT_FACE_LEFT,
|
||||
[RGFW_GP_L3] = GAMEPAD_BUTTON_LEFT_THUMB,
|
||||
[RGFW_GP_R3] = GAMEPAD_BUTTON_RIGHT_THUMB,
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Register all input events
|
||||
void PollInputEvents(void)
|
||||
{
|
||||
|
|
@ -927,27 +964,27 @@ void PollInputEvents(void)
|
|||
|
||||
while (RGFW_window_checkEvent(platform.window))
|
||||
{
|
||||
if ((platform.window->event.type >= RGFW_jsButtonPressed) && (platform.window->event.type <= RGFW_jsAxisMove))
|
||||
if ((platform.window->event.type >= RGFW_gpButtonPressed) && (platform.window->event.type <= RGFW_gpAxisMove))
|
||||
{
|
||||
if (!CORE.Input.Gamepad.ready[platform.window->event.joystick])
|
||||
if (!CORE.Input.Gamepad.ready[platform.window->event.gamepad])
|
||||
{
|
||||
CORE.Input.Gamepad.ready[platform.window->event.joystick] = true;
|
||||
CORE.Input.Gamepad.axisCount[platform.window->event.joystick] = platform.window->event.axisesCount;
|
||||
CORE.Input.Gamepad.name[platform.window->event.joystick][0] = '\0';
|
||||
CORE.Input.Gamepad.axisState[platform.window->event.joystick][GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f;
|
||||
CORE.Input.Gamepad.axisState[platform.window->event.joystick][GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f;
|
||||
CORE.Input.Gamepad.ready[platform.window->event.gamepad] = true;
|
||||
CORE.Input.Gamepad.axisCount[platform.window->event.gamepad] = platform.window->event.axisesCount;
|
||||
CORE.Input.Gamepad.name[platform.window->event.gamepad][0] = '\0';
|
||||
CORE.Input.Gamepad.axisState[platform.window->event.gamepad][GAMEPAD_AXIS_LEFT_TRIGGER] = -1.0f;
|
||||
CORE.Input.Gamepad.axisState[platform.window->event.gamepad][GAMEPAD_AXIS_RIGHT_TRIGGER] = -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
RGFW_Event *event = &platform.window->event;
|
||||
|
||||
// All input events can be processed after polling
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case RGFW_quit: CORE.Window.shouldClose = true; break;
|
||||
case RGFW_dnd: // Dropped file
|
||||
{
|
||||
for (u32 i = 0; i < event->droppedFilesCount; i++)
|
||||
for (int i = 0; i < event->droppedFilesCount; i++)
|
||||
{
|
||||
if (CORE.Window.dropFileCount == 0)
|
||||
{
|
||||
|
|
@ -992,7 +1029,6 @@ void PollInputEvents(void)
|
|||
case RGFW_keyPressed:
|
||||
{
|
||||
KeyboardKey key = ConvertScancodeToKey(event->keyCode);
|
||||
|
||||
if (key != KEY_NULL)
|
||||
{
|
||||
// If key was up, add it to the key pressed queue
|
||||
|
|
@ -1031,7 +1067,7 @@ void PollInputEvents(void)
|
|||
{
|
||||
if ((event->button == RGFW_mouseScrollUp) || (event->button == RGFW_mouseScrollDown))
|
||||
{
|
||||
CORE.Input.Mouse.currentWheelMove.y = (float)event->scroll;
|
||||
CORE.Input.Mouse.currentWheelMove.y = event->scroll;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1047,10 +1083,9 @@ void PollInputEvents(void)
|
|||
} break;
|
||||
case RGFW_mouseButtonReleased:
|
||||
{
|
||||
|
||||
if ((event->button == RGFW_mouseScrollUp) || (event->button == RGFW_mouseScrollDown))
|
||||
{
|
||||
CORE.Input.Mouse.currentWheelMove.y = (float)event->scroll;
|
||||
CORE.Input.Mouse.currentWheelMove.y = event->scroll;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1081,123 +1116,52 @@ void PollInputEvents(void)
|
|||
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
|
||||
touchAction = 2;
|
||||
} break;
|
||||
case RGFW_jsButtonPressed:
|
||||
case RGFW_gpButtonPressed:
|
||||
{
|
||||
int button = -1;
|
||||
|
||||
switch (event->button)
|
||||
{
|
||||
case RGFW_JS_Y: button = GAMEPAD_BUTTON_RIGHT_FACE_UP; break;
|
||||
case RGFW_JS_B: button = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT; break;
|
||||
case RGFW_JS_A: button = GAMEPAD_BUTTON_RIGHT_FACE_DOWN; break;
|
||||
case RGFW_JS_X: button = GAMEPAD_BUTTON_RIGHT_FACE_LEFT; break;
|
||||
|
||||
case RGFW_JS_L1: button = GAMEPAD_BUTTON_LEFT_TRIGGER_1; break;
|
||||
case RGFW_JS_R1: button = GAMEPAD_BUTTON_RIGHT_TRIGGER_1; break;
|
||||
|
||||
case RGFW_JS_L2: button = GAMEPAD_BUTTON_LEFT_TRIGGER_2; break;
|
||||
case RGFW_JS_R2: button = GAMEPAD_BUTTON_RIGHT_TRIGGER_2; break;
|
||||
|
||||
case RGFW_JS_SELECT: button = GAMEPAD_BUTTON_MIDDLE_LEFT; break;
|
||||
case RGFW_JS_HOME: button = GAMEPAD_BUTTON_MIDDLE; break;
|
||||
case RGFW_JS_START: button = GAMEPAD_BUTTON_MIDDLE_RIGHT; break;
|
||||
|
||||
case RGFW_JS_UP: button = GAMEPAD_BUTTON_LEFT_FACE_UP; break;
|
||||
case RGFW_JS_RIGHT: button = GAMEPAD_BUTTON_LEFT_FACE_RIGHT; break;
|
||||
case RGFW_JS_DOWN: button = GAMEPAD_BUTTON_LEFT_FACE_DOWN; break;
|
||||
case RGFW_JS_LEFT: button = GAMEPAD_BUTTON_LEFT_FACE_LEFT; break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
int button = RGFW_gpConvTable[event->button];
|
||||
|
||||
if (button >= 0)
|
||||
{
|
||||
CORE.Input.Gamepad.currentButtonState[event->joystick][button] = 1;
|
||||
CORE.Input.Gamepad.currentButtonState[event->gamepad][button] = 1;
|
||||
CORE.Input.Gamepad.lastButtonPressed = button;
|
||||
}
|
||||
} break;
|
||||
case RGFW_jsButtonReleased:
|
||||
case RGFW_gpButtonReleased:
|
||||
{
|
||||
int button = -1;
|
||||
switch (event->button)
|
||||
{
|
||||
case RGFW_JS_Y: button = GAMEPAD_BUTTON_RIGHT_FACE_UP; break;
|
||||
case RGFW_JS_B: button = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT; break;
|
||||
case RGFW_JS_A: button = GAMEPAD_BUTTON_RIGHT_FACE_DOWN; break;
|
||||
case RGFW_JS_X: button = GAMEPAD_BUTTON_RIGHT_FACE_LEFT; break;
|
||||
int button = RGFW_gpConvTable[event->button];
|
||||
|
||||
case RGFW_JS_L1: button = GAMEPAD_BUTTON_LEFT_TRIGGER_1; break;
|
||||
case RGFW_JS_R1: button = GAMEPAD_BUTTON_RIGHT_TRIGGER_1; break;
|
||||
|
||||
case RGFW_JS_L2: button = GAMEPAD_BUTTON_LEFT_TRIGGER_2; break;
|
||||
case RGFW_JS_R2: button = GAMEPAD_BUTTON_RIGHT_TRIGGER_2; break;
|
||||
|
||||
case RGFW_JS_SELECT: button = GAMEPAD_BUTTON_MIDDLE_LEFT; break;
|
||||
case RGFW_JS_HOME: button = GAMEPAD_BUTTON_MIDDLE; break;
|
||||
case RGFW_JS_START: button = GAMEPAD_BUTTON_MIDDLE_RIGHT; break;
|
||||
|
||||
case RGFW_JS_UP: button = GAMEPAD_BUTTON_LEFT_FACE_UP; break;
|
||||
case RGFW_JS_RIGHT: button = GAMEPAD_BUTTON_LEFT_FACE_RIGHT; break;
|
||||
case RGFW_JS_DOWN: button = GAMEPAD_BUTTON_LEFT_FACE_DOWN; break;
|
||||
case RGFW_JS_LEFT: button = GAMEPAD_BUTTON_LEFT_FACE_LEFT; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (button >= 0)
|
||||
{
|
||||
CORE.Input.Gamepad.currentButtonState[event->joystick][button] = 0;
|
||||
CORE.Input.Gamepad.currentButtonState[event->gamepad][button] = 0;
|
||||
if (CORE.Input.Gamepad.lastButtonPressed == button) CORE.Input.Gamepad.lastButtonPressed = 0;
|
||||
}
|
||||
} break;
|
||||
case RGFW_jsAxisMove:
|
||||
case RGFW_gpAxisMove:
|
||||
{
|
||||
int axis = -1;
|
||||
for (int i = 0; i < event->axisesCount; i++)
|
||||
{
|
||||
switch(i)
|
||||
|
||||
float value = 0;
|
||||
switch(event->whichAxis)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (abs(event->axis[i].x) > abs(event->axis[i].y))
|
||||
{
|
||||
axis = GAMEPAD_AXIS_LEFT_X;
|
||||
break;
|
||||
}
|
||||
|
||||
axis = GAMEPAD_AXIS_LEFT_Y;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_X] = event->axis[0].x / 100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_Y] = event->axis[0].y / 100.0f;
|
||||
} break;
|
||||
case 1:
|
||||
{
|
||||
if (abs(event->axis[i].x) > abs(event->axis[i].y))
|
||||
{
|
||||
axis = GAMEPAD_AXIS_RIGHT_X;
|
||||
break;
|
||||
}
|
||||
|
||||
axis = GAMEPAD_AXIS_RIGHT_Y;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_X] = event->axis[1].x / 100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y / 100.0f;
|
||||
} break;
|
||||
case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER; break;
|
||||
case 3: axis = GAMEPAD_AXIS_RIGHT_TRIGGER; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
float value = (event->axis[i].x + event->axis[i].y)/(float)32767;
|
||||
#else
|
||||
float value = (event->axis[i].x + -event->axis[i].y)/(float)32767;
|
||||
#endif
|
||||
CORE.Input.Gamepad.axisState[event->joystick][axis] = value;
|
||||
|
||||
// Register button state for triggers in addition to their axes
|
||||
if ((axis == GAMEPAD_AXIS_LEFT_TRIGGER) || (axis == GAMEPAD_AXIS_RIGHT_TRIGGER))
|
||||
case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER;
|
||||
case 3:
|
||||
{
|
||||
if (axis == -1) axis = GAMEPAD_AXIS_RIGHT_TRIGGER;
|
||||
int button = (axis == GAMEPAD_AXIS_LEFT_TRIGGER)? GAMEPAD_BUTTON_LEFT_TRIGGER_2 : GAMEPAD_BUTTON_RIGHT_TRIGGER_2;
|
||||
int pressed = (value > 0.1f);
|
||||
CORE.Input.Gamepad.currentButtonState[event->joystick][button] = pressed;
|
||||
CORE.Input.Gamepad.currentButtonState[event->gamepad][button] = pressed;
|
||||
|
||||
if (pressed) CORE.Input.Gamepad.lastButtonPressed = button;
|
||||
else if (CORE.Input.Gamepad.lastButtonPressed == button) CORE.Input.Gamepad.lastButtonPressed = 0;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
} break;
|
||||
default: break;
|
||||
|
|
@ -1283,17 +1247,22 @@ int InitPlatform(void)
|
|||
|
||||
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
|
||||
|
||||
|
||||
#ifndef PLATFORM_WEB_RGFW
|
||||
RGFW_area screenSize = RGFW_getScreenSize();
|
||||
CORE.Window.display.width = screenSize.w;
|
||||
CORE.Window.display.height = screenSize.h;
|
||||
#else
|
||||
CORE.Window.display.width = CORE.Window.screen.width;
|
||||
CORE.Window.display.height = CORE.Window.screen.height;
|
||||
#endif
|
||||
/*
|
||||
I think this is needed by Raylib now ?
|
||||
If so, rcore_destkop_sdl should be updated too
|
||||
*/
|
||||
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
if (CORE.Window.flags & FLAG_VSYNC_HINT) RGFW_window_swapInterval(platform.window, 1);
|
||||
|
||||
RGFW_window_makeCurrent(platform.window);
|
||||
|
||||
// Check surface and context activation
|
||||
|
|
@ -1305,12 +1274,6 @@ int InitPlatform(void)
|
|||
CORE.Window.render.height = CORE.Window.screen.height;
|
||||
CORE.Window.currentFbo.width = CORE.Window.render.width;
|
||||
CORE.Window.currentFbo.height = CORE.Window.render.height;
|
||||
|
||||
TRACELOG(LOG_INFO, "DISPLAY: Device initialized successfully");
|
||||
TRACELOG(LOG_INFO, " > Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, " > Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, " > Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_INFO, " > Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1360,12 +1323,11 @@ int InitPlatform(void)
|
|||
#ifdef RGFW_X11
|
||||
for (int i = 0; (i < 4) && (i < MAX_GAMEPADS); i++)
|
||||
{
|
||||
RGFW_registerJoystick(platform.window, i);
|
||||
RGFW_registergamepad(platform.window, i);
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACELOG(LOG_INFO, "PLATFORM: CUSTOM: Initialized successfully");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
#define MAX_CLIPBOARD_BUFFER_LENGTH 1024 // Size of the clipboard buffer used on GetClipboardText()
|
||||
#endif
|
||||
|
||||
#if ((defined(SDL_MAJOR_VERSION) && SDL_MAJOR_VERSION == 3) && (defined(SDL_MINOR_VERSION) && SDL_MINOR_VERSION >= 1))
|
||||
#if ((defined(SDL_MAJOR_VERSION) && (SDL_MAJOR_VERSION == 3)) && (defined(SDL_MINOR_VERSION) && (SDL_MINOR_VERSION >= 1)))
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
#define PLATFORM_DESKTOP_SDL3
|
||||
#endif
|
||||
|
|
@ -497,20 +497,21 @@ void ToggleBorderlessWindowed(void)
|
|||
void MaximizeWindow(void)
|
||||
{
|
||||
SDL_MaximizeWindow(platform.window);
|
||||
CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
||||
}
|
||||
|
||||
// Set window state: minimized
|
||||
void MinimizeWindow(void)
|
||||
{
|
||||
SDL_MinimizeWindow(platform.window);
|
||||
CORE.Window.flags |= FLAG_WINDOW_MINIMIZED;
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED;
|
||||
}
|
||||
|
||||
// Set window state: not minimized/maximized
|
||||
void RestoreWindow(void)
|
||||
{
|
||||
SDL_ShowWindow(platform.window);
|
||||
SDL_RestoreWindow(platform.window);
|
||||
// CORE.Window.flags will be removed on PollInputEvents()
|
||||
}
|
||||
|
||||
// Set window configuration state using flags
|
||||
|
|
@ -1448,7 +1449,24 @@ void PollInputEvents(void)
|
|||
CORE.Window.currentFbo.width = width;
|
||||
CORE.Window.currentFbo.height = height;
|
||||
CORE.Window.resizedLastFrame = true;
|
||||
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
// Manually detect if the window was maximized (due to SDL2 restore being unreliable on some platforms) to remove the FLAG_WINDOW_MAXIMIZED accordingly
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) > 0)
|
||||
{
|
||||
int borderTop = 0;
|
||||
int borderLeft = 0;
|
||||
int borderBottom = 0;
|
||||
int borderRight = 0;
|
||||
SDL_GetWindowBordersSize(platform.window, &borderTop, &borderLeft, &borderBottom, &borderRight);
|
||||
SDL_Rect usableBounds;
|
||||
SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(platform.window), &usableBounds);
|
||||
|
||||
if ((width + borderLeft + borderRight != usableBounds.w) && (height + borderTop + borderBottom != usableBounds.h)) CORE.Window.flags &= ~FLAG_WINDOW_MAXIMIZED;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
|
||||
case SDL_WINDOWEVENT_ENTER:
|
||||
{
|
||||
CORE.Input.Mouse.cursorOnScreen = true;
|
||||
|
|
@ -1457,16 +1475,49 @@ void PollInputEvents(void)
|
|||
{
|
||||
CORE.Input.Mouse.cursorOnScreen = false;
|
||||
} break;
|
||||
case SDL_WINDOWEVENT_HIDDEN:
|
||||
|
||||
case SDL_WINDOWEVENT_MINIMIZED:
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
case SDL_WINDOWEVENT_SHOWN:
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
{
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED;
|
||||
} break;
|
||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||
{
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) == 0) CORE.Window.flags |= FLAG_WINDOW_MAXIMIZED;
|
||||
} break;
|
||||
case SDL_WINDOWEVENT_RESTORED:
|
||||
#if defined(PLATFORM_DESKTOP_SDL3)
|
||||
break;
|
||||
#else
|
||||
{
|
||||
if ((SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MINIMIZED) == 0)
|
||||
{
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED;
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_DESKTOP_SDL3
|
||||
if ((SDL_GetWindowFlags(platform.window) & SDL_WINDOW_MAXIMIZED) == 0)
|
||||
{
|
||||
if ((CORE.Window.flags & SDL_WINDOW_MAXIMIZED) > 0) CORE.Window.flags &= ~SDL_WINDOW_MAXIMIZED;
|
||||
}
|
||||
#endif
|
||||
} break;
|
||||
|
||||
case SDL_WINDOWEVENT_HIDDEN:
|
||||
{
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) == 0) CORE.Window.flags |= FLAG_WINDOW_HIDDEN;
|
||||
} break;
|
||||
case SDL_WINDOWEVENT_SHOWN:
|
||||
{
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_HIDDEN) > 0) CORE.Window.flags &= ~FLAG_WINDOW_HIDDEN;
|
||||
} break;
|
||||
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
{
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) > 0) CORE.Window.flags &= ~FLAG_WINDOW_UNFOCUSED;
|
||||
} break;
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
{
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_UNFOCUSED) == 0) CORE.Window.flags |= FLAG_WINDOW_UNFOCUSED;
|
||||
} break;
|
||||
|
||||
#ifndef PLATFORM_DESKTOP_SDL3
|
||||
default: break;
|
||||
}
|
||||
} break;
|
||||
|
|
@ -1971,7 +2022,7 @@ void ClosePlatform(void)
|
|||
// Scancode to keycode mapping
|
||||
static KeyboardKey ConvertScancodeToKey(SDL_Scancode sdlScancode)
|
||||
{
|
||||
if (sdlScancode >= 0 && sdlScancode < SCANCODE_MAPPED_NUM)
|
||||
if ((sdlScancode >= 0) && (sdlScancode < SCANCODE_MAPPED_NUM))
|
||||
{
|
||||
return mapScancodeToKey[sdlScancode];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1529,7 +1529,7 @@ static void ConfigureEvdevDevice(char *device)
|
|||
platform.absRange.height = absinfo[ABS_Y].info.maximum - absinfo[ABS_Y].info.minimum;
|
||||
}
|
||||
}
|
||||
else if (isGamepad && !isMouse && !isKeyboard && platform.gamepadCount < MAX_GAMEPADS)
|
||||
else if (isGamepad && !isMouse && !isKeyboard && (platform.gamepadCount < MAX_GAMEPADS))
|
||||
{
|
||||
deviceKindStr = "gamepad";
|
||||
int index = platform.gamepadCount++;
|
||||
|
|
@ -1893,7 +1893,7 @@ static int FindExactConnectorMode(const drmModeConnector *connector, uint width,
|
|||
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM Mode %d %ux%u@%u %s", i, mode->hdisplay, mode->vdisplay, mode->vrefresh, (mode->flags & DRM_MODE_FLAG_INTERLACE)? "interlaced" : "progressive");
|
||||
|
||||
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && (!allowInterlaced)) continue;
|
||||
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && !allowInterlaced) continue;
|
||||
|
||||
if ((mode->hdisplay == width) && (mode->vdisplay == height) && (mode->vrefresh == fps)) return i;
|
||||
}
|
||||
|
|
@ -1923,7 +1923,7 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && (!allowInterlaced))
|
||||
if ((mode->flags & DRM_MODE_FLAG_INTERLACE) && !allowInterlaced)
|
||||
{
|
||||
TRACELOG(LOG_TRACE, "DISPLAY: DRM shouldn't choose an interlaced mode");
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -381,6 +381,12 @@ int SetGamepadMappings(const char *mappings)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Set gamepad vibration
|
||||
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "GamepadSetVibration() not implemented on target platform");
|
||||
}
|
||||
|
||||
// Set mouse position XY
|
||||
void SetMousePosition(int x, int y)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ void ToggleBorderlessWindowed(void)
|
|||
// Set window state: maximized, if resizable
|
||||
void MaximizeWindow(void)
|
||||
{
|
||||
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE && !(CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
||||
if ((glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && !(CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
||||
{
|
||||
platform.unmaximizedWidth = CORE.Window.screen.width;
|
||||
platform.unmaximizedHeight = CORE.Window.screen.height;
|
||||
|
|
@ -342,7 +342,7 @@ void MinimizeWindow(void)
|
|||
// Set window state: not minimized/maximized
|
||||
void RestoreWindow(void)
|
||||
{
|
||||
if (glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE && (CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
||||
if ((glfwGetWindowAttrib(platform.handle, GLFW_RESIZABLE) == GLFW_TRUE) && (CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
||||
{
|
||||
if (platform.unmaximizedWidth && platform.unmaximizedHeight) glfwSetWindowSize(platform.handle, platform.unmaximizedWidth, platform.unmaximizedHeight);
|
||||
|
||||
|
|
@ -1664,10 +1664,10 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *
|
|||
int height = EM_ASM_INT( return window.innerHeight; );
|
||||
|
||||
if (width < (int)CORE.Window.screenMin.width) width = CORE.Window.screenMin.width;
|
||||
else if (width > (int)CORE.Window.screenMax.width && CORE.Window.screenMax.width > 0) width = CORE.Window.screenMax.width;
|
||||
else if ((width > (int)CORE.Window.screenMax.width) && (CORE.Window.screenMax.width > 0)) width = CORE.Window.screenMax.width;
|
||||
|
||||
if (height < (int)CORE.Window.screenMin.height) height = CORE.Window.screenMin.height;
|
||||
else if (height > (int)CORE.Window.screenMax.height && CORE.Window.screenMax.height > 0) height = CORE.Window.screenMax.height;
|
||||
else if ((height > (int)CORE.Window.screenMax.height) && (CORE.Window.screenMax.height > 0)) height = CORE.Window.screenMax.height;
|
||||
|
||||
emscripten_set_canvas_element_size("#canvas", width, height);
|
||||
|
||||
|
|
@ -1722,7 +1722,7 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
|
|||
for (int i = 0; i < gamepadEvent->numButtons; ++i) TRACELOGD("Button %d: Digital: %d, Analog: %g", i, gamepadEvent->digitalButton[i], gamepadEvent->analogButton[i]);
|
||||
*/
|
||||
|
||||
if ((gamepadEvent->connected) && (gamepadEvent->index < MAX_GAMEPADS))
|
||||
if (gamepadEvent->connected && (gamepadEvent->index < MAX_GAMEPADS))
|
||||
{
|
||||
CORE.Input.Gamepad.ready[gamepadEvent->index] = true;
|
||||
sprintf(CORE.Input.Gamepad.name[gamepadEvent->index], "%s", gamepadEvent->id);
|
||||
|
|
|
|||
|
|
@ -1159,7 +1159,6 @@ RLAPI unsigned int ComputeCRC32(unsigned char *data, int dataSize); // Compu
|
|||
RLAPI unsigned int *ComputeMD5(unsigned char *data, int dataSize); // Compute MD5 hash code, returns static int[4] (16 bytes)
|
||||
RLAPI unsigned int *ComputeSHA1(unsigned char *data, int dataSize); // Compute SHA1 hash code, returns static int[5] (20 bytes)
|
||||
|
||||
|
||||
// Automation events functionality
|
||||
RLAPI AutomationEventList LoadAutomationEventList(const char *fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
|
||||
RLAPI void UnloadAutomationEventList(AutomationEventList list); // Unload automation events list from file
|
||||
|
|
@ -1521,8 +1520,8 @@ RLAPI const char *TextToPascal(const char *text); // Get Pas
|
|||
RLAPI const char *TextToSnake(const char *text); // Get Snake case notation version of provided string
|
||||
RLAPI const char *TextToCamel(const char *text); // Get Camel case notation version of provided string
|
||||
|
||||
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
|
||||
RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
|
||||
RLAPI int TextToInteger(const char *text); // Get integer value from text
|
||||
RLAPI float TextToFloat(const char *text); // Get float value from text
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Basic 3d Shapes Drawing Functions (Module: models)
|
||||
|
|
|
|||
17
src/rcore.c
17
src/rcore.c
|
|
@ -12,6 +12,13 @@
|
|||
* - Windows (Win32, Win64)
|
||||
* - Linux (X11/Wayland desktop mode)
|
||||
* - Others (not tested)
|
||||
* > PLATFORM_DESKTOP_RGFW (RGFW backend):
|
||||
* - Windows (Win32, Win64)
|
||||
* - Linux (X11/Wayland desktop mode)
|
||||
* - macOS/OSX (x64, arm64)
|
||||
* - Others (not tested)
|
||||
* > PLATFORM_WEB_RGFW:
|
||||
* - HTML5 (WebAssembly)
|
||||
* > PLATFORM_WEB:
|
||||
* - HTML5 (WebAssembly)
|
||||
* > PLATFORM_DRM:
|
||||
|
|
@ -85,12 +92,12 @@
|
|||
//----------------------------------------------------------------------------------
|
||||
// Feature Test Macros required for this module
|
||||
//----------------------------------------------------------------------------------
|
||||
#if (defined(__linux__) || defined(PLATFORM_WEB)) && (_XOPEN_SOURCE < 500)
|
||||
#if (defined(__linux__) || defined(PLATFORM_WEB) || defined(PLATFORM_WEB_RGFW)) && (_XOPEN_SOURCE < 500)
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 500 // Required for: readlink if compiled with c99 without gnu ext.
|
||||
#endif
|
||||
|
||||
#if (defined(__linux__) || defined(PLATFORM_WEB)) && (_POSIX_C_SOURCE < 199309L)
|
||||
#if (defined(__linux__) || defined(PLATFORM_WEB) || defined(PLATFORM_WEB_RGFW)) && (_POSIX_C_SOURCE < 199309L)
|
||||
#undef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext.
|
||||
#endif
|
||||
|
|
@ -540,7 +547,7 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
|
|||
#include "platforms/rcore_desktop_glfw.c"
|
||||
#elif defined(PLATFORM_DESKTOP_SDL)
|
||||
#include "platforms/rcore_desktop_sdl.c"
|
||||
#elif defined(PLATFORM_DESKTOP_RGFW)
|
||||
#elif (defined(PLATFORM_DESKTOP_RGFW) || defined(PLATFORM_WEB_RGFW))
|
||||
#include "platforms/rcore_desktop_rgfw.c"
|
||||
#elif defined(PLATFORM_WEB)
|
||||
#include "platforms/rcore_web.c"
|
||||
|
|
@ -611,6 +618,8 @@ void InitWindow(int width, int height, const char *title)
|
|||
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (SDL)");
|
||||
#elif defined(PLATFORM_DESKTOP_RGFW)
|
||||
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (RGFW)");
|
||||
#elif defined(PLATFORM_WEB_RGFW)
|
||||
TRACELOG(LOG_INFO, "Platform backend: WEB (RGFW) (HTML5)");
|
||||
#elif defined(PLATFORM_WEB)
|
||||
TRACELOG(LOG_INFO, "Platform backend: WEB (HTML5)");
|
||||
#elif defined(PLATFORM_DRM)
|
||||
|
|
@ -2063,7 +2072,7 @@ const char *GetDirectoryPath(const char *filePath)
|
|||
|
||||
// In case provided path does not contain a root drive letter (C:\, D:\) nor leading path separator (\, /),
|
||||
// we add the current directory path to dirPath
|
||||
if (filePath[1] != ':' && filePath[0] != '\\' && filePath[0] != '/')
|
||||
if ((filePath[1] != ':') && (filePath[0] != '\\') && (filePath[0] != '/'))
|
||||
{
|
||||
// For security, we set starting path to current directory,
|
||||
// obtained path will be concatenated to this
|
||||
|
|
|
|||
15
src/rlgl.h
15
src/rlgl.h
|
|
@ -1890,16 +1890,6 @@ void rlActiveDrawBuffers(int count)
|
|||
else
|
||||
{
|
||||
unsigned int buffers[8] = {
|
||||
#if defined(GRAPHICS_API_OPENGL_ES3)
|
||||
GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_COLOR_ATTACHMENT1_EXT,
|
||||
GL_COLOR_ATTACHMENT2_EXT,
|
||||
GL_COLOR_ATTACHMENT3_EXT,
|
||||
GL_COLOR_ATTACHMENT4_EXT,
|
||||
GL_COLOR_ATTACHMENT5_EXT,
|
||||
GL_COLOR_ATTACHMENT6_EXT,
|
||||
GL_COLOR_ATTACHMENT7_EXT,
|
||||
#else
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
GL_COLOR_ATTACHMENT1,
|
||||
GL_COLOR_ATTACHMENT2,
|
||||
|
|
@ -1908,14 +1898,9 @@ void rlActiveDrawBuffers(int count)
|
|||
GL_COLOR_ATTACHMENT5,
|
||||
GL_COLOR_ATTACHMENT6,
|
||||
GL_COLOR_ATTACHMENT7,
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_ES3)
|
||||
glDrawBuffersEXT(count, buffers);
|
||||
#else
|
||||
glDrawBuffers(count, buffers);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "GL: One color buffer active by default");
|
||||
|
|
|
|||
|
|
@ -2270,13 +2270,24 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
|
|||
{
|
||||
if (frame >= anim.frameCount) frame = frame%anim.frameCount;
|
||||
|
||||
// Get first mesh which have bones
|
||||
int firstMeshWithBones = -1;
|
||||
|
||||
for (int i = 0; i < model.meshCount; i++)
|
||||
{
|
||||
if (model.meshes[i].boneMatrices)
|
||||
{
|
||||
assert(model.meshes[i].boneCount == anim.boneCount);
|
||||
if (firstMeshWithBones == -1)
|
||||
{
|
||||
firstMeshWithBones = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int boneId = 0; boneId < model.meshes[i].boneCount; boneId++)
|
||||
// Update all bones and boneMatrices of first mesh with bones.
|
||||
for (int boneId = 0; boneId < anim.boneCount; boneId++)
|
||||
{
|
||||
Vector3 inTranslation = model.bindPose[boneId].translation;
|
||||
Quaternion inRotation = model.bindPose[boneId].rotation;
|
||||
|
|
@ -2301,7 +2312,20 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
|
|||
MatrixTranslate(boneTranslation.x, boneTranslation.y, boneTranslation.z)),
|
||||
MatrixScale(boneScale.x, boneScale.y, boneScale.z));
|
||||
|
||||
model.meshes[i].boneMatrices[boneId] = boneMatrix;
|
||||
model.meshes[firstMeshWithBones].boneMatrices[boneId] = boneMatrix;
|
||||
}
|
||||
|
||||
// Update remaining meshes with bones
|
||||
// NOTE: Using deep copy because shallow copy results in double free with 'UnloadModel()'
|
||||
if (firstMeshWithBones != -1)
|
||||
{
|
||||
for (int i = firstMeshWithBones + 1; i < model.meshCount; i++)
|
||||
{
|
||||
if (model.meshes[i].boneMatrices)
|
||||
{
|
||||
memcpy(model.meshes[i].boneMatrices,
|
||||
model.meshes[firstMeshWithBones].boneMatrices,
|
||||
model.meshes[i].boneCount * sizeof(model.meshes[i].boneMatrices[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2314,6 +2338,7 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame)
|
|||
void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
|
||||
{
|
||||
UpdateModelAnimationBones(model,anim,frame);
|
||||
|
||||
for (int m = 0; m < model.meshCount; m++)
|
||||
{
|
||||
Mesh mesh = model.meshes[m];
|
||||
|
|
@ -2324,6 +2349,7 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
|
|||
float boneWeight = 0.0;
|
||||
bool updated = false; // Flag to check when anim vertex information is updated
|
||||
const int vValues = mesh.vertexCount*3;
|
||||
|
||||
for (int vCounter = 0; vCounter < vValues; vCounter += 3)
|
||||
{
|
||||
mesh.animVertices[vCounter] = 0;
|
||||
|
|
|
|||
|
|
@ -833,10 +833,7 @@ Image GenImageGradientLinear(int width, int height, int direction, Color start,
|
|||
// bottom-right or vice-versa), pixel (0, 0) is the farthest point on the gradient
|
||||
// (i.e. the pixel which should become one of the gradient's ends color); while for
|
||||
// directions that lie in the second or fourth quadrant, that point is pixel (width, 0).
|
||||
float maxPosValue =
|
||||
((signbit(sinDir) != 0) == (signbit(cosDir) != 0))
|
||||
? fabsf(startingPos)
|
||||
: fabsf(startingPos+width*cosDir);
|
||||
float maxPosValue = ((signbit(sinDir) != 0) == (signbit(cosDir) != 0))? fabsf(startingPos) : fabsf(startingPos + width*cosDir);
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
for (int j = 0; j < height; j++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user