mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
fix(gx): simplified gx device creation according to api enum
This commit is contained in:
parent
45f23fb3ba
commit
1b4f1dba86
3 changed files with 34 additions and 31 deletions
|
|
@ -122,7 +122,7 @@ pub fn build(b: *std.Build) void {
|
||||||
|
|
||||||
// GLSDL
|
// GLSDL
|
||||||
const build_glsdl_option = b.option(bool, "WHOA_BUILD_GLSDL", "Enable");
|
const build_glsdl_option = b.option(bool, "WHOA_BUILD_GLSDL", "Enable");
|
||||||
switch (target.result.os) {
|
switch (t.os.tag) {
|
||||||
.windows => {
|
.windows => {
|
||||||
// SDL is off by default
|
// SDL is off by default
|
||||||
build_glsdl = build_glsdl_option orelse false;
|
build_glsdl = build_glsdl_option orelse false;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include "util/SFile.hpp"
|
#include "util/SFile.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdio>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
|
|
@ -14,7 +15,7 @@
|
||||||
#include "gx/d3d/CGxDeviceD3d.hpp"
|
#include "gx/d3d/CGxDeviceD3d.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_LINUX) || defined(WHOA_SYSTEM_WIN)
|
#if defined(WHOA_BUILD_GLSDL)
|
||||||
#include "gx/glsdl/CGxDeviceGLSDL.hpp"
|
#include "gx/glsdl/CGxDeviceGLSDL.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,37 +7,39 @@ CGxDevice* g_theGxDevicePtr = nullptr;
|
||||||
CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat& format) {
|
CGxDevice* GxDevCreate(EGxApi api, int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat& format) {
|
||||||
CGxDevice* device;
|
CGxDevice* device;
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_WIN)
|
switch (api) {
|
||||||
if (api == GxApi_OpenGl) {
|
case GxApi_OpenGl:
|
||||||
device = CGxDevice::NewOpenGl();
|
device = CGxDevice::NewOpenGl();
|
||||||
} else if (api == GxApi_D3d9) {
|
|
||||||
device = CGxDevice::NewD3d();
|
|
||||||
} else if (api == GxApi_D3d9Ex) {
|
|
||||||
device = CGxDevice::NewD3d9Ex();
|
|
||||||
} else if (api == GxApi_GLSDL) {
|
|
||||||
device = CGxDevice::NewGLSDL();
|
|
||||||
} else {
|
|
||||||
// Error
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_MAC)
|
#if defined(WHOA_SYSTEM_WIN)
|
||||||
if (api == GxApi_OpenGl) {
|
case GxApi_D3d9:
|
||||||
device = CGxDevice::NewOpenGl();
|
device = CGxDevice::NewD3d();
|
||||||
} else if (api == GxApi_GLL) {
|
break;
|
||||||
device = CGxDevice::NewGLL();
|
case GxApi_D3d9Ex:
|
||||||
} else {
|
device = CGxDevice::NewD3d9Ex();
|
||||||
// Error
|
break;
|
||||||
}
|
case GxApi_D3d10:
|
||||||
#endif
|
case GxApi_D3d11:
|
||||||
|
// Error
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WHOA_SYSTEM_LINUX)
|
#if defined(WHOA_SYSTEM_MAC)
|
||||||
if (api == GxApi_GLSDL) {
|
case GxApi_GLL:
|
||||||
device = CGxDevice::NewGLSDL();
|
device = CGxDevice::NewGLL();
|
||||||
} else {
|
break;
|
||||||
// Error
|
#endif
|
||||||
}
|
|
||||||
#endif
|
#if defined(WHOA_BUILD_GLSDL)
|
||||||
|
case GxApi_GLSDL:
|
||||||
|
device = CGxDevice::NewGLSDL();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Error
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
g_theGxDevicePtr = device;
|
g_theGxDevicePtr = device;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue