diff options
author | ancarola <raffaele.ancarola@epfl.ch> | 2019-01-25 23:47:41 +0100 |
---|---|---|
committer | ancarola <raffaele.ancarola@epfl.ch> | 2019-01-25 23:47:41 +0100 |
commit | 351f83b6d331eef1fb5e1cbfa8bed25da8f96a57 (patch) | |
tree | 2a7ac7dc499f5b764caba981002e7a17bc1687d0 /engine | |
parent | Core channel in flatland and signal test (diff) | |
download | flatland-351f83b6d331eef1fb5e1cbfa8bed25da8f96a57.tar.gz flatland-351f83b6d331eef1fb5e1cbfa8bed25da8f96a57.zip |
Template error on compile signal test
Diffstat (limited to 'engine')
-rw-r--r-- | engine/flatland.cpp | 18 | ||||
-rw-r--r-- | engine/include/bound.hpp | 2 | ||||
-rw-r--r-- | engine/include/collector.hpp | 4 | ||||
-rw-r--r-- | engine/include/component.hpp | 4 | ||||
-rw-r--r-- | engine/include/core/signal.hpp | 7 | ||||
-rw-r--r-- | engine/include/flatland.hpp | 2 | ||||
-rw-r--r-- | engine/include/serial/focusable.hpp | 4 | ||||
-rw-r--r-- | engine/include/surface.hpp | 4 | ||||
-rw-r--r-- | engine/include/types.hpp | 5 | ||||
-rw-r--r-- | engine/include/window.hpp | 4 | ||||
-rw-r--r-- | engine/surface.cpp | 4 | ||||
-rw-r--r-- | engine/window.cpp | 2 |
12 files changed, 29 insertions, 31 deletions
diff --git a/engine/flatland.cpp b/engine/flatland.cpp index fdfa6fc..62cdfd1 100644 --- a/engine/flatland.cpp +++ b/engine/flatland.cpp @@ -37,13 +37,13 @@ core::listener::ptr print_listener; /* channels listeners callback */ -void quit_callback(object *sender, signal::package) +void quit_callback(const object *sender, core::signal::package) { cout << "Flatland: quit request attempted" << endl; flat::quit(); } -void print_callback(object *sender, signal::package p) +void print_callback(const object *sender, core::signal::package p) { const char * out = p.get<const char>(); string * sout = p.get<string>(); @@ -88,19 +88,19 @@ uint32_t status_to_flags(const flat_status& s) /* Accessors */ -channel& core_channel() +core::channel& core_channel() { return core_chan; } -job& main_job() +core::job& main_job() { return mainsync_job; } /* Main loop */ -int init_flatland(FlatWindow* w, gameloop loop, const flat_status& s, float _fps) +int init_flatland(FlatWindow* w, const flat_status& s, float _fps) { cout << "Flatland: Initializing flatland" << endl; @@ -108,7 +108,7 @@ int init_flatland(FlatWindow* w, gameloop loop, const flat_status& s, float _fps cout << "Flatland: Initializing core channel" << endl; - core_chan.start(priority_t::max); + core_chan.start(core::priority_t::max); if (!core_chan.map()) { @@ -120,7 +120,7 @@ int init_flatland(FlatWindow* w, gameloop loop, const flat_status& s, float _fps // bind listeners - quit_listener = core_chan.connect(&quit_callback, {"quit"}); + quit_listener = core_chan.connect(quit_callback, initializer_list<string>({string("quit")})); // control if quit was not already connected if (!quit_listener) { @@ -131,7 +131,7 @@ int init_flatland(FlatWindow* w, gameloop loop, const flat_status& s, float _fps return -1; } - print_listener = core_chan.connect(&print_callback, {"print"}); + print_listener = core_chan.connect(print_callback, initializer_list<string>({string("print")})); // control if print was not already connected if (!print_listener) { @@ -194,7 +194,7 @@ int init_flatland(FlatWindow* w, gameloop loop, const flat_status& s, float _fps cerr << "Flatland: a force quit call was thrown" << endl; cerr << "Possible reason: " << f.reason << endl; - quit_flatland(); + quit(); } SDL_Delay((uint32_t) (1000.0f / fps)); diff --git a/engine/include/bound.hpp b/engine/include/bound.hpp index 9b7b755..a924e90 100644 --- a/engine/include/bound.hpp +++ b/engine/include/bound.hpp @@ -8,7 +8,7 @@ namespace flat { typedef SVector<int, 2> pixel; -class FlatBound : virtual public flat::core::object +class FlatBound : virtual public flat::object { pixel location; diff --git a/engine/include/collector.hpp b/engine/include/collector.hpp index bc50f4d..45a3e74 100644 --- a/engine/include/collector.hpp +++ b/engine/include/collector.hpp @@ -1,12 +1,12 @@ #ifndef __FLATCOLLECTOR_H__ #define __FLATCOLLECTOR_H__ -#include "core/object.hpp" +#include "object.hpp" #include <set> namespace flat { -class FlatCollector : virtual public flat::core::object +class FlatCollector : virtual public flat::object { FlatCollector * parent; diff --git a/engine/include/component.hpp b/engine/include/component.hpp index 4ad99c8..fdde28d 100644 --- a/engine/include/component.hpp +++ b/engine/include/component.hpp @@ -1,13 +1,13 @@ #ifndef __FLAT_COMPONENT_H__ #define __FLAT_COMPONENT_H__ -#include "core/object.hpp" +#include "object.hpp" #include "core/labelled.hpp" #include <string> namespace flat { -class component : virtual public core::object, virtual public core::labelled +class component : virtual public object, virtual public core::labelled { component * m_parent; diff --git a/engine/include/core/signal.hpp b/engine/include/core/signal.hpp index 7d91150..a420989 100644 --- a/engine/include/core/signal.hpp +++ b/engine/include/core/signal.hpp @@ -6,6 +6,7 @@ #include <initializer_list> #include "task.hpp" #include "types.hpp" +#include "object.hpp" #include <functional> #include <memory> #include "priority.hpp" @@ -13,7 +14,7 @@ namespace flat { - class object; + //class object; namespace core { @@ -30,7 +31,7 @@ namespace flat template<class T> T * get() { - return dynamic_cast<T>(data); + return reinterpret_cast<T*>(data); } void * data; @@ -123,7 +124,7 @@ namespace flat template<typename R, typename T> inline listener::ptr connect(R T::*mf, T& obj, const std::initializer_list<std::string>& filters = {}) { - return connect(std::bind(mf, obj)); + return connect(std::bind(mf, obj), filters); } static ptr find(const std::string&); diff --git a/engine/include/flatland.hpp b/engine/include/flatland.hpp index c0216d8..0ccf59c 100644 --- a/engine/include/flatland.hpp +++ b/engine/include/flatland.hpp @@ -36,7 +36,7 @@ struct flat_status }; int init_flatland(FlatWindow*, const flat_status&, float fps = 60); -void quit_flatland(); +void quit(); namespace core { diff --git a/engine/include/serial/focusable.hpp b/engine/include/serial/focusable.hpp index f139577..8a05051 100644 --- a/engine/include/serial/focusable.hpp +++ b/engine/include/serial/focusable.hpp @@ -1,14 +1,14 @@ #ifndef __FOCUSABLE_H__ #define __FOCUSABLE_H__ -#include "core/object.hpp" +#include "object.hpp" #include "types.hpp" union SDL_Event; namespace flat { -class Focusable : virtual public flat::core::object +class Focusable : virtual public flat::object { bool focused; diff --git a/engine/include/surface.hpp b/engine/include/surface.hpp index 5364e8e..6e9026a 100644 --- a/engine/include/surface.hpp +++ b/engine/include/surface.hpp @@ -1,13 +1,13 @@ #ifndef __FLATSURFACE_H__ #define __FLATSURFACE_H__ -#include "core/object.hpp" +#include "object.hpp" #include "core/labelled.hpp" #include <SDL2/SDL.h> namespace flat { -class surface : virtual public core::object, virtual public core::labelled +class surface : virtual public object, virtual public core::labelled { SDL_Surface * sdl_surface; SDL_Surface * parent; diff --git a/engine/include/types.hpp b/engine/include/types.hpp index e7a1d3a..31596c9 100644 --- a/engine/include/types.hpp +++ b/engine/include/types.hpp @@ -5,10 +5,7 @@ namespace flat { - namespace core - { - class object; - } + class object; class FlatActor; class FlatSprite; diff --git a/engine/include/window.hpp b/engine/include/window.hpp index 98e8e04..48e8cb0 100644 --- a/engine/include/window.hpp +++ b/engine/include/window.hpp @@ -1,7 +1,7 @@ #ifndef __FLATWINDOW_H__ #define __FLATWINDOW_H__ -#include "core/object.hpp" +#include "object.hpp" #include "serial/keyfocusable.hpp" #include <string> @@ -37,7 +37,7 @@ struct window_status class FlatLayer; -class FlatWindow : virtual public core::object, public KeyFocusable +class FlatWindow : virtual public object, public KeyFocusable { std::string title; window_status status; diff --git a/engine/surface.cpp b/engine/surface.cpp index 31f6388..f4729a5 100644 --- a/engine/surface.cpp +++ b/engine/surface.cpp @@ -34,7 +34,7 @@ surface::surface(const char *filename, uint32_t format, SDL_Surface *parent) surface::surface(SDL_Surface *sdl_surface, SDL_Surface *parent) - : flat::core::object(), parent(parent), hide(false) + : flat::object(), parent(parent), hide(false) { this->sdl_surface = new SDL_Surface(*sdl_surface); @@ -55,7 +55,7 @@ surface::surface(SDL_Surface *sdl_surface, SDL_Surface *parent) surface::surface(const surface &sprite) - : flat::core::object(sprite), parent(sprite.parent), + : flat::object(sprite), parent(sprite.parent), hide(sprite.hide) { offset = new SDL_Rect(*sprite.offset); diff --git a/engine/window.cpp b/engine/window.cpp index 4f22310..20da675 100644 --- a/engine/window.cpp +++ b/engine/window.cpp @@ -46,7 +46,7 @@ FlatWindow::FlatWindow( int width, int height, FlatWindow::FlatWindow(const FlatWindow& win) - : flat::core::object(win), + : flat::object(win), title(win.title), status(win.status), sdl_window(0), screen(0) { |