]> git.tdb.fi Git - libs/gl.git/blob - source/core/device.cpp
9a24a1f2c905ef1dc025f28b45227794305985de
[libs/gl.git] / source / core / device.cpp
1 #include "device.h"
2 #include "error.h"
3
4 namespace Msp {
5 namespace GL {
6
7 Device *Device::current = 0;
8
9 Device::Device(Graphics::Window &w, const DeviceOptions &o):
10         DeviceBackend(w, o)
11 {
12         current = this;
13 }
14
15 Device::~Device()
16 {
17         if(this==current)
18                 current = 0;
19 }
20
21 Device &Device::get_current()
22 {
23         if(!current)
24                 throw invalid_operation("no current device");
25         return *current;
26 }
27
28 } // namespace GL
29 } // namespace Msp