mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
chore: initial commit
This commit is contained in:
commit
70b00c5c38
965 changed files with 264882 additions and 0 deletions
51
src/gx/Device.cpp
Normal file
51
src/gx/Device.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include "gx/Device.hpp"
|
||||
#include "gx/CGxDevice.hpp"
|
||||
#include "gx/Gx.hpp"
|
||||
|
||||
CGxDevice* g_theGxDevicePtr = nullptr;
|
||||
|
||||
CGxDevice* GxDevCreate(EGxApi api, long (*windowProc)(void*, uint32_t, uint32_t, long), 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 {
|
||||
// Error
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
if (api == GxApi_OpenGl) {
|
||||
device = CGxDevice::NewOpenGl();
|
||||
} else if (api == GxApi_GLL) {
|
||||
device = CGxDevice::NewGLL();
|
||||
} else {
|
||||
// Error
|
||||
}
|
||||
#endif
|
||||
|
||||
g_theGxDevicePtr = device;
|
||||
|
||||
if (g_theGxDevicePtr->DeviceCreate(windowProc, format)) {
|
||||
return g_theGxDevicePtr;
|
||||
} else {
|
||||
if (g_theGxDevicePtr) {
|
||||
delete g_theGxDevicePtr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
EGxApi GxDevApi() {
|
||||
return g_theGxDevicePtr->m_api;
|
||||
}
|
||||
|
||||
int32_t GxMasterEnable(EGxMasterEnables state) {
|
||||
return g_theGxDevicePtr->MasterEnable(state);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue