Files
2026-05-12 15:26:02 +10:00

33 lines
817 B
C++

#pragma once
#include <windows.h>
#include <string>
class HiddenGlWindow
{
public:
HiddenGlWindow() = default;
HiddenGlWindow(const HiddenGlWindow&) = delete;
HiddenGlWindow& operator=(const HiddenGlWindow&) = delete;
~HiddenGlWindow();
bool Create(unsigned width, unsigned height, std::string& error);
bool CreateShared(unsigned width, unsigned height, HDC sharedDeviceContext, HGLRC sharedContext, std::string& error);
bool MakeCurrent() const;
void ClearCurrent() const;
void Destroy();
HDC DeviceContext() const { return mDc; }
HGLRC Context() const { return mGlrc; }
private:
static LRESULT CALLBACK WindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
HINSTANCE mInstance = nullptr;
HWND mWindow = nullptr;
HDC mDc = nullptr;
HGLRC mGlrc = nullptr;
ATOM mClassAtom = 0;
};