From 9308d290e2794ec93965aacba028907acaa51bb9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 13 Sep 2012 20:13:50 -0300 Subject: [PATCH] Add System::createEventLoop() (not yet functional) --- src/she/event_loop.h | 20 ++++++++++++++++++++ src/she/she.h | 1 + src/she/she_alleg4.cpp | 14 ++++++++++++++ src/she/system.h | 2 ++ 4 files changed, 37 insertions(+) create mode 100644 src/she/event_loop.h diff --git a/src/she/event_loop.h b/src/she/event_loop.h new file mode 100644 index 000000000..778e8c619 --- /dev/null +++ b/src/she/event_loop.h @@ -0,0 +1,20 @@ +// SHE library +// Copyright (C) 2012 David Capello +// +// This source file is ditributed under a BSD-like license, please +// read LICENSE.txt for more information. + +#ifndef SHE_EVENT_LOOP_H_INCLUDED +#define SHE_EVENT_LOOP_H_INCLUDED + +namespace she { + + class EventLoop { + public: + virtual ~EventLoop() { } + virtual void dispose() = 0; + }; + +} // namespace she + +#endif diff --git a/src/she/she.h b/src/she/she.h index a8cb6eada..b63f4c5f3 100644 --- a/src/she/she.h +++ b/src/she/she.h @@ -8,6 +8,7 @@ #define SHE_H_INCLUDED #include "she/display.h" +#include "she/event_loop.h" #include "she/locked_surface.h" #include "she/scoped_handle.h" #include "she/scoped_surface_lock.h" diff --git a/src/she/she_alleg4.cpp b/src/she/she_alleg4.cpp index 787eb2c26..6ff700b6b 100644 --- a/src/she/she_alleg4.cpp +++ b/src/she/she_alleg4.cpp @@ -258,6 +258,16 @@ private: int m_scale; }; +class Alleg4EventLoop : public EventLoop { +public: + Alleg4EventLoop() { + } + + void dispose() { + delete this; + } +}; + class Alleg4System : public System { public: Alleg4System() { @@ -295,6 +305,10 @@ public: Alleg4Surface::AutoDestroy); } + EventLoop* createEventLoop() { + return new Alleg4EventLoop(); + } + }; static System* g_instance; diff --git a/src/she/system.h b/src/she/system.h index 2edf47208..c2a9f183f 100644 --- a/src/she/system.h +++ b/src/she/system.h @@ -14,6 +14,7 @@ namespace she { class Surface; class Display; + class EventLoop; class DisplayCreationException : std::runtime_error { public: @@ -29,6 +30,7 @@ namespace she { virtual Display* createDisplay(int width, int height, int scale) = 0; virtual Surface* createSurface(int width, int height) = 0; virtual Surface* createSurfaceFromNativeHandle(void* nativeHandle) = 0; + virtual EventLoop* createEventLoop() = 0; }; System* CreateSystem();