add Dreamcast platform to rcore.c

This commit is contained in:
psxdev 2024-02-04 17:18:27 +01:00
parent e1184f4b03
commit 4d90c7beff

View File

@ -19,6 +19,8 @@
* - Linux DRM subsystem (KMS mode)
* > PLATFORM_ANDROID:
* - Android (ARM, ARM64)
* > PLATFORM_DREAMCAST:
* - Sega Dreamcast (SH4)
*
* CONFIGURATION:
* #define SUPPORT_DEFAULT_FONT (default)
@ -499,6 +501,8 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
#include "platforms/rcore_drm.c"
#elif defined(PLATFORM_ANDROID)
#include "platforms/rcore_android.c"
#elif defined(PLATFORM_DREAMCAST)
#include "platforms/rcore_dreamcast.c"
#else
// TODO: Include your custom platform backend!
// i.e software rendering backend or console backend!
@ -567,6 +571,8 @@ void InitWindow(int width, int height, const char *title)
TRACELOG(LOG_INFO, "Platform backend: NATIVE DRM");
#elif defined(PLATFORM_ANDROID)
TRACELOG(LOG_INFO, "Platform backend: ANDROID");
#elif defined(PLATFORM_DREAMCAST)
TRACELOG(LOG_INFO, "Platform backend: DREAMCAST");
#else
// TODO: Include your custom platform backend!
// i.e software rendering backend or console backend!
@ -3066,7 +3072,7 @@ void InitTimer(void)
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)
#endif
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__EMSCRIPTEN__) || defined(PLATFORM_DREAMCAST)
struct timespec now = { 0 };
if (clock_gettime(CLOCK_MONOTONIC, &now) == 0) // Success
@ -3100,8 +3106,11 @@ void SetupViewport(int width, int height)
// Set orthographic projection to current framebuffer size
// NOTE: Configured top-left corner as (0, 0)
#if defined(PLATFORM_DREAMCAST)
rlOrtho(0, CORE.Window.render.width, CORE.Window.render.height, 0, -1.0f, 1.0f);
#else
rlOrtho(0, CORE.Window.render.width, CORE.Window.render.height, 0, 0.0f, 1.0f);
#endif
rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix
rlLoadIdentity(); // Reset current matrix (modelview)
}