mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-09 23:06:47 +03:00
fix(gx): simplified gx device creation according to api enum
This commit is contained in:
parent
45f23fb3ba
commit
1b4f1dba86
@ -122,7 +122,7 @@ pub fn build(b: *std.Build) void {
|
||||
|
||||
// GLSDL
|
||||
const build_glsdl_option = b.option(bool, "WHOA_BUILD_GLSDL", "Enable");
|
||||
switch (target.result.os) {
|
||||
switch (t.os.tag) {
|
||||
.windows => {
|
||||
// SDL is off by default
|
||||
build_glsdl = build_glsdl_option orelse false;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "util/SFile.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <new>
|
||||
#include <storm/Error.hpp>
|
||||
@ -14,7 +15,7 @@
|
||||
#include "gx/d3d/CGxDeviceD3d.hpp"
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_LINUX) || defined(WHOA_SYSTEM_WIN)
|
||||
#if defined(WHOA_BUILD_GLSDL)
|
||||
#include "gx/glsdl/CGxDeviceGLSDL.hpp"
|
||||
#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* device;
|
||||
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
if (api == GxApi_OpenGl) {
|
||||
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
|
||||
switch (api) {
|
||||
case GxApi_OpenGl:
|
||||
device = CGxDevice::NewOpenGl();
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
if (api == GxApi_OpenGl) {
|
||||
device = CGxDevice::NewOpenGl();
|
||||
} else if (api == GxApi_GLL) {
|
||||
device = CGxDevice::NewGLL();
|
||||
} else {
|
||||
// Error
|
||||
}
|
||||
#endif
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
case GxApi_D3d9:
|
||||
device = CGxDevice::NewD3d();
|
||||
break;
|
||||
case GxApi_D3d9Ex:
|
||||
device = CGxDevice::NewD3d9Ex();
|
||||
break;
|
||||
case GxApi_D3d10:
|
||||
case GxApi_D3d11:
|
||||
// Error
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_LINUX)
|
||||
if (api == GxApi_GLSDL) {
|
||||
device = CGxDevice::NewGLSDL();
|
||||
} else {
|
||||
// Error
|
||||
}
|
||||
#endif
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
case GxApi_GLL:
|
||||
device = CGxDevice::NewGLL();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_BUILD_GLSDL)
|
||||
case GxApi_GLSDL:
|
||||
device = CGxDevice::NewGLSDL();
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
// Error
|
||||
break;
|
||||
}
|
||||
|
||||
g_theGxDevicePtr = device;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user