Files
fs2open.github.com/fred2/MFCGraphicsOperations.h
asarium ad1ede7b74 Add new options system
This is a system for storing arbitrary data in the config file and then
easily retrieving it later on. This has full Lua support for exposing
the available options in a custom UI and changing the values of the
options. This ported some of the existing command line options over to
the new system which is opt-in for the moment by using a mod_table flag.
2019-03-02 14:02:21 +01:00

73 lines
1.6 KiB
C++

#ifndef _MVC_GRAPHICS_OPERATIONS
#define _MVC_GRAPHICS_OPERATIONS
#pragma once
#include "globalincs/pstypes.h"
#include "osapi/osapi.h"
#include <glad/glad_wgl.h>
class MFCViewport : public os::Viewport
{
HWND _windowHandle = nullptr;
HDC _device_context = nullptr;
public:
explicit MFCViewport(HWND hwnd, HDC dc);
~MFCViewport() override;
SDL_Window* toSDLWindow() override;
std::pair<uint32_t, uint32_t> getSize() override;
void swapBuffers() override;
void setState(os::ViewportState state) override;
void minimize() override;
void restore() override;
HDC getHDC();
};
class MFCOpenGLContext : public os::OpenGLContext
{
// HACK: Since OpenGL apparently likes global state we also have to make this global...
static void* _oglDllHandle;
static size_t _oglDllReferenceCount;
HGLRC _render_context = nullptr;
public:
explicit MFCOpenGLContext(HGLRC hglrc);
~MFCOpenGLContext() override;
static void* wglLoader(const char* name);
os::OpenGLLoadProc getLoaderFunction() override;
bool setSwapInterval(int status) override;
HGLRC getHandle();
};
class MFCGraphicsOperations : public os::GraphicsOperations
{
HWND _windowHandle = nullptr;
public:
explicit MFCGraphicsOperations(HWND hwnd);
~MFCGraphicsOperations() override;
std::unique_ptr<os::Viewport> createViewport(const os::ViewPortProperties& props) override;
std::unique_ptr<os::OpenGLContext> createOpenGLContext(os::Viewport* port, const os::OpenGLContextAttributes& ctx) override;
void makeOpenGLContextCurrent(os::Viewport* view, os::OpenGLContext* ctx) override;
};
#endif // _MVC_GRAPHICS_OPERATIONS