2015-12-31 15:59:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "thin3d/thin3d.h"
|
|
|
|
|
|
|
|
// Init is done differently on each platform, and done close to the creation, so it's
|
|
|
|
// expected to be implemented by subclasses.
|
|
|
|
class GraphicsContext {
|
|
|
|
public:
|
|
|
|
virtual ~GraphicsContext() {}
|
|
|
|
|
|
|
|
virtual void Shutdown() = 0;
|
|
|
|
virtual void SwapInterval(int interval) = 0;
|
2016-01-01 11:14:09 +00:00
|
|
|
|
2015-12-31 15:59:40 +00:00
|
|
|
virtual void SwapBuffers() = 0;
|
|
|
|
|
|
|
|
// Used during window resize. Must be called from the window thread,
|
|
|
|
// not the rendering thread or CPU thread.
|
|
|
|
virtual void Pause() {}
|
|
|
|
virtual void Resume() {}
|
|
|
|
|
|
|
|
virtual void Resize() = 0;
|
|
|
|
|
2016-01-05 20:18:43 +00:00
|
|
|
// Needs casting to the appropriate type, unfortunately. Should find a better solution..
|
|
|
|
virtual void *GetAPIContext() { return nullptr; }
|
|
|
|
|
2017-02-06 10:20:27 +00:00
|
|
|
virtual Draw::DrawContext *GetDrawContext() = 0;
|
2015-12-31 15:59:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DummyGraphicsContext : public GraphicsContext {
|
|
|
|
public:
|
|
|
|
void Shutdown() override {}
|
|
|
|
void SwapInterval(int interval) override {}
|
|
|
|
void SwapBuffers() override {}
|
|
|
|
void Resize() override {}
|
|
|
|
|
2017-02-06 10:20:27 +00:00
|
|
|
Draw::DrawContext *GetDrawContext() override { return nullptr; }
|
2015-12-31 15:59:40 +00:00
|
|
|
};
|