chore: initial commit

This commit is contained in:
fallenoak 2023-01-02 13:17:18 -06:00
commit 70b00c5c38
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
965 changed files with 264882 additions and 0 deletions

51
src/gx/Device.cpp Normal file
View 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);
}