add PLATFORM_WEB_RGFW
This commit is contained in:
parent
68503ed96f
commit
b0bde349e3
|
|
@ -20,6 +20,8 @@
|
||||||
# - Linux (X11 desktop mode)
|
# - Linux (X11 desktop mode)
|
||||||
# - macOS/OSX (x64, arm64 (not tested))
|
# - macOS/OSX (x64, arm64 (not tested))
|
||||||
# - Others (not tested)
|
# - Others (not tested)
|
||||||
|
# > PLATFORM_WEB_RGFW:
|
||||||
|
# - HTML5 (WebAssembly)
|
||||||
# > PLATFORM_WEB:
|
# > PLATFORM_WEB:
|
||||||
# - HTML5 (WebAssembly)
|
# - HTML5 (WebAssembly)
|
||||||
# > PLATFORM_DRM:
|
# > PLATFORM_DRM:
|
||||||
|
|
@ -51,7 +53,7 @@
|
||||||
|
|
||||||
# Define required environment variables
|
# 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
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
|
||||||
|
|
@ -102,7 +104,7 @@ BUILD_WEB_RESOURCES ?= TRUE
|
||||||
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
||||||
|
|
||||||
# Determine PLATFORM_OS when required
|
# 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!
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||||
# ifeq ($(UNAME),Msys) -> Windows
|
# ifeq ($(UNAME),Msys) -> Windows
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
|
|
@ -153,7 +155,7 @@ endif
|
||||||
# Define raylib release directory for compiled library
|
# Define raylib release directory for compiled library
|
||||||
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
|
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)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/raylib/emsdk
|
EMSDK_PATH ?= C:/raylib/emsdk
|
||||||
|
|
@ -179,8 +181,8 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
CC = clang
|
CC = clang
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# HTML5 emscripten compiler
|
# HTML5 emscripten compiler
|
||||||
# WARNING: To compile to HTML5, code must be redesigned
|
# WARNING: To compile to HTML5, code must be redesigned
|
||||||
# to use emscripten.h and emscripten_set_main_loop()
|
# to use emscripten.h and emscripten_set_main_loop()
|
||||||
CC = emcc
|
CC = emcc
|
||||||
|
|
@ -198,7 +200,7 @@ endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
else
|
else
|
||||||
|
|
@ -226,11 +228,11 @@ CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g -D_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
|
CFLAGS += -sASSERTIONS=1 --profiling
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||||
CFLAGS += -O3
|
CFLAGS += -O3
|
||||||
else
|
else
|
||||||
|
|
@ -320,7 +322,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||||
endif
|
endif
|
||||||
LDFLAGS += -L$(SDL_LIBRARY_PATH)
|
LDFLAGS += -L$(SDL_LIBRARY_PATH)
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# -Os # size optimization
|
# -Os # size optimization
|
||||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||||
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
|
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
|
||||||
|
|
@ -336,9 +338,14 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||||
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
# --source-map-base # allow debugging in browser with source map
|
# --source-map-base # allow debugging in browser with source map
|
||||||
LDFLAGS += -sUSE_GLFW=3 -sTOTAL_MEMORY=$(BUILD_WEB_HEAP_SIZE) -sFORCE_FILESYSTEM=1
|
|
||||||
|
|
||||||
# Build using asyncify
|
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)
|
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||||
LDFLAGS += -sASYNCIFY
|
LDFLAGS += -sASYNCIFY
|
||||||
endif
|
endif
|
||||||
|
|
@ -475,7 +482,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||||
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# Libraries for web (HTML5) compiling
|
# Libraries for web (HTML5) compiling
|
||||||
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
||||||
endif
|
endif
|
||||||
|
|
@ -676,7 +683,7 @@ others: $(OTHERS)
|
||||||
%: %.c
|
%: %.c
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
$(MAKE) -f Makefile.Android PROJECT_NAME=$@ PROJECT_SOURCE_FILES=$<
|
$(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 $@
|
$(MAKE) -f Makefile.Web $@
|
||||||
else
|
else
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -D$(TARGET_PLATFORM)
|
||||||
|
|
@ -705,7 +712,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
find . -type f -executable -delete
|
find . -type f -executable -delete
|
||||||
rm -fv *.o
|
rm -fv *.o
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
del *.wasm *.html *.js *.data
|
del *.wasm *.html *.js *.data
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ BUILD_WEB_HEAP_SIZE ?= 134217728
|
||||||
USE_WEBGL2 ?= FALSE
|
USE_WEBGL2 ?= FALSE
|
||||||
|
|
||||||
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
# 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!
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||||
# ifeq ($(UNAME),Msys) -> Windows
|
# ifeq ($(UNAME),Msys) -> Windows
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
|
|
@ -116,7 +116,7 @@ endif
|
||||||
# Define raylib release directory for compiled library
|
# Define raylib release directory for compiled library
|
||||||
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
|
RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/raylib/emsdk
|
EMSDK_PATH ?= C:/raylib/emsdk
|
||||||
|
|
@ -142,7 +142,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
CC = clang
|
CC = clang
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# HTML5 emscripten compiler
|
# HTML5 emscripten compiler
|
||||||
# WARNING: To compile to HTML5, code must be redesigned
|
# WARNING: To compile to HTML5, code must be redesigned
|
||||||
# to use emscripten.h and emscripten_set_main_loop()
|
# to use emscripten.h and emscripten_set_main_loop()
|
||||||
|
|
@ -161,7 +161,7 @@ endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
MAKE = mingw32-make
|
MAKE = mingw32-make
|
||||||
else
|
else
|
||||||
|
|
@ -189,11 +189,11 @@ CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE),DEBUG)
|
ifeq ($(BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g -D_DEBUG
|
CFLAGS += -g -D_DEBUG
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
CFLAGS += -sASSERTIONS=1 --profiling
|
CFLAGS += -sASSERTIONS=1 --profiling
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||||
CFLAGS += -O3
|
CFLAGS += -O3
|
||||||
else
|
else
|
||||||
|
|
@ -263,7 +263,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
|
LDFLAGS += -Lsrc -L$(RAYLIB_LIB_PATH)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# -Os # size optimization
|
# -Os # size optimization
|
||||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||||
# -sUSE_GLFW=3 # Use glfw3 library (context/input management)
|
# -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)
|
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
|
||||||
# --preload-file resources # specify a resources folder for data compilation
|
# --preload-file resources # specify a resources folder for data compilation
|
||||||
# --source-map-base # allow debugging in browser with source map
|
# --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
|
# Build using asyncify
|
||||||
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
ifeq ($(BUILD_WEB_ASYNCIFY),TRUE)
|
||||||
|
|
@ -363,7 +368,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||||
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl -latomic
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# Libraries for web (HTML5) compiling
|
# Libraries for web (HTML5) compiling
|
||||||
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
LDLIBS = $(RAYLIB_RELEASE_PATH)/libraylib.a
|
||||||
endif
|
endif
|
||||||
|
|
@ -1225,7 +1230,7 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||||
find . -type f -executable -delete
|
find . -type f -executable -delete
|
||||||
rm -fv *.o
|
rm -fv *.o
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
del *.o *.html *.js
|
del *.o *.html *.js
|
||||||
endif
|
endif
|
||||||
@echo Cleaning done
|
@echo Cleaning done
|
||||||
|
|
|
||||||
20
src/Makefile
20
src/Makefile
|
|
@ -20,6 +20,8 @@
|
||||||
# - Linux (X11 desktop mode)
|
# - Linux (X11 desktop mode)
|
||||||
# - macOS/OSX (x64, arm64 (not tested))
|
# - macOS/OSX (x64, arm64 (not tested))
|
||||||
# - Others (not tested)
|
# - Others (not tested)
|
||||||
|
# > PLATFORM_WEB_RGFW:
|
||||||
|
# - HTML5 (WebAssembly)
|
||||||
# > PLATFORM_WEB:
|
# > PLATFORM_WEB:
|
||||||
# - HTML5 (WebAssembly)
|
# - HTML5 (WebAssembly)
|
||||||
# > PLATFORM_DRM:
|
# > PLATFORM_DRM:
|
||||||
|
|
@ -130,7 +132,7 @@ HOST_PLATFORM_OS ?= WINDOWS
|
||||||
PLATFORM_OS ?= WINDOWS
|
PLATFORM_OS ?= WINDOWS
|
||||||
|
|
||||||
# Determine PLATFORM_OS when required
|
# 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!
|
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||||
# ifeq ($(UNAME),Msys) -> Windows
|
# ifeq ($(UNAME),Msys) -> Windows
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
|
|
@ -172,7 +174,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
PLATFORM_SHELL = sh
|
PLATFORM_SHELL = sh
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifndef PLATFORM_SHELL
|
ifndef PLATFORM_SHELL
|
||||||
PLATFORM_SHELL = sh
|
PLATFORM_SHELL = sh
|
||||||
|
|
@ -180,7 +182,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
ifeq ($(PLATFORM_OS), WINDOWS)
|
ifeq ($(PLATFORM_OS), WINDOWS)
|
||||||
# Emscripten required variables
|
# Emscripten required variables
|
||||||
EMSDK_PATH ?= C:/raylib/emsdk
|
EMSDK_PATH ?= C:/raylib/emsdk
|
||||||
|
|
@ -254,7 +256,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
# On DRM OpenGL ES 2.0 must be used
|
# On DRM OpenGL ES 2.0 must be used
|
||||||
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
||||||
endif
|
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
|
# On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0
|
||||||
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
||||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES3
|
#GRAPHICS = GRAPHICS_API_OPENGL_ES3
|
||||||
|
|
@ -288,7 +290,7 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
||||||
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
|
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# HTML5 emscripten compiler
|
# HTML5 emscripten compiler
|
||||||
CC = emcc
|
CC = emcc
|
||||||
AR = emar
|
AR = emar
|
||||||
|
|
@ -331,7 +333,7 @@ ifneq ($(RAYLIB_CONFIG_FLAGS), NONE)
|
||||||
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
|
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
|
||||||
endif
|
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
|
# NOTE: When using multi-threading in the user code, it requires -pthread enabled
|
||||||
CFLAGS += -std=gnu99
|
CFLAGS += -std=gnu99
|
||||||
else
|
else
|
||||||
|
|
@ -347,7 +349,7 @@ ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(RAYLIB_BUILD_MODE),RELEASE)
|
ifeq ($(RAYLIB_BUILD_MODE),RELEASE)
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
CFLAGS += -Os
|
CFLAGS += -Os
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
|
|
@ -366,7 +368,7 @@ endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
|
||||||
CFLAGS += -Werror=implicit-function-declaration
|
CFLAGS += -Werror=implicit-function-declaration
|
||||||
endif
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# -Os # size optimization
|
# -Os # size optimization
|
||||||
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
# -O2 # optimization level 2, if used, also set --memory-init-file 0
|
||||||
# -sUSE_GLFW=3 # Use glfw3 library (context/input management) -> Only for linker!
|
# -sUSE_GLFW=3 # Use glfw3 library (context/input management) -> Only for linker!
|
||||||
|
|
@ -659,7 +661,7 @@ all: raylib
|
||||||
# Compile raylib library
|
# Compile raylib library
|
||||||
# NOTE: Release directory is created if not exist
|
# NOTE: Release directory is created if not exist
|
||||||
raylib: $(OBJS)
|
raylib: $(OBJS)
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
|
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_WEB PLATFORM_WEB_RGFW))
|
||||||
# Compile raylib libray for web
|
# Compile raylib libray for web
|
||||||
#$(CC) $(OBJS) -r -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc
|
#$(CC) $(OBJS) -r -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).bc
|
||||||
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS)
|
$(AR) rcs $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).a $(OBJS)
|
||||||
|
|
|
||||||
10
src/external/RGFW.h
vendored
10
src/external/RGFW.h
vendored
|
|
@ -1640,7 +1640,7 @@ RGFW_window* RGFW_window_basic_init(RGFW_rect rect, u16 args) {
|
||||||
void RGFW_window_scaleToMonitor(RGFW_window* win) {
|
void RGFW_window_scaleToMonitor(RGFW_window* win) {
|
||||||
RGFW_monitor monitor = RGFW_window_getMonitor(win);
|
RGFW_monitor monitor = RGFW_window_getMonitor(win);
|
||||||
|
|
||||||
RGFW_window_resize(win, RGFW_AREA((u32)(monitor.scaleX * (float)win->r.w), (u32)(monitor.scaleX * (float)win->r.h)));
|
RGFW_window_resize(win, RGFW_AREA((u32)(monitor.scaleX * (float)win->r.w), (u32)(monitor.scaleY * (float)win->r.h)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -3766,10 +3766,10 @@ Start of Linux / Unix defines
|
||||||
monitor.scaleX = (float) (dpi_width) / (float) 96;
|
monitor.scaleX = (float) (dpi_width) / (float) 96;
|
||||||
monitor.scaleY = (float) (dpi_height) / (float) 96;
|
monitor.scaleY = (float) (dpi_height) / (float) 96;
|
||||||
|
|
||||||
if (monitor.scaleX > 1 && monitor.scaleX < 1.1)
|
if (isinf(monitor.scaleX) || (monitor.scaleX > 1 && monitor.scaleX < 1.1))
|
||||||
monitor.scaleX = 1;
|
monitor.scaleX = 1;
|
||||||
|
|
||||||
if (monitor.scaleY > 1 && monitor.scaleY < 1.1)
|
if (isinf(monitor.scaleY) || (monitor.scaleY > 1 && monitor.scaleY < 1.1))
|
||||||
monitor.scaleY = 1;
|
monitor.scaleY = 1;
|
||||||
|
|
||||||
XRRFreeCrtcInfo(ci);
|
XRRFreeCrtcInfo(ci);
|
||||||
|
|
@ -5276,7 +5276,9 @@ RGFW_UNUSED(win); /*!< if buffer rendering is not being used */
|
||||||
if (RGFW_Shcore_dll == NULL) {
|
if (RGFW_Shcore_dll == NULL) {
|
||||||
RGFW_Shcore_dll = LoadLibraryA("shcore.dll");
|
RGFW_Shcore_dll = LoadLibraryA("shcore.dll");
|
||||||
GetDpiForMonitorSRC = (PFN_GetDpiForMonitor)(void*)GetProcAddress(RGFW_Shcore_dll, "GetDpiForMonitor");
|
GetDpiForMonitorSRC = (PFN_GetDpiForMonitor)(void*)GetProcAddress(RGFW_Shcore_dll, "GetDpiForMonitor");
|
||||||
SetProcessDPIAware();
|
#if defined(_WIN64) || (_WIN32_WINNT >= 0x0600)
|
||||||
|
SetProcessDPIAware();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
* - Windows (Win32, Win64)
|
* - Windows (Win32, Win64)
|
||||||
* - Linux (X11/Wayland desktop mode)
|
* - Linux (X11/Wayland desktop mode)
|
||||||
* - MacOS (Cocoa)
|
* - MacOS (Cocoa)
|
||||||
|
* - HTML5 (Emscripten)
|
||||||
|
* - Others (untested)
|
||||||
*
|
*
|
||||||
* LIMITATIONS:
|
* LIMITATIONS:
|
||||||
* - TODO
|
* - 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
|
#define RGFW_OPENGL_ES2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
15
src/rcore.c
15
src/rcore.c
|
|
@ -12,6 +12,13 @@
|
||||||
* - Windows (Win32, Win64)
|
* - Windows (Win32, Win64)
|
||||||
* - Linux (X11/Wayland desktop mode)
|
* - Linux (X11/Wayland desktop mode)
|
||||||
* - Others (not tested)
|
* - 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:
|
* > PLATFORM_WEB:
|
||||||
* - HTML5 (WebAssembly)
|
* - HTML5 (WebAssembly)
|
||||||
* > PLATFORM_DRM:
|
* > PLATFORM_DRM:
|
||||||
|
|
@ -85,12 +92,12 @@
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Feature Test Macros required for this module
|
// 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
|
#undef _XOPEN_SOURCE
|
||||||
#define _XOPEN_SOURCE 500 // Required for: readlink if compiled with c99 without gnu ext.
|
#define _XOPEN_SOURCE 500 // Required for: readlink if compiled with c99 without gnu ext.
|
||||||
#endif
|
#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
|
#undef _POSIX_C_SOURCE
|
||||||
#define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext.
|
#define _POSIX_C_SOURCE 199309L // Required for: CLOCK_MONOTONIC if compiled with c99 without gnu ext.
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -540,7 +547,7 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
|
||||||
#include "platforms/rcore_desktop_glfw.c"
|
#include "platforms/rcore_desktop_glfw.c"
|
||||||
#elif defined(PLATFORM_DESKTOP_SDL)
|
#elif defined(PLATFORM_DESKTOP_SDL)
|
||||||
#include "platforms/rcore_desktop_sdl.c"
|
#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"
|
#include "platforms/rcore_desktop_rgfw.c"
|
||||||
#elif defined(PLATFORM_WEB)
|
#elif defined(PLATFORM_WEB)
|
||||||
#include "platforms/rcore_web.c"
|
#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)");
|
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (SDL)");
|
||||||
#elif defined(PLATFORM_DESKTOP_RGFW)
|
#elif defined(PLATFORM_DESKTOP_RGFW)
|
||||||
TRACELOG(LOG_INFO, "Platform backend: 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)
|
#elif defined(PLATFORM_WEB)
|
||||||
TRACELOG(LOG_INFO, "Platform backend: WEB (HTML5)");
|
TRACELOG(LOG_INFO, "Platform backend: WEB (HTML5)");
|
||||||
#elif defined(PLATFORM_DRM)
|
#elif defined(PLATFORM_DRM)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user