aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
Diffstat (limited to 'pugl')
-rw-r--r--pugl/pugl.hpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/pugl/pugl.hpp b/pugl/pugl.hpp
index 90036e4..3072560 100644
--- a/pugl/pugl.hpp
+++ b/pugl/pugl.hpp
@@ -274,7 +274,7 @@ private:
class World : public detail::Wrapper<PuglWorld, puglFreeWorld>
{
public:
- explicit World(WorldType type, WorldFlags flags = {})
+ explicit World(WorldType type, WorldFlags flags)
: Wrapper{puglNewWorld(static_cast<PuglWorldType>(type), flags)}
, _clock(*this)
{
@@ -283,6 +283,14 @@ public:
}
}
+ explicit World(WorldType type)
+ : World{type, {}}
+ {
+ if (!cobj()) {
+ throw std::runtime_error("Failed to create pugl::World");
+ }
+ }
+
/// @copydoc puglGetNativeWorld
void* nativeWorld() { return puglGetNativeWorld(cobj()); }
@@ -394,6 +402,12 @@ public:
virtual ~View() = default;
+ View(const View&) = delete;
+ View& operator=(const View&) = delete;
+
+ View(View&&) = delete;
+ View&& operator=(View&&) = delete;
+
const pugl::World& world() const { return _world; }
pugl::World& world() { return _world; }
@@ -580,7 +594,7 @@ private:
template<class Typed, class Base>
static const Typed& typedEventRef(const Base& base)
{
- const Typed& event = static_cast<const Typed&>(base);
+ const auto& event = static_cast<const Typed&>(base);
static_assert(sizeof(event) == sizeof(typename Typed::BaseEvent), "");
static_assert(std::is_standard_layout<Typed>::value, "");
assert(event.type == Typed::type);