Skip to content

Commit

Permalink
pull
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed Nov 14, 2024
1 parent c7e5209 commit ee5afb1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
19 changes: 9 additions & 10 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,15 @@ 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
endif
endif
endif

ifeq ($(TARGET_PLATFORM),PLATFORM_WEB)
ifeq ($(PLATFORM_OS), WINDOWS)

ifeq ($(PLATFORM_OS), WINDOWS)
# Emscripten required variables
EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
Expand Down Expand Up @@ -254,7 +253,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_RGFW PLATFORM_WEB))
# 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
Expand Down Expand Up @@ -288,7 +287,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
Expand Down Expand Up @@ -331,7 +330,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
Expand Down Expand Up @@ -659,14 +658,14 @@ 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)!"
else
ifeq ($(RAYLIB_LIBTYPE),SHARED)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW, PLATFORM_DESKTOP_SDL PLATFORM_DESKTOP_RGFW))
ifeq ($(PLATFORM_OS),WINDOWS)
# NOTE: Linking with provided resource file
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/$(RAYLIB_LIB_NAME).dll $(OBJS) $(RAYLIB_RES_FILE) $(LDFLAGS) $(LDLIBS)
Expand Down
13 changes: 10 additions & 3 deletions src/platforms/rcore_desktop_rgfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@
*
**********************************************************************************************/

#if defined(GRAPHICS_API_OPENGL_ES2)
#if defined(GRAPHICS_API_OPENGL_ES2) && !defined(PLATFORM_WEB_RGFW)
#define RGFW_OPENGL_ES2
#endif

#ifdef PLATFORM_WEB_RGFW
#define RGFW_NO_GL_HEADER
#endif

void ShowCursor(void);
void CloseWindow(void);

Expand Down Expand Up @@ -1073,13 +1077,16 @@ void PollInputEvents(void)
{
CORE.Input.Mouse.currentPosition.x += (float)event->point.x;
CORE.Input.Mouse.currentPosition.y += (float)event->point.y;
}

printf("hold %i %i\n", event->point.x, event->point.y);
}
else
{
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
CORE.Input.Mouse.currentPosition.x = (float)event->point.x;
CORE.Input.Mouse.currentPosition.y = (float)event->point.y;
}
printf("%i %i\n", event->point.x, event->point.y);
}

CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
touchAction = 2;
Expand Down
10 changes: 6 additions & 4 deletions src/rcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@
//----------------------------------------------------------------------------------
// Feature Test Macros required for this module
//----------------------------------------------------------------------------------
#if (defined(__linux__) || defined(PLATFORM_WEB)) && (_XOPEN_SOURCE < 500)
#undef _XOPEN_SOURCE
#if (defined(__linux__) || (defined(PLATFORM_WEB) || defined(PLATFORM_RGFW_WEB))) && (_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_RGFW_WEB))) && (_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
Expand Down Expand Up @@ -523,7 +523,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"
Expand Down Expand Up @@ -594,6 +594,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)");
#elif defined(PLATFORM_WEB)
TRACELOG(LOG_INFO, "Platform backend: WEB (HTML5)");
#elif defined(PLATFORM_DRM)
Expand Down

0 comments on commit ee5afb1

Please sign in to comment.