mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-09 13:37:48 +00:00
General: Make use of override where applicable
Continues the override modernizations, but now targeting boo.
This commit is contained in:
@@ -49,7 +49,7 @@ class ApplicationUWP final : public IApplication {
|
||||
|
||||
Boo3DAppContextUWP m_3dCtx;
|
||||
|
||||
void _deletedWindow(IWindow* window) {}
|
||||
void _deletedWindow(IWindow* window) override {}
|
||||
|
||||
public:
|
||||
ApplicationUWP(IApplicationCallback& callback, SystemStringView uniqueName, SystemStringView friendlyName,
|
||||
@@ -180,10 +180,10 @@ public:
|
||||
Log.report(logvisor::Fatal, fmt("system doesn't support D3D11 or D3D12"));
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const { return EPlatformType::UWP; }
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::UWP; }
|
||||
|
||||
std::thread m_clientThread;
|
||||
int run() {
|
||||
int run() override {
|
||||
/* Spawn client thread */
|
||||
int clientReturn = 0;
|
||||
m_clientThread = std::thread([&]() {
|
||||
@@ -203,15 +203,15 @@ public:
|
||||
m_clientThread.join();
|
||||
}
|
||||
|
||||
SystemStringView getUniqueName() const { return m_uniqueName; }
|
||||
SystemStringView getUniqueName() const override { return m_uniqueName; }
|
||||
|
||||
SystemStringView getFriendlyName() const { return m_friendlyName; }
|
||||
SystemStringView getFriendlyName() const override { return m_friendlyName; }
|
||||
|
||||
SystemStringView getProcessName() const { return m_pname; }
|
||||
SystemStringView getProcessName() const override { return m_pname; }
|
||||
|
||||
const std::vector<SystemString>& getArgs() const { return m_args; }
|
||||
const std::vector<SystemString>& getArgs() const override { return m_args; }
|
||||
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title, uint32_t sampleCount) {
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title, uint32_t sampleCount) override {
|
||||
if (!m_issuedWindow) {
|
||||
m_issuedWindow = true;
|
||||
return m_window;
|
||||
|
||||
@@ -86,7 +86,7 @@ class ApplicationWin32 final : public IApplication {
|
||||
PFN_vkGetInstanceProcAddr m_getVkProc = nullptr;
|
||||
#endif
|
||||
|
||||
void _deletedWindow(IWindow* window) { m_allWindows.erase(HWND(window->getPlatformHandle())); }
|
||||
void _deletedWindow(IWindow* window) override { m_allWindows.erase(HWND(window->getPlatformHandle())); }
|
||||
|
||||
public:
|
||||
ApplicationWin32(IApplicationCallback& callback, SystemStringView uniqueName, SystemStringView friendlyName,
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
Log.report(logvisor::Fatal, fmt("system doesn't support Vulkan, D3D11, or OpenGL"));
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const { return EPlatformType::Win32; }
|
||||
EPlatformType getPlatformType() const override { return EPlatformType::Win32; }
|
||||
|
||||
LRESULT winHwndHandler(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
/* Lookup boo window instance */
|
||||
@@ -358,7 +358,7 @@ public:
|
||||
g_nwcv.notify_one();
|
||||
}
|
||||
|
||||
int run() {
|
||||
int run() override {
|
||||
g_mainThreadId = GetCurrentThreadId();
|
||||
|
||||
/* Spawn client thread */
|
||||
@@ -424,22 +424,22 @@ public:
|
||||
return clientReturn;
|
||||
}
|
||||
|
||||
~ApplicationWin32() {
|
||||
~ApplicationWin32() override {
|
||||
for (auto& p : m_allWindows)
|
||||
if (auto w = p.second.lock())
|
||||
w->_cleanup();
|
||||
}
|
||||
|
||||
SystemStringView getUniqueName() const { return m_uniqueName; }
|
||||
SystemStringView getUniqueName() const override { return m_uniqueName; }
|
||||
|
||||
SystemStringView getFriendlyName() const { return m_friendlyName; }
|
||||
SystemStringView getFriendlyName() const override { return m_friendlyName; }
|
||||
|
||||
SystemStringView getProcessName() const { return m_pname; }
|
||||
SystemStringView getProcessName() const override { return m_pname; }
|
||||
|
||||
const std::vector<SystemString>& getArgs() const { return m_args; }
|
||||
const std::vector<SystemString>& getArgs() const override { return m_args; }
|
||||
|
||||
std::shared_ptr<IWindow> m_mwret;
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title) {
|
||||
std::shared_ptr<IWindow> newWindow(SystemStringView title) override {
|
||||
if (GetCurrentThreadId() != g_mainThreadId) {
|
||||
std::unique_lock<std::mutex> lk(g_nwmt);
|
||||
if (!PostThreadMessageW(g_mainThreadId, WM_USER, WPARAM(&title), 0))
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
~GraphicsContextUWPD3D() {
|
||||
~GraphicsContextUWPD3D() override {
|
||||
#if _WIN32_WINNT_WIN10
|
||||
if (m_3dCtx.m_ctx12.m_dev)
|
||||
m_3dCtx.m_ctx12.m_windows.erase(m_parentWindow);
|
||||
@@ -126,33 +126,33 @@ public:
|
||||
m_3dCtx.m_ctx11.m_windows.erase(m_parentWindow);
|
||||
}
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) { return true; }
|
||||
bool initializeContext(void*) override { return true; }
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue; }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue; }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory; }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory; }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_dataFactory; }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_dataFactory; }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_dataFactory; }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_dataFactory; }
|
||||
};
|
||||
|
||||
static uint32_t translateKeysym(CoreWindow ^ window, VirtualKey sym, ESpecialKey& specialSym,
|
||||
@@ -304,76 +304,78 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
~WindowUWP() {}
|
||||
~WindowUWP() override = default;
|
||||
|
||||
void setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
void closeWindow() { m_coreWindow->Close(); }
|
||||
void closeWindow() override { m_coreWindow->Close(); }
|
||||
|
||||
void showWindow() {}
|
||||
void showWindow() override {}
|
||||
|
||||
void hideWindow() {}
|
||||
void hideWindow() override {}
|
||||
|
||||
SystemString getTitle() { return SystemString(m_appView->Title->Data()); }
|
||||
SystemString getTitle() override { return SystemString(m_appView->Title->Data()); }
|
||||
|
||||
void setTitle(SystemStringView title) { m_appView->Title = ref new Platform::String(title.data()); }
|
||||
void setTitle(SystemStringView title) override { m_appView->Title = ref new Platform::String(title.data()); }
|
||||
|
||||
void setCursor(EMouseCursor cursor) {}
|
||||
void setCursor(EMouseCursor cursor) override {}
|
||||
|
||||
void setWaitCursor(bool wait) {}
|
||||
void setWaitCursor(bool wait) override {}
|
||||
|
||||
double getWindowRefreshRate() const {
|
||||
/* TODO: Actually get refresh rate */
|
||||
return 60.0;
|
||||
}
|
||||
|
||||
void setWindowFrameDefault() {}
|
||||
void setWindowFrameDefault() override {}
|
||||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {
|
||||
xOut = m_bounds.X * m_dispInfoDpiFactor;
|
||||
yOut = m_bounds.Y * m_dispInfoDpiFactor;
|
||||
wOut = m_bounds.Width * m_dispInfoDpiFactor;
|
||||
hOut = m_bounds.Height * m_dispInfoDpiFactor;
|
||||
}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {
|
||||
xOut = m_bounds.X * m_dispInfoDpiFactor;
|
||||
yOut = m_bounds.Y * m_dispInfoDpiFactor;
|
||||
wOut = m_bounds.Width * m_dispInfoDpiFactor;
|
||||
hOut = m_bounds.Height * m_dispInfoDpiFactor;
|
||||
}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h) {}
|
||||
void setWindowFrame(float x, float y, float w, float h) override {}
|
||||
|
||||
void setWindowFrame(int x, int y, int w, int h) {}
|
||||
void setWindowFrame(int x, int y, int w, int h) override {}
|
||||
|
||||
float getVirtualPixelFactor() const { return m_dispInfoDpiFactor; }
|
||||
float getVirtualPixelFactor() const override { return m_dispInfoDpiFactor; }
|
||||
|
||||
bool isFullscreen() const { return ApplicationView::GetForCurrentView()->IsFullScreenMode; }
|
||||
bool isFullscreen() const override { return ApplicationView::GetForCurrentView()->IsFullScreenMode; }
|
||||
|
||||
void setFullscreen(bool fs) {
|
||||
void setFullscreen(bool fs) override {
|
||||
if (fs)
|
||||
ApplicationView::GetForCurrentView()->TryEnterFullScreenMode();
|
||||
else
|
||||
ApplicationView::GetForCurrentView()->ExitFullScreenMode();
|
||||
}
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {}
|
||||
void claimKeyboardFocus(const int coord[2]) override {}
|
||||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) { return false; }
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override { return false; }
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) { return std::unique_ptr<uint8_t[]>(); }
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override {
|
||||
return std::unique_ptr<uint8_t[]>();
|
||||
}
|
||||
|
||||
int waitForRetrace(IAudioVoiceEngine* engine) {
|
||||
int waitForRetrace(IAudioVoiceEngine* engine) override {
|
||||
if (engine)
|
||||
engine->pumpAndMixVoices();
|
||||
m_gfxCtx->m_output->WaitForVBlank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
uintptr_t getPlatformHandle() const { return 0; }
|
||||
uintptr_t getPlatformHandle() const override { return 0; }
|
||||
|
||||
bool _incomingEvent(void* ev) { return false; }
|
||||
bool _incomingEvent(void* ev) override { return false; }
|
||||
|
||||
void OnKeyDown(CoreWindow ^ window, KeyEventArgs ^ keyEventArgs) {
|
||||
ESpecialKey specialKey;
|
||||
@@ -469,23 +471,23 @@ public:
|
||||
m_callback->resized(rect, false);
|
||||
}
|
||||
|
||||
ETouchType getTouchType() const { return ETouchType::None; }
|
||||
ETouchType getTouchType() const override { return ETouchType::None; }
|
||||
|
||||
void setStyle(EWindowStyle style) {}
|
||||
void setStyle(EWindowStyle style) override {}
|
||||
|
||||
EWindowStyle getStyle() const {
|
||||
EWindowStyle getStyle() const override {
|
||||
EWindowStyle retval = EWindowStyle::None;
|
||||
return retval;
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() { return m_gfxCtx->getDataFactory(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx->getDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from main client thread */
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowUWPNew(SystemStringView title, Boo3DAppContextUWP& d3dCtx) {
|
||||
|
||||
@@ -88,35 +88,35 @@ public:
|
||||
Log.report(logvisor::Fatal, fmt("unable to get DXGI output"));
|
||||
}
|
||||
|
||||
~GraphicsContextWin32D3D() { m_3dCtx.m_ctx11.m_windows.erase(m_parentWindow); }
|
||||
~GraphicsContextWin32D3D() override { m_3dCtx.m_ctx11.m_windows.erase(m_parentWindow); }
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) { return true; }
|
||||
bool initializeContext(void*) override { return true; }
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_dataFactory.get(); }
|
||||
};
|
||||
|
||||
struct GraphicsContextWin32GL : GraphicsContextWin32 {
|
||||
@@ -249,23 +249,23 @@ public:
|
||||
m_commandQueue->startRenderer();
|
||||
}
|
||||
|
||||
~GraphicsContextWin32GL() { m_3dCtx.m_ctxOgl.m_windows.erase(m_parentWindow); }
|
||||
~GraphicsContextWin32GL() override { m_3dCtx.m_ctxOgl.m_windows.erase(m_parentWindow); }
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) { return true; }
|
||||
bool initializeContext(void*) override { return true; }
|
||||
|
||||
void makeCurrent() {
|
||||
void makeCurrent() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
// if (!wglMakeCurrent(w.m_deviceContext, w.m_mainContext))
|
||||
// Log.report(logvisor::Fatal, fmt("unable to make WGL context current"));
|
||||
@@ -277,7 +277,7 @@ public:
|
||||
Log.report(logvisor::Fatal, fmt("unable to make WGL context current"));
|
||||
}
|
||||
|
||||
void postInit() {
|
||||
void postInit() override {
|
||||
// OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
|
||||
// wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
|
||||
@@ -293,18 +293,18 @@ public:
|
||||
wglSwapIntervalEXT(1);
|
||||
}
|
||||
|
||||
void present() {
|
||||
void present() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
SwapBuffers(w.m_deviceContext);
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
HGLRC m_mainCtx = 0;
|
||||
IGraphicsDataFactory* getMainContextDataFactory() {
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
if (!m_mainCtx) {
|
||||
m_mainCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
|
||||
@@ -318,7 +318,7 @@ public:
|
||||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
HGLRC m_loadCtx = 0;
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() {
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override {
|
||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||
if (!m_loadCtx) {
|
||||
m_loadCtx = wglCreateContextAttribsARB(w.m_deviceContext, w.m_mainContext, ContextAttribs);
|
||||
@@ -400,7 +400,7 @@ public:
|
||||
m_ctx->m_windows.erase(m_parentWindow);
|
||||
}
|
||||
|
||||
~GraphicsContextWin32Vulkan() { destroy(); }
|
||||
~GraphicsContextWin32Vulkan() override { destroy(); }
|
||||
|
||||
VulkanContext::Window* m_windowCtx = nullptr;
|
||||
|
||||
@@ -409,19 +409,19 @@ public:
|
||||
m_ctx->resizeSwapChain(*m_windowCtx, m_surface, m_format, m_colorspace, rect);
|
||||
}
|
||||
|
||||
void _setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
EGraphicsAPI getAPI() const { return m_api; }
|
||||
EGraphicsAPI getAPI() const override { return m_api; }
|
||||
|
||||
EPixelFormat getPixelFormat() const { return m_pf; }
|
||||
EPixelFormat getPixelFormat() const override { return m_pf; }
|
||||
|
||||
void setPixelFormat(EPixelFormat pf) {
|
||||
void setPixelFormat(EPixelFormat pf) override {
|
||||
if (pf > EPixelFormat::RGBAF32_Z24)
|
||||
return;
|
||||
m_pf = pf;
|
||||
}
|
||||
|
||||
bool initializeContext(void*) {
|
||||
bool initializeContext(void*) override {
|
||||
m_windowCtx = m_ctx->m_windows.emplace(std::make_pair(m_parentWindow, std::make_unique<VulkanContext::Window>()))
|
||||
.first->second.get();
|
||||
m_windowCtx->m_hwnd = m_hwnd;
|
||||
@@ -509,19 +509,19 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void makeCurrent() {}
|
||||
void makeCurrent() override {}
|
||||
|
||||
void postInit() {}
|
||||
void postInit() override {}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_commandQueue.get(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_commandQueue.get(); }
|
||||
|
||||
IGraphicsDataFactory* getDataFactory() { return m_dataFactory.get(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return getDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return getDataFactory(); }
|
||||
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return getDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return getDataFactory(); }
|
||||
|
||||
void present() {}
|
||||
void present() override {}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -874,37 +874,37 @@ public:
|
||||
m_gfxCtx.reset(new GraphicsContextWin32D3D(api, this, m_hwnd, b3dCtx));
|
||||
}
|
||||
|
||||
void _cleanup() { m_gfxCtx.reset(); }
|
||||
void _cleanup() override { m_gfxCtx.reset(); }
|
||||
|
||||
void setCallback(IWindowCallback* cb) { m_callback = cb; }
|
||||
void setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
||||
|
||||
void closeWindow() {
|
||||
void closeWindow() override {
|
||||
// TODO: Perform thread-coalesced deallocation
|
||||
ShowWindow(m_hwnd, SW_HIDE);
|
||||
}
|
||||
|
||||
void showWindow() { ShowWindow(m_hwnd, SW_SHOW); }
|
||||
void showWindow() override { ShowWindow(m_hwnd, SW_SHOW); }
|
||||
|
||||
void hideWindow() { ShowWindow(m_hwnd, SW_HIDE); }
|
||||
void hideWindow() override { ShowWindow(m_hwnd, SW_HIDE); }
|
||||
|
||||
SystemString getTitle() {
|
||||
SystemString getTitle() override {
|
||||
wchar_t title[256];
|
||||
int c = GetWindowTextW(m_hwnd, title, 256);
|
||||
return SystemString(title, c);
|
||||
}
|
||||
|
||||
void setTitle(SystemStringView title) { SetWindowTextW(m_hwnd, title.data()); }
|
||||
void setTitle(SystemStringView title) override { SetWindowTextW(m_hwnd, title.data()); }
|
||||
|
||||
static void _setCursor(HCURSOR cur) { PostThreadMessageW(g_mainThreadId, WM_USER + 2, WPARAM(cur), 0); }
|
||||
|
||||
void setCursor(EMouseCursor cursor) {
|
||||
void setCursor(EMouseCursor cursor) override {
|
||||
if (cursor == m_cursor && !m_cursorWait)
|
||||
return;
|
||||
m_cursor = cursor;
|
||||
_setCursor(GetWin32Cursor(cursor));
|
||||
}
|
||||
|
||||
void setWaitCursor(bool wait) {
|
||||
void setWaitCursor(bool wait) override {
|
||||
if (wait && !m_cursorWait) {
|
||||
_setCursor(WIN32_CURSORS.m_wait);
|
||||
m_cursorWait = true;
|
||||
@@ -914,12 +914,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
double getWindowRefreshRate() const {
|
||||
double getWindowRefreshRate() const override {
|
||||
/* TODO: Actually get refresh rate */
|
||||
return 60.0;
|
||||
}
|
||||
|
||||
void setWindowFrameDefault() {
|
||||
void setWindowFrameDefault() override {
|
||||
MONITORINFO monInfo = {};
|
||||
monInfo.cbSize = sizeof(MONITORINFO);
|
||||
HMONITOR mon = MonitorFromWindow(m_hwnd, MONITOR_DEFAULTTOPRIMARY);
|
||||
@@ -929,7 +929,7 @@ public:
|
||||
setWindowFrame(x, y, w, h);
|
||||
}
|
||||
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const {
|
||||
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {
|
||||
RECT rct;
|
||||
GetClientRect(m_hwnd, &rct);
|
||||
POINT pt;
|
||||
@@ -942,7 +942,7 @@ public:
|
||||
hOut = rct.bottom;
|
||||
}
|
||||
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const {
|
||||
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {
|
||||
RECT rct;
|
||||
GetClientRect(m_hwnd, &rct);
|
||||
POINT pt;
|
||||
@@ -955,15 +955,15 @@ public:
|
||||
hOut = rct.bottom;
|
||||
}
|
||||
|
||||
void setWindowFrame(float x, float y, float w, float h) { setWindowFrame(int(x), int(y), int(w), int(h)); }
|
||||
void setWindowFrame(float x, float y, float w, float h) override { setWindowFrame(int(x), int(y), int(w), int(h)); }
|
||||
|
||||
void setWindowFrame(int x, int y, int w, int h) {
|
||||
void setWindowFrame(int x, int y, int w, int h) override {
|
||||
RECT r = {x, y, x + w, y + h};
|
||||
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
|
||||
MoveWindow(m_hwnd, r.left, r.top, r.right - r.left, r.bottom - r.top, true);
|
||||
}
|
||||
|
||||
float getVirtualPixelFactor() const {
|
||||
float getVirtualPixelFactor() const override {
|
||||
#if _WIN32_WINNT_WINBLUE
|
||||
if (MyGetScaleFactorForMonitor) {
|
||||
DEVICE_SCALE_FACTOR Factor;
|
||||
@@ -977,9 +977,9 @@ public:
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
bool isFullscreen() const { return m_gfxCtx->m_3dCtx.isFullscreen(this); }
|
||||
bool isFullscreen() const override { return m_gfxCtx->m_3dCtx.isFullscreen(this); }
|
||||
|
||||
void setFullscreen(bool fs) { m_gfxCtx->m_3dCtx.setFullscreen(this, fs); }
|
||||
void setFullscreen(bool fs) override { m_gfxCtx->m_3dCtx.setFullscreen(this, fs); }
|
||||
|
||||
void _immSetOpenStatus(bool open) {
|
||||
if (GetCurrentThreadId() != g_mainThreadId) {
|
||||
@@ -1005,7 +1005,7 @@ public:
|
||||
ImmSetCompositionWindow(m_imc, &m_cForm);
|
||||
}
|
||||
|
||||
void claimKeyboardFocus(const int coord[2]) {
|
||||
void claimKeyboardFocus(const int coord[2]) override {
|
||||
if (!coord) {
|
||||
//_immSetOpenStatus(false);
|
||||
return;
|
||||
@@ -1014,7 +1014,7 @@ public:
|
||||
//_immSetOpenStatus(true);
|
||||
}
|
||||
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) {
|
||||
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override {
|
||||
switch (type) {
|
||||
case EClipboardType::String: {
|
||||
HGLOBAL gStr = MakeANSICRLF(reinterpret_cast<const char*>(data), sz);
|
||||
@@ -1038,7 +1038,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) {
|
||||
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override {
|
||||
switch (type) {
|
||||
case EClipboardType::String: {
|
||||
OpenClipboard(m_hwnd);
|
||||
@@ -1068,9 +1068,12 @@ public:
|
||||
return std::unique_ptr<uint8_t[]>();
|
||||
}
|
||||
|
||||
int waitForRetrace() { m_gfxCtx->m_output->WaitForVBlank(); return 1; }
|
||||
int waitForRetrace() override {
|
||||
m_gfxCtx->m_output->WaitForVBlank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
uintptr_t getPlatformHandle() const { return uintptr_t(m_hwnd); }
|
||||
uintptr_t getPlatformHandle() const override { return uintptr_t(m_hwnd); }
|
||||
|
||||
void buttonDown(HWNDEvent& e, EMouseButton button) {
|
||||
if (m_callback) {
|
||||
@@ -1105,7 +1108,7 @@ public:
|
||||
}
|
||||
|
||||
bool mouseTracking = false;
|
||||
bool _incomingEvent(void* ev) {
|
||||
bool _incomingEvent(void* ev) override {
|
||||
HWNDEvent& e = *static_cast<HWNDEvent*>(ev);
|
||||
switch (e.uMsg) {
|
||||
case WM_CLOSE:
|
||||
@@ -1288,9 +1291,9 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
ETouchType getTouchType() const { return ETouchType::None; }
|
||||
ETouchType getTouchType() const override { return ETouchType::None; }
|
||||
|
||||
void setStyle(EWindowStyle style) {
|
||||
void setStyle(EWindowStyle style) override {
|
||||
LONG sty = GetWindowLong(m_hwnd, GWL_STYLE);
|
||||
|
||||
if ((style & EWindowStyle::Titlebar) != EWindowStyle::None)
|
||||
@@ -1311,7 +1314,7 @@ public:
|
||||
SetWindowLong(m_hwnd, GWL_STYLE, sty);
|
||||
}
|
||||
|
||||
EWindowStyle getStyle() const {
|
||||
EWindowStyle getStyle() const override {
|
||||
LONG sty = GetWindowLong(m_hwnd, GWL_STYLE);
|
||||
EWindowStyle retval = EWindowStyle::None;
|
||||
if ((sty & WS_CAPTION) != 0)
|
||||
@@ -1323,14 +1326,14 @@ public:
|
||||
return retval;
|
||||
}
|
||||
|
||||
IGraphicsCommandQueue* getCommandQueue() { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() { return m_gfxCtx->getDataFactory(); }
|
||||
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx->getCommandQueue(); }
|
||||
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx->getDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from main client thread */
|
||||
IGraphicsDataFactory* getMainContextDataFactory() { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx->getMainContextDataFactory(); }
|
||||
|
||||
/* Creates a new context on current thread!! Call from client loading thread */
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx->getLoadContextDataFactory(); }
|
||||
};
|
||||
|
||||
std::shared_ptr<IWindow> _WindowWin32New(SystemStringView title, Boo3DAppContextWin32& d3dCtx) {
|
||||
|
||||
Reference in New Issue
Block a user