X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fdevice.cpp;fp=source%2Fcore%2Fdevice.cpp;h=9a24a1f2c905ef1dc025f28b45227794305985de;hb=f0414f06fc2463e9765c9492dce60e0468dceb3c;hp=0000000000000000000000000000000000000000;hpb=ac4218f733b4c8f09b64e72164bd4321a4c1abd2;p=libs%2Fgl.git diff --git a/source/core/device.cpp b/source/core/device.cpp new file mode 100644 index 00000000..9a24a1f2 --- /dev/null +++ b/source/core/device.cpp @@ -0,0 +1,29 @@ +#include "device.h" +#include "error.h" + +namespace Msp { +namespace GL { + +Device *Device::current = 0; + +Device::Device(Graphics::Window &w, const DeviceOptions &o): + DeviceBackend(w, o) +{ + current = this; +} + +Device::~Device() +{ + if(this==current) + current = 0; +} + +Device &Device::get_current() +{ + if(!current) + throw invalid_operation("no current device"); + return *current; +} + +} // namespace GL +} // namespace Msp