mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-16 16:28:14 +00:00
[rcore][win32] Adding native win32 backend (#4869)
* win32 backend * [rcore][win32] use SwapBuffers instead of wglSwapLayerBuffers I don't understand OpenGL well enough to know the difference between SwapBuffers and wglSwapLayerBuffers but the former seems to double my FPS (from 2000 to about 4000 in core_vr_simulator). * [rcore][win32] stop lying to the OS about when our window is updated Instead of calling BeginPaint/EndPaint in WM_PAINT which signals to the OS that our window content is updated, now when we encounter the WM_PAINT message instead we return back to the raylib application which will trigger it to render a new frame. We've replaced the call to BeginPaint and EndPaint with a call to ValidateRect in SwapBuffers, which, means we're now correctly telling the OS when our window content is actually up-to-date. Note that this doesn't fix the window content not being updated during a window resize/move beacuse thos have their own message loop which doesn't return early when it's time to paint. * [rcore][win32] fallback to finding functions from opengl32.dll * [rcore][win32] fixes from review/for gcc * [rcore][win32] incorporate style conventions * [rcore][win32] workaround unused function error SetupFramebuffer * [rcore][win32] re-enable sanitize flags check for MSAA_4X * [rcore][win32] more style changes and remove old DPI cases Added some more missing spaces after conditional statements. Also made unsupported MSAA_4X an assert instead of an abort and also removed dpi-aware cases for older OS's. More changes would be needed to support those OS versions, namely, removing the dependency on shcore. * [rcore][win32] fixes for compling with w64devkit without -DUNICODE * Update build.zig * Update build.zig --------- Co-authored-by: Ray <raysan5@gmail.com>
This commit is contained in:
@@ -342,6 +342,10 @@ ifeq ($(PLATFORM_OS), LINUX)
|
|||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
CFLAGS += -DUNICODE
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
||||||
CFLAGS += -g -D_DEBUG
|
CFLAGS += -g -D_DEBUG
|
||||||
endif
|
endif
|
||||||
@@ -628,6 +632,9 @@ ifeq ($(TARGET_PLATFORM),PLATFORM_DRM)
|
|||||||
LDLIBS += -latomic
|
LDLIBS += -latomic
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_WIN32)
|
||||||
|
LDLIBS = -lgdi32 -lwinmm -lopengl32 -lshcore
|
||||||
|
endif
|
||||||
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
ifeq ($(TARGET_PLATFORM),PLATFORM_ANDROID)
|
||||||
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
|
LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -lc -lm
|
||||||
endif
|
endif
|
||||||
|
2183
src/platforms/rcore_desktop_win32.c
Normal file
2183
src/platforms/rcore_desktop_win32.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -555,6 +555,8 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
|
|||||||
#include "platforms/rcore_desktop_sdl.c"
|
#include "platforms/rcore_desktop_sdl.c"
|
||||||
#elif (defined(PLATFORM_DESKTOP_RGFW) || defined(PLATFORM_WEB_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_DESKTOP_WIN32)
|
||||||
|
#include "platforms/rcore_desktop_win32.c"
|
||||||
#elif defined(PLATFORM_WEB)
|
#elif defined(PLATFORM_WEB)
|
||||||
#include "platforms/rcore_web.c"
|
#include "platforms/rcore_web.c"
|
||||||
#elif defined(PLATFORM_DRM)
|
#elif defined(PLATFORM_DRM)
|
||||||
@@ -625,6 +627,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_DESKTOP_WIN32)
|
||||||
|
TRACELOG(LOG_INFO, "Platform backend: DESKTOP (WIN32)");
|
||||||
#elif defined(PLATFORM_WEB_RGFW)
|
#elif defined(PLATFORM_WEB_RGFW)
|
||||||
TRACELOG(LOG_INFO, "Platform backend: WEB (RGFW) (HTML5)");
|
TRACELOG(LOG_INFO, "Platform backend: WEB (RGFW) (HTML5)");
|
||||||
#elif defined(PLATFORM_WEB)
|
#elif defined(PLATFORM_WEB)
|
||||||
|
Reference in New Issue
Block a user