Remove PLATFORM_RPI (#3232)
* Remove PLATFORM_RPI * remove build artifacts --------- Co-authored-by: MichaelFiber <michael@cubeofb.org> Co-authored-by: Ray <raysan5@gmail.com>
This commit is contained in:
parent
8cf76ec113
commit
18e9784c6d
@ -73,19 +73,6 @@ elseif (${PLATFORM} MATCHES "Android")
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
||||
|
||||
elseif (${PLATFORM} MATCHES "Raspberry Pi")
|
||||
set(PLATFORM_CPP "PLATFORM_RPI")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
|
||||
add_definitions(-D_DEFAULT_SOURCE)
|
||||
|
||||
find_library(GLESV2 brcmGLESv2 HINTS /opt/vc/lib)
|
||||
find_library(EGL brcmEGL HINTS /opt/vc/lib)
|
||||
find_library(BCMHOST bcm_host HINTS /opt/vc/lib)
|
||||
include_directories(/opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads)
|
||||
link_directories(/opt/vc/lib)
|
||||
set(LIBS_PRIVATE ${GLESV2} ${EGL} ${BCMHOST} pthread rt m dl)
|
||||
|
||||
elseif ("${PLATFORM}" MATCHES "DRM")
|
||||
set(PLATFORM_CPP "PLATFORM_DRM")
|
||||
set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
# Define required environment variables
|
||||
#------------------------------------------------------------------------------------------------
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
|
||||
# Define required raylib variables
|
||||
@ -58,15 +58,6 @@ BUILD_WEB_HEAP_SIZE ?= 134217728
|
||||
BUILD_WEB_RESOURCES ?= TRUE
|
||||
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
||||
|
||||
# Use cross-compiler for PLATFORM_RPI
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
USE_RPI_CROSS_COMPILER ?= FALSE
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
|
||||
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
|
||||
endif
|
||||
endif
|
||||
|
||||
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
@ -95,12 +86,6 @@ ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
UNAMEOS = $(shell uname)
|
||||
ifeq ($(UNAMEOS),Linux)
|
||||
PLATFORM_OS = LINUX
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
UNAMEOS = $(shell uname)
|
||||
ifeq ($(UNAMEOS),Linux)
|
||||
@ -118,9 +103,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
endif
|
||||
|
||||
# Default path for raylib on Raspberry Pi
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
RAYLIB_PATH ?= /home/pi/raylib
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
RAYLIB_PATH ?= /home/pi/raylib
|
||||
endif
|
||||
@ -154,13 +136,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
CC = clang
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
# Define RPI cross-compiler
|
||||
#CC = armv6j-hardfloat-linux-gnueabi-gcc
|
||||
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
# HTML5 emscripten compiler
|
||||
# WARNING: To compile to HTML5, code must be redesigned
|
||||
@ -231,9 +206,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
CFLAGS += -std=gnu99
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
||||
endif
|
||||
@ -252,11 +224,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
INCLUDE_PATHS += -I/usr/include/libdrm
|
||||
endif
|
||||
@ -328,9 +295,6 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
|
||||
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
|
||||
endif
|
||||
|
||||
# Define libraries required on linking: LDLIBS
|
||||
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
|
||||
@ -381,14 +345,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
LDLIBS += -lglfw
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
# Libraries for Raspberry Pi compiling
|
||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -latomic
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
LDLIBS += -lvchiq_arm -lvcos
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
# Libraries for DRM compiling
|
||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
@ -593,10 +549,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
rm -f *.o
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
find . -type f -executable -delete
|
||||
rm -fv *.o
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
find . -type f -executable -delete
|
||||
rm -fv *.o
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
# Define required environment variables
|
||||
#------------------------------------------------------------------------------------------------
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
PLATFORM ?= PLATFORM_WEB
|
||||
|
||||
# Define required raylib variables
|
||||
@ -51,15 +51,6 @@ USE_EXTERNAL_GLFW ?= FALSE
|
||||
# NOTE: This variable is only used for PLATFORM_OS: LINUX
|
||||
USE_WAYLAND_DISPLAY ?= FALSE
|
||||
|
||||
# Use cross-compiler for PLATFORM_RPI
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
USE_RPI_CROSS_COMPILER ?= FALSE
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
|
||||
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot
|
||||
endif
|
||||
endif
|
||||
|
||||
# Determine PLATFORM_OS in case PLATFORM_DESKTOP or PLATFORM_WEB selected
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
@ -88,12 +79,6 @@ ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_WEB))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
UNAMEOS = $(shell uname)
|
||||
ifeq ($(UNAMEOS),Linux)
|
||||
PLATFORM_OS = LINUX
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
UNAMEOS = $(shell uname)
|
||||
ifeq ($(UNAMEOS),Linux)
|
||||
@ -111,9 +96,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
endif
|
||||
|
||||
# Default path for raylib on Raspberry Pi
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
RAYLIB_PATH ?= /home/pi/raylib
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
RAYLIB_PATH ?= /home/pi/raylib
|
||||
endif
|
||||
@ -147,13 +129,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
CC = clang
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
# Define RPI cross-compiler
|
||||
#CC = armv6j-hardfloat-linux-gnueabi-gcc
|
||||
CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
# HTML5 emscripten compiler
|
||||
# WARNING: To compile to HTML5, code must be redesigned
|
||||
@ -224,9 +199,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
CFLAGS += -std=gnu99
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
CFLAGS += -std=gnu99 -DEGL_NO_X11
|
||||
endif
|
||||
@ -245,11 +217,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
INCLUDE_PATHS += -I$(RAYLIB_INCLUDE_PATH)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
INCLUDE_PATHS += -I/usr/include/libdrm
|
||||
endif
|
||||
@ -304,9 +271,6 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
|
||||
EXT = .html
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
LDFLAGS += -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
|
||||
endif
|
||||
|
||||
# Define libraries required on linking: LDLIBS
|
||||
# NOTE: To link libraries (lib<name>.so or lib<name>.a), use -l<name>
|
||||
@ -357,14 +321,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
LDLIBS += -lglfw
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
# Libraries for Raspberry Pi compiling
|
||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
LDLIBS = -lraylib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl -latomic
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
LDLIBS += -lvchiq_arm -lvcos
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
# Libraries for DRM compiling
|
||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
@ -1067,10 +1023,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
rm -f *.o
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
find . -type f -executable -delete
|
||||
rm -fv *.o
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
find . -type f -executable -delete
|
||||
rm -fv *.o
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||
*
|
||||
* NOTE: This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
|
||||
* NOTE: This example is prepared to compile for PLATFORM_WEB, and PLATFORM_DESKTOP
|
||||
* As you will notice, code structure is slightly diferent to the other examples...
|
||||
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||
*
|
||||
|
@ -21,13 +21,8 @@
|
||||
|
||||
// NOTE: Gamepad name ID depends on drivers and OS
|
||||
#define XBOX360_LEGACY_NAME_ID "Xbox Controller"
|
||||
#if defined(PLATFORM_RPI)
|
||||
#define XBOX360_NAME_ID "Microsoft X-Box 360 pad"
|
||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||
#else
|
||||
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||
#endif
|
||||
#define XBOX360_NAME_ID "Xbox 360 Controller"
|
||||
#define PS3_NAME_ID "PLAYSTATION(R)3 Controller"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Program main entry point
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#endif
|
||||
#define GLSL_VERSION 330
|
||||
#endif
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB -> Not supported at this moment
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB -> Not supported at this moment
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#else // PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#endif
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* raylib [core] example - Basic window (adapted for HTML5 platform)
|
||||
*
|
||||
* This example is prepared to compile for PLATFORM_WEB, PLATFORM_DESKTOP and PLATFORM_RPI
|
||||
* This example is prepared to compile for PLATFORM_WEB and PLATFORM_DESKTOP
|
||||
* As you will notice, code structure is slightly different to the other examples...
|
||||
* To compile it for PLATFORM_WEB just uncomment #define PLATFORM_WEB at beginning
|
||||
*
|
||||
|
@ -32,7 +32,7 @@ RAYLIB_PATH ?= ..\..
|
||||
COMPILER_PATH ?= C:/raylib/w64devkit/bin
|
||||
|
||||
# Define default options
|
||||
# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
# One of PLATFORM_DESKTOP, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
|
||||
# Locations of your newly installed library and associated headers. See ../src/Makefile
|
||||
|
55
src/Makefile
55
src/Makefile
@ -8,7 +8,6 @@
|
||||
# PLATFORM_DESKTOP: OSX/macOS (arm64, x86_64)
|
||||
# PLATFORM_DESKTOP: FreeBSD, OpenBSD, NetBSD, DragonFly
|
||||
# PLATFORM_ANDROID: Android (arm, i686, arm64, x86_64)
|
||||
# PLATFORM_RPI: Raspberry Pi (deprecated - RPI OS Buster only)
|
||||
# PLATFORM_DRM: Linux native mode, including Raspberry Pi (RPI OS Bullseye)
|
||||
# PLATFORM_WEB: HTML5 (Chrome, Firefox)
|
||||
#
|
||||
@ -41,7 +40,7 @@
|
||||
|
||||
# Define required environment variables
|
||||
#------------------------------------------------------------------------------------------------
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
|
||||
# Define required raylib variables
|
||||
@ -94,14 +93,6 @@ USE_EXTERNAL_GLFW ?= FALSE
|
||||
# NOTE: This variable is only used for PLATFORM_OS: LINUX
|
||||
USE_WAYLAND_DISPLAY ?= FALSE
|
||||
|
||||
# Use cross-compiler for PLATFORM_RPI
|
||||
USE_RPI_CROSS_COMPILER ?= FALSE
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry
|
||||
RPI_TOOLCHAIN_NAME ?= arm-linux-gnueabihf
|
||||
RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/$(RPI_TOOLCHAIN_NAME)/sysroot
|
||||
endif
|
||||
|
||||
# Determine if the file has root access (only required to install raylib)
|
||||
# "whoami" prints the name of the user that calls him (so, if it is the root user, "whoami" prints "root")
|
||||
ROOT = $(shell whoami)
|
||||
@ -144,15 +135,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
UNAMEOS = $(shell uname)
|
||||
ifeq ($(UNAMEOS),Linux)
|
||||
PLATFORM_OS = LINUX
|
||||
endif
|
||||
ifndef PLATFORM_SHELL
|
||||
PLATFORM_SHELL = sh
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
UNAMEOS = $(shell uname)
|
||||
ifeq ($(UNAMEOS),Linux)
|
||||
@ -235,10 +217,7 @@ 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_RPI)
|
||||
# On RPI OpenGL ES 2.0 must be used
|
||||
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
# On DRM OpenGL ES 2.0 must be used
|
||||
GRAPHICS = GRAPHICS_API_OPENGL_ES2
|
||||
@ -269,14 +248,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
CC = clang
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
# Define RPI cross-compiler
|
||||
#CC = armv6j-hardfloat-linux-gnueabi-gcc
|
||||
CC = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-gcc
|
||||
AR = $(RPI_TOOLCHAIN)/bin/$(RPI_TOOLCHAIN_NAME)-ar
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
ifeq ($(USE_RPI_CROSS_COMPILER),TRUE)
|
||||
# Define RPI cross-compiler
|
||||
@ -452,11 +423,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
INCLUDE_PATHS += -I/usr/local/include
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux
|
||||
INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
INCLUDE_PATHS += -I/usr/include/libdrm
|
||||
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
|
||||
@ -506,9 +472,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).$(RAYLIB_API_VERSION).so -Lsrc -L/usr/local/lib
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) -L$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/lib
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
LDFLAGS += -Wl,-soname,lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
|
||||
ifeq ($(USE_RPI_CROSSCOMPILER), TRUE)
|
||||
@ -557,12 +520,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
LDLIBS = -lglfw
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
LDLIBS = -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
|
||||
ifeq ($(RAYLIB_MODULE_AUDIO),TRUE)
|
||||
LDLIBS += -latomic
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
LDLIBS = -lGLESv2 -lEGL -ldrm -lgbm -lpthread -lrt -lm -ldl
|
||||
ifeq ($(RAYLIB_MODULE_AUDIO),TRUE)
|
||||
@ -647,14 +604,6 @@ else
|
||||
cd $(RAYLIB_RELEASE_PATH) && ln -fs lib$(RAYLIB_LIB_NAME).$(RAYLIB_VERSION).so lib$(RAYLIB_LIB_NAME).so
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||
# Compile raylib shared library version $(RAYLIB_VERSION).
|
||||
# WARNING: you should type "make clean" before doing this target
|
||||
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||
@echo "raylib shared library generated (lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!"
|
||||
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_VERSION) lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION)
|
||||
cd $(RAYLIB_RELEASE_PATH) && ln -fsv lib$(RAYLIB_LIB_NAME).so.$(RAYLIB_API_VERSION) lib$(RAYLIB_LIB_NAME).so
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
# Compile raylib shared library version $(RAYLIB_VERSION).
|
||||
# WARNING: you should type "make clean" before doing this target
|
||||
|
150
src/rcore.c
150
src/rcore.c
@ -8,7 +8,6 @@
|
||||
* - PLATFORM_DESKTOP: FreeBSD, OpenBSD, NetBSD, DragonFly (X11 desktop)
|
||||
* - PLATFORM_DESKTOP: OSX/macOS
|
||||
* - PLATFORM_ANDROID: Android (ARM, ARM64)
|
||||
* - PLATFORM_RPI: Raspberry Pi 0,1,2,3 (Raspbian, native mode)
|
||||
* - PLATFORM_DRM: Linux native mode, including Raspberry Pi 4 with V3D fkms driver
|
||||
* - PLATFORM_WEB: HTML5 with WebAssembly
|
||||
*
|
||||
@ -21,12 +20,6 @@
|
||||
* Windowing and input system configured for Android device, app activity managed internally in this module.
|
||||
* NOTE: OpenGL ES 2.0 is required and graphic device is managed by EGL
|
||||
*
|
||||
* #define PLATFORM_RPI (deprecated - RPI OS Buster only)
|
||||
* Windowing and input system configured for Raspberry Pi in native mode (no XWindow required),
|
||||
* graphic device is managed by EGL and inputs are processed is raw mode, reading from /dev/input/
|
||||
* WARNING: This platform is deprecated, since RPI OS Bullseye, the old Dispmanx libraries are not
|
||||
* supported and you must be using PLATFORM_DRM
|
||||
*
|
||||
* #define PLATFORM_DRM
|
||||
* Windowing and input system configured for DRM native mode (RPI4 and other devices)
|
||||
* graphic device is managed by EGL and inputs are processed is raw mode, reading from /dev/input/
|
||||
@ -260,7 +253,7 @@
|
||||
//#include <GLES2/gl2.h> // OpenGL ES 2.0 library (not required in this module, only in rlgl)
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
#include <fcntl.h> // POSIX file control definitions - open(), creat(), fcntl()
|
||||
#include <unistd.h> // POSIX standard function definitions - read(), close(), STDIN_FILENO
|
||||
#include <termios.h> // POSIX terminal control definitions - tcgetattr(), tcsetattr()
|
||||
@ -272,9 +265,6 @@
|
||||
#include <linux/input.h> // Linux: Keycodes constants definition (KEY_A, ...)
|
||||
#include <linux/joystick.h> // Linux: Joystick support library
|
||||
|
||||
#if defined(PLATFORM_RPI)
|
||||
#include "bcm_host.h" // Raspberry Pi VideoCore IV access functions
|
||||
#endif
|
||||
#if defined(PLATFORM_DRM)
|
||||
#include <gbm.h> // Generic Buffer Management (native platform for EGL on DRM)
|
||||
#include <xf86drm.h> // Direct Rendering Manager user-level library interface
|
||||
@ -299,7 +289,7 @@
|
||||
//----------------------------------------------------------------------------------
|
||||
// Defines and Macros
|
||||
//----------------------------------------------------------------------------------
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
#define USE_LAST_TOUCH_DEVICE // When multiple touchscreens are connected, only use the one with the highest event<N> number
|
||||
|
||||
#define DEFAULT_GAMEPAD_DEV "/dev/input/js" // Gamepad input (base dev for all gamepads: js0, js1, ...)
|
||||
@ -351,7 +341,7 @@
|
||||
//----------------------------------------------------------------------------------
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
typedef struct {
|
||||
pthread_t threadId; // Event reading thread id
|
||||
int fd; // File descriptor to the device it is assigned to
|
||||
@ -375,10 +365,7 @@ typedef struct CoreData {
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||
GLFWwindow *handle; // GLFW window handle (graphic device)
|
||||
#endif
|
||||
#if defined(PLATFORM_RPI)
|
||||
EGL_DISPMANX_WINDOW_T handle; // Native window handle (graphic device)
|
||||
#endif
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
int fd; // File descriptor for /dev/dri/...
|
||||
drmModeConnector *connector; // Direct Rendering Manager (DRM) mode connector
|
||||
@ -428,7 +415,7 @@ typedef struct CoreData {
|
||||
const char *basePath; // Base path for data storage
|
||||
} Storage;
|
||||
struct {
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
InputEventWorker eventWorker[10]; // List of worker threads for every monitored "/dev/input/event<N>"
|
||||
#endif
|
||||
struct {
|
||||
@ -444,7 +431,7 @@ typedef struct CoreData {
|
||||
int charPressedQueue[MAX_CHAR_PRESSED_QUEUE]; // Input characters queue (unicode)
|
||||
int charPressedQueueCount; // Input characters queue count
|
||||
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
int defaultMode; // Default keyboard mode
|
||||
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||
bool evtMode; // Keyboard in event mode
|
||||
@ -468,7 +455,7 @@ typedef struct CoreData {
|
||||
char previousButtonState[MAX_MOUSE_BUTTONS]; // Registers previous mouse button state
|
||||
Vector2 currentWheelMove; // Registers current mouse wheel variation
|
||||
Vector2 previousWheelMove; // Registers previous mouse wheel variation
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
Vector2 eventWheelMove; // Registers the event mouse wheel variation
|
||||
// NOTE: currentButtonState[] can't be written directly due to multithreading, app could miss the update
|
||||
char currentButtonStateEvdev[MAX_MOUSE_BUTTONS]; // Holds the new mouse state for the next polling event to grab
|
||||
@ -489,7 +476,7 @@ typedef struct CoreData {
|
||||
char currentButtonState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Current gamepad buttons state
|
||||
char previousButtonState[MAX_GAMEPADS][MAX_GAMEPAD_BUTTONS]; // Previous gamepad buttons state
|
||||
float axisState[MAX_GAMEPADS][MAX_GAMEPAD_AXIS]; // Gamepad axis state
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
pthread_t threadId; // Gamepad reading thread id
|
||||
int streamId[MAX_GAMEPADS]; // Gamepad device file descriptor
|
||||
#endif
|
||||
@ -502,7 +489,7 @@ typedef struct CoreData {
|
||||
double draw; // Time measure for frame draw
|
||||
double frame; // Time measure for one frame
|
||||
double target; // Desired time for one frame, if 0 not applied
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
unsigned long long int base; // Base time measure for hi-res timer
|
||||
#endif
|
||||
unsigned int frameCounter; // Frame counter
|
||||
@ -667,7 +654,7 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
|
||||
static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData);
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
static void InitKeyboard(void); // Initialize raw keyboard system
|
||||
static void RestoreKeyboard(void); // Restore keyboard system
|
||||
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||
@ -682,13 +669,11 @@ static void *EventThread(void *arg); // Input device events r
|
||||
static void InitGamepad(void); // Initialize raw gamepad input
|
||||
static void *GamepadThread(void *arg); // Mouse reading thread
|
||||
|
||||
#if defined(PLATFORM_DRM)
|
||||
static int FindMatchingConnectorMode(const drmModeConnector *connector, const drmModeModeInfo *mode); // Search matching DRM mode in connector's mode list
|
||||
static int FindExactConnectorMode(const drmModeConnector *connector, uint width, uint height, uint fps, bool allowInterlaced); // Search exactly matching DRM connector mode in connector's list
|
||||
static int FindNearestConnectorMode(const drmModeConnector *connector, uint width, uint height, uint fps, bool allowInterlaced); // Search the nearest matching DRM connector mode in connector's list
|
||||
#endif
|
||||
|
||||
#endif // PLATFORM_RPI || PLATFORM_DRM
|
||||
#endif // PLATFORM_DRM
|
||||
|
||||
#if defined(SUPPORT_EVENTS_AUTOMATION)
|
||||
static void LoadAutomationEvents(const char *fileName); // Load automation events from file
|
||||
@ -857,7 +842,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) || defined(PLATFORM_DRM)
|
||||
// Initialize graphics device (display device and OpenGL context)
|
||||
// NOTE: returns true if window and graphic device has been initialized successfully
|
||||
CORE.Window.ready = InitGraphicsDevice(width, height);
|
||||
@ -916,7 +901,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
// Initialize raw input system
|
||||
InitEvdevInput(); // Evdev inputs initialization
|
||||
InitGamepad(); // Gamepad init
|
||||
@ -958,7 +943,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
CORE.Time.frameCounter = 0;
|
||||
#endif
|
||||
|
||||
#endif // PLATFORM_DESKTOP || PLATFORM_WEB || PLATFORM_RPI || PLATFORM_DRM
|
||||
#endif // PLATFORM_DESKTOP || PLATFORM_WEB || PLATFORM_DRM
|
||||
}
|
||||
|
||||
// Close window and unload OpenGL context
|
||||
@ -988,7 +973,7 @@ void CloseWindow(void)
|
||||
timeEndPeriod(1); // Restore time period
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
// Close surface, context and display
|
||||
if (CORE.Window.device != EGL_NO_DISPLAY)
|
||||
{
|
||||
@ -1076,7 +1061,7 @@ void CloseWindow(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
// Wait for mouse and gamepad threads to finish before closing
|
||||
// NOTE: Those threads should already have finished at this point
|
||||
// because they are controlled by CORE.Window.shouldClose variable
|
||||
@ -1138,7 +1123,7 @@ bool WindowShouldClose(void)
|
||||
else return true;
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
if (CORE.Window.ready) return CORE.Window.shouldClose;
|
||||
else return true;
|
||||
#endif
|
||||
@ -1324,7 +1309,7 @@ void ToggleFullscreen(void)
|
||||
|
||||
CORE.Window.fullscreen = !CORE.Window.fullscreen; // Toggle fullscreen flag
|
||||
#endif
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
TRACELOG(LOG_WARNING, "SYSTEM: Failed to toggle to windowed mode");
|
||||
#endif
|
||||
}
|
||||
@ -3047,7 +3032,7 @@ double GetTime(void)
|
||||
time = glfwGetTime(); // Elapsed time since glfwInit()
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
struct timespec ts = { 0 };
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
unsigned long long int nanoSeconds = (unsigned long long int)ts.tv_sec*1000000000LLU + (unsigned long long int)ts.tv_nsec;
|
||||
@ -3883,7 +3868,7 @@ const char *GetGamepadName(int gamepad)
|
||||
if (CORE.Input.Gamepad.ready[gamepad]) return glfwGetJoystickName(gamepad);
|
||||
else return NULL;
|
||||
#endif
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
if (CORE.Input.Gamepad.ready[gamepad]) ioctl(CORE.Input.Gamepad.streamId[gamepad], JSIOCGNAME(64), &CORE.Input.Gamepad.name[gamepad]);
|
||||
return CORE.Input.Gamepad.name[gamepad];
|
||||
#endif
|
||||
@ -3896,7 +3881,7 @@ const char *GetGamepadName(int gamepad)
|
||||
// Get gamepad axis count
|
||||
int GetGamepadAxisCount(int gamepad)
|
||||
{
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
int axisCount = 0;
|
||||
if (CORE.Input.Gamepad.ready[gamepad]) ioctl(CORE.Input.Gamepad.streamId[gamepad], JSIOCGAXES, &axisCount);
|
||||
CORE.Input.Gamepad.axisCount = axisCount;
|
||||
@ -4138,7 +4123,7 @@ int GetTouchX(void)
|
||||
{
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
||||
return (int)CORE.Input.Touch.position[0].x;
|
||||
#else // PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM
|
||||
#else // PLATFORM_DESKTOP, PLATFORM_DRM
|
||||
return GetMouseX();
|
||||
#endif
|
||||
}
|
||||
@ -4148,7 +4133,7 @@ int GetTouchY(void)
|
||||
{
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
||||
return (int)CORE.Input.Touch.position[0].y;
|
||||
#else // PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_DRM
|
||||
#else // PLATFORM_DESKTOP, PLATFORM_DRM
|
||||
return GetMouseY();
|
||||
#endif
|
||||
}
|
||||
@ -4165,7 +4150,7 @@ Vector2 GetTouchPosition(int index)
|
||||
// https://docs.microsoft.com/en-us/windows/win32/wintouch/getting-started-with-multi-touch-messages
|
||||
if (index == 0) position = GetMousePosition();
|
||||
#endif
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB) || defined(PLATFORM_DRM)
|
||||
if (index < MAX_TOUCH_POINTS) position = CORE.Input.Touch.position[index];
|
||||
else TRACELOG(LOG_WARNING, "INPUT: Required touch point out of range (Max touch points: %i)", MAX_TOUCH_POINTS);
|
||||
#endif
|
||||
@ -4537,21 +4522,10 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
|
||||
#endif // PLATFORM_DESKTOP || PLATFORM_WEB
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
CORE.Window.fullscreen = true;
|
||||
CORE.Window.flags |= FLAG_FULLSCREEN_MODE;
|
||||
|
||||
#if defined(PLATFORM_RPI)
|
||||
bcm_host_init();
|
||||
|
||||
DISPMANX_ELEMENT_HANDLE_T dispmanElement = { 0 };
|
||||
DISPMANX_DISPLAY_HANDLE_T dispmanDisplay = { 0 };
|
||||
DISPMANX_UPDATE_HANDLE_T dispmanUpdate = { 0 };
|
||||
|
||||
VC_RECT_T dstRect = { 0 };
|
||||
VC_RECT_T srcRect = { 0 };
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_DRM)
|
||||
CORE.Window.fd = -1;
|
||||
CORE.Window.connector = NULL;
|
||||
@ -4748,7 +4722,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
EGLint numConfigs = 0;
|
||||
|
||||
// Get an EGL device connection
|
||||
@ -4863,58 +4837,6 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.surface = eglCreateWindowSurface(CORE.Window.device, CORE.Window.config, CORE.Android.app->window, NULL);
|
||||
#endif // PLATFORM_ANDROID
|
||||
|
||||
#if defined(PLATFORM_RPI)
|
||||
graphics_get_display_size(0, &CORE.Window.display.width, &CORE.Window.display.height);
|
||||
|
||||
// Screen size security check
|
||||
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;
|
||||
|
||||
// At this point we need to manage render size vs screen size
|
||||
// NOTE: This function use and modify global module variables:
|
||||
// -> CORE.Window.screen.width/CORE.Window.screen.height
|
||||
// -> CORE.Window.render.width/CORE.Window.render.height
|
||||
// -> CORE.Window.screenScale
|
||||
SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
dstRect.x = 0;
|
||||
dstRect.y = 0;
|
||||
dstRect.width = CORE.Window.display.width;
|
||||
dstRect.height = CORE.Window.display.height;
|
||||
|
||||
srcRect.x = 0;
|
||||
srcRect.y = 0;
|
||||
srcRect.width = CORE.Window.render.width << 16;
|
||||
srcRect.height = CORE.Window.render.height << 16;
|
||||
|
||||
// NOTE: RPI dispmanx windowing system takes care of source rectangle scaling to destination rectangle by hardware (no cost)
|
||||
// Take care that renderWidth/renderHeight fit on displayWidth/displayHeight aspect ratio
|
||||
|
||||
VC_DISPMANX_ALPHA_T alpha = { 0 };
|
||||
alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
|
||||
//alpha.flags = DISPMANX_FLAGS_ALPHA_FROM_SOURCE; // TODO: Allow transparent framebuffer! -> FLAG_WINDOW_TRANSPARENT
|
||||
alpha.opacity = 255; // Set transparency level for framebuffer, requires EGLAttrib: EGL_TRANSPARENT_TYPE
|
||||
alpha.mask = 0;
|
||||
|
||||
dispmanDisplay = vc_dispmanx_display_open(0); // LCD
|
||||
dispmanUpdate = vc_dispmanx_update_start(0);
|
||||
|
||||
dispmanElement = vc_dispmanx_element_add(dispmanUpdate, dispmanDisplay, 0/*layer*/, &dstRect, 0/*src*/,
|
||||
&srcRect, DISPMANX_PROTECTION_NONE, &alpha, 0/*clamp*/, DISPMANX_NO_ROTATE);
|
||||
|
||||
CORE.Window.handle.element = dispmanElement;
|
||||
CORE.Window.handle.width = CORE.Window.render.width;
|
||||
CORE.Window.handle.height = CORE.Window.render.height;
|
||||
vc_dispmanx_update_submit_sync(dispmanUpdate);
|
||||
|
||||
CORE.Window.surface = eglCreateWindowSurface(CORE.Window.device, CORE.Window.config, &CORE.Window.handle, NULL);
|
||||
|
||||
const unsigned char *const renderer = glGetString(GL_RENDERER);
|
||||
if (renderer) TRACELOG(LOG_INFO, "DISPLAY: Renderer name is: %s", renderer);
|
||||
else TRACELOG(LOG_WARNING, "DISPLAY: Failed to get renderer name");
|
||||
//---------------------------------------------------------------------------------
|
||||
#endif // PLATFORM_RPI
|
||||
|
||||
#if defined(PLATFORM_DRM)
|
||||
CORE.Window.surface = eglCreateWindowSurface(CORE.Window.device, CORE.Window.config, (EGLNativeWindowType)CORE.Window.gbmSurface, NULL);
|
||||
if (EGL_NO_SURFACE == CORE.Window.surface)
|
||||
@ -4952,7 +4874,7 @@ static bool InitGraphicsDevice(int width, int 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);
|
||||
}
|
||||
#endif // PLATFORM_ANDROID || PLATFORM_RPI || PLATFORM_DRM
|
||||
#endif // PLATFORM_ANDROID || PLATFORM_DRM
|
||||
|
||||
// Load OpenGL extensions
|
||||
// NOTE: GL procedures address loader is required to load extensions
|
||||
@ -5096,7 +5018,7 @@ static void InitTimer(void)
|
||||
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
struct timespec now = { 0 };
|
||||
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &now) == 0) // Success
|
||||
@ -5160,7 +5082,7 @@ void SwapScreenBuffer(void)
|
||||
glfwSwapBuffers(CORE.Window.handle);
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_DRM)
|
||||
eglSwapBuffers(CORE.Window.device, CORE.Window.surface);
|
||||
|
||||
#if defined(PLATFORM_DRM)
|
||||
@ -5190,7 +5112,7 @@ void SwapScreenBuffer(void)
|
||||
CORE.Window.prevBO = bo;
|
||||
|
||||
#endif // PLATFORM_DRM
|
||||
#endif // PLATFORM_ANDROID || PLATFORM_RPI || PLATFORM_DRM
|
||||
#endif // PLATFORM_ANDROID || PLATFORM_DRM
|
||||
}
|
||||
|
||||
// Register all input events
|
||||
@ -5208,13 +5130,11 @@ void PollInputEvents(void)
|
||||
// Reset key repeats
|
||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++) CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||
|
||||
#if !(defined(PLATFORM_RPI) || defined(PLATFORM_DRM))
|
||||
// Reset last gamepad button/axis registered state
|
||||
CORE.Input.Gamepad.lastButtonPressed = 0; // GAMEPAD_BUTTON_UNKNOWN
|
||||
CORE.Input.Gamepad.axisCount = 0;
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
// Register previous keys states
|
||||
for (int i = 0; i < MAX_KEYBOARD_KEYS; i++)
|
||||
{
|
||||
@ -5461,7 +5381,7 @@ void PollInputEvents(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(PLATFORM_RPI) || defined(PLATFORM_DRM)) && defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||
#if defined(PLATFORM_DRM) && defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||
// NOTE: Keyboard reading could be done using input_event(s) or just read from stdin, both methods are used here.
|
||||
// stdin reading is still used for legacy purposes, it allows keyboard input trough SSH console
|
||||
|
||||
@ -6336,7 +6256,7 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
// Initialize Keyboard system (using standard input)
|
||||
static void InitKeyboard(void)
|
||||
{
|
||||
@ -6977,7 +6897,7 @@ static void *EventThread(void *arg)
|
||||
if (CORE.Input.Touch.position[2].x >= 0) CORE.Input.Touch.pointCount++;
|
||||
if (CORE.Input.Touch.position[3].x >= 0) CORE.Input.Touch.pointCount++;
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM) // PLATFORM_RPI, PLATFORM_DRM
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM) // PLATFORM_DRM
|
||||
if (gestureUpdate)
|
||||
{
|
||||
GestureEvent gestureEvent = { 0 };
|
||||
@ -7094,7 +7014,7 @@ static void *GamepadThread(void *arg)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif // PLATFORM_RPI || PLATFORM_DRM
|
||||
#endif // PLATFORM_DRM
|
||||
|
||||
#if defined(PLATFORM_DRM)
|
||||
// Search matching DRM mode in connector's mode list
|
||||
|
@ -815,7 +815,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||
|
||||
// It seems OpenGL ES 2.0 instancing entry points are not defined on Raspberry Pi
|
||||
// provided headers (despite being defined in official Khronos GLES2 headers)
|
||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||
#if defined(PLATFORM_DRM)
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
|
||||
|
Loading…
Reference in New Issue
Block a user