]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/device.h
Create a Device class to hold the graphics context
[libs/gl.git] / source / core / device.h
diff --git a/source/core/device.h b/source/core/device.h
new file mode 100644 (file)
index 0000000..6a6a760
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef MSP_GL_DEVICE_H_
+#define MSP_GL_DEVICE_H_
+
+#include <msp/graphics/window.h>
+#include "device_backend.h"
+
+namespace Msp {
+namespace GL {
+
+/**
+Represents a graphics device.  An instance must be created to use the library.
+*/
+class Device: public DeviceBackend
+{
+       friend DeviceBackend;
+
+private:
+       static Device *current;
+
+public:
+       Device(Graphics::Window &, const DeviceOptions & = DeviceOptions());
+       ~Device();
+
+       using DeviceBackend::get_context;
+
+       static Device &get_current();
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif