summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2019-02-01 21:53:20 +0100
committerNao Pross <naopross@thearcway.org>2019-02-01 21:53:20 +0100
commit0bb7c29764686a9c783b01522c051d165db2fdbc (patch)
treec51bcb6e3fd7870bef3aaee190fef2fb2f33ee74
parentRewrite signal.hpp and signal.cpp to NOT use std::sequence(s) (diff)
parentMerge remote-tracking branch 'raffa-https/master' (diff)
downloadflatland-0bb7c29764686a9c783b01522c051d165db2fdbc.tar.gz
flatland-0bb7c29764686a9c783b01522c051d165db2fdbc.zip
Merge branch 'master' into signal-exp
To remove a billion warnings
-rwxr-xr-xconfigure.py2
-rw-r--r--engine/actor.cpp6
-rw-r--r--engine/collector.cpp38
-rw-r--r--engine/component.cpp7
-rw-r--r--engine/exception.cpp4
-rw-r--r--engine/flatland.cpp2
-rw-r--r--engine/focusable.cpp6
-rw-r--r--engine/include/actor.hpp2
-rw-r--r--engine/include/collector.hpp8
-rw-r--r--engine/include/component.hpp2
-rw-r--r--engine/include/exception.hpp3
-rw-r--r--engine/include/exceptions/forcequit.hpp4
-rw-r--r--engine/include/flatland.hpp50
-rw-r--r--engine/include/serial/focusable.hpp3
-rw-r--r--engine/include/surface.hpp10
-rw-r--r--engine/include/window.hpp51
-rw-r--r--engine/labelled.cpp4
-rw-r--r--engine/surface.cpp114
-rw-r--r--engine/window.cpp105
-rw-r--r--test/signal_test.cpp12
20 files changed, 213 insertions, 220 deletions
diff --git a/configure.py b/configure.py
index 14c45cd..f0d34f5 100755
--- a/configure.py
+++ b/configure.py
@@ -112,5 +112,5 @@ with open("build.ninja", "w") as bf:
print("default build/test/signal_test", file=bf)
# run ctags for vim :)
-os.system("if type ctags; then ctags -R . ; fi")
+os.system("if type ctags; then ctags -R --extra=f . ; fi")
diff --git a/engine/actor.cpp b/engine/actor.cpp
index 8eb27da..4991f91 100644
--- a/engine/actor.cpp
+++ b/engine/actor.cpp
@@ -6,7 +6,7 @@ using namespace flat;
FlatActor::FlatActor(FlatCollector *parent, FlatBound *bounds)
- : FlatCollector(parent), bounds(bounds)
+ : FlatCollector(parent), m_bounds(bounds)
{
}
@@ -17,11 +17,11 @@ FlatActor::~FlatActor()
void FlatActor::setBounds(FlatBound * bounds)
{
- this->bounds = bounds;
+ m_bounds = m_bounds;
}
FlatBound * FlatActor::getBounds() const
{
- return bounds;
+ return m_bounds;
}
diff --git a/engine/collector.cpp b/engine/collector.cpp
index 3fc2a0e..be95b72 100644
--- a/engine/collector.cpp
+++ b/engine/collector.cpp
@@ -5,19 +5,19 @@ using namespace flat;
FlatCollector::FlatCollector(FlatCollector *parent)
- : parent(parent), released(!parent)
+ : m_parent(parent), m_released(!parent)
{
}
FlatCollector::~FlatCollector()
{
- if (parent != 0)
- parent->detach(this);
+ if (m_parent != 0)
+ m_parent->detach(this);
- parent = 0;
+ m_parent = 0;
- for (FlatCollector * child : children)
+ for (FlatCollector * child : m_children)
{
if (!child->isReleased())
delete child;
@@ -26,12 +26,12 @@ FlatCollector::~FlatCollector()
bool FlatCollector::isReleased() const
{
- return released;
+ return m_released;
}
void FlatCollector::release()
{
- released = true;
+ m_released = true;
}
void FlatCollector::attach(FlatCollector *obj)
@@ -39,55 +39,55 @@ void FlatCollector::attach(FlatCollector *obj)
if (obj == 0)
return;
- children.insert(obj);
+ m_children.insert(obj);
obj->setParent(this);
}
void FlatCollector::detach(FlatCollector *obj)
{
- children.erase(obj);
+ m_children.erase(obj);
obj->releaseParent();
}
void FlatCollector::setParent(FlatCollector *obj)
{
- parent = obj;
- released = false;
+ m_parent = obj;
+ m_released = false;
}
void FlatCollector::releaseParent()
{
- parent = 0;
- released = true;
+ m_parent = 0;
+ m_released = true;
}
FlatCollector * FlatCollector::getParent()
{
- return parent;
+ return m_parent;
}
bool FlatCollector::isParentOf(FlatCollector* obj) const
{
- return this == obj->parent;
+ return this == obj->m_parent;
}
set<FlatCollector*>::iterator FlatCollector::begin()
{
- return children.begin();
+ return m_children.begin();
}
set<FlatCollector*>::iterator FlatCollector::end()
{
- return children.end();
+ return m_children.end();
}
set<FlatCollector*>::const_iterator FlatCollector::begin() const
{
- return children.begin();
+ return m_children.begin();
}
set<FlatCollector*>::const_iterator FlatCollector::end() const
{
- return children.end();
+ return m_children.end();
}
diff --git a/engine/component.cpp b/engine/component.cpp
index a3eccae..5c1db80 100644
--- a/engine/component.cpp
+++ b/engine/component.cpp
@@ -8,8 +8,7 @@ component::component(component *parent, const std::string& id)
{
// TODO, check flatland initialization
- if (parent == 0)
- {
+ if (parent == nullptr) {
// TODO set screen as parent layer
}
}
@@ -21,11 +20,11 @@ component::~component()
void component::set_parent(component *parent)
{
- if (parent == 0) {
+ if (parent == nullptr) {
// TODO set screen as parent layer
}
- this->m_parent = m_parent;
+ m_parent = parent;
}
component * component::parent()
diff --git a/engine/exception.cpp b/engine/exception.cpp
index d4f1a74..f3bed3d 100644
--- a/engine/exception.cpp
+++ b/engine/exception.cpp
@@ -3,7 +3,7 @@
using namespace flat;
-FlatException::FlatException(const char* error) : error(error) {}
+FlatException::FlatException(const char* error) : m_error(error) {}
FlatException::~FlatException() {}
@@ -11,7 +11,7 @@ char buffer[256];
const char* FlatException::what() const throw()
{
- sprintf(buffer, "%s thrown: %s", specific(), error);
+ sprintf(buffer, "%s thrown: %s", specific(), m_error);
return &buffer[0];
}
diff --git a/engine/flatland.cpp b/engine/flatland.cpp
index 95af534..7b42603 100644
--- a/engine/flatland.cpp
+++ b/engine/flatland.cpp
@@ -192,7 +192,7 @@ int flat::init_flatland(FlatWindow* w, const flat_status& s, float _fps)
} catch (const ForceQuit& f) {
cerr << "Flatland: a force quit call was thrown" << endl;
- cerr << "Possible reason: " << f.reason << endl;
+ cerr << "Possible reason: " << f.m_reason << endl;
quit();
}
diff --git a/engine/focusable.cpp b/engine/focusable.cpp
index cdf8b1f..1f82a2b 100644
--- a/engine/focusable.cpp
+++ b/engine/focusable.cpp
@@ -4,7 +4,7 @@
using namespace flat;
-Focusable::Focusable(bool focused) : focused(focused)
+Focusable::Focusable(bool focused) : m_focused(focused)
{
// event_trigger = new flat::core::task<Focusable>(this, &Focusable::serial_precall, 0);
}
@@ -16,12 +16,12 @@ Focusable::~Focusable()
void Focusable::setFocused(bool flag)
{
- focused = flag;
+ m_focused = flag;
}
bool Focusable::isFocused() const
{
- return focused;
+ return m_focused;
}
void Focusable::serial_precall(void*)
diff --git a/engine/include/actor.hpp b/engine/include/actor.hpp
index 75a3474..1902704 100644
--- a/engine/include/actor.hpp
+++ b/engine/include/actor.hpp
@@ -13,7 +13,7 @@ class FlatActor : public FlatCollector
// TODO, serial binding
/* Bounds */
- FlatBound * bounds;
+ FlatBound * m_bounds;
public:
diff --git a/engine/include/collector.hpp b/engine/include/collector.hpp
index 45a3e74..448dba9 100644
--- a/engine/include/collector.hpp
+++ b/engine/include/collector.hpp
@@ -8,11 +8,11 @@ namespace flat {
class FlatCollector : virtual public flat::object
{
- FlatCollector * parent;
+private:
+ FlatCollector * m_parent;
+ bool m_released;
- bool released;
-
- std::set<FlatCollector*> children;
+ std::set<FlatCollector*> m_children;
public:
diff --git a/engine/include/component.hpp b/engine/include/component.hpp
index fdde28d..76b7d6c 100644
--- a/engine/include/component.hpp
+++ b/engine/include/component.hpp
@@ -9,7 +9,7 @@ namespace flat {
class component : virtual public object, virtual public core::labelled
{
-
+private:
component * m_parent;
public:
diff --git a/engine/include/exception.hpp b/engine/include/exception.hpp
index 6f578e8..5648df8 100644
--- a/engine/include/exception.hpp
+++ b/engine/include/exception.hpp
@@ -7,7 +7,8 @@ namespace flat {
class FlatException : public std::exception
{
- const char * error;
+private:
+ const char * m_error;
protected:
diff --git a/engine/include/exceptions/forcequit.hpp b/engine/include/exceptions/forcequit.hpp
index 451190e..336b9c0 100644
--- a/engine/include/exceptions/forcequit.hpp
+++ b/engine/include/exceptions/forcequit.hpp
@@ -3,9 +3,9 @@
namespace flat {
struct ForceQuit {
- const char * reason;
+ const char * m_reason;
- ForceQuit(const char *reason) : reason(reason) {}
+ ForceQuit(const char *reason) : m_reason(reason) {}
};
}
diff --git a/engine/include/flatland.hpp b/engine/include/flatland.hpp
index f12dc65..592a629 100644
--- a/engine/include/flatland.hpp
+++ b/engine/include/flatland.hpp
@@ -8,31 +8,31 @@ class FlatWindow;
struct flat_status
{
- flat_status(unsigned char video = 1,
- unsigned char audio = 1,
- unsigned char timer = 1,
- unsigned char events = 1,
- unsigned char joystick = 0,
- unsigned char controller = 0,
- unsigned char haptic = 0,
- unsigned char error = 0,
- unsigned char running = 0,
- unsigned char loop = 0)
-
- : video(video), audio(audio), timer(timer), events(events),
- joystick(joystick), controller(controller), haptic(haptic),
- error(error), running(running), loop(loop) {}
-
- unsigned char video:1;
- unsigned char audio:1;
- unsigned char timer:1;
- unsigned char events:1;
- unsigned char joystick:1;
- unsigned char controller:1;
- unsigned char haptic:1;
- unsigned char error:1;
- unsigned char running:1;
- unsigned char loop:1;
+ flat_status(unsigned char _video = 1,
+ unsigned char _audio = 1,
+ unsigned char _timer = 1,
+ unsigned char _events = 1,
+ unsigned char _joystick = 0,
+ unsigned char _controller = 0,
+ unsigned char _haptic = 0,
+ unsigned char _error = 0,
+ unsigned char _running = 0,
+ unsigned char _loop = 0)
+
+ : video(_video), audio(_audio), timer(_timer), events(_events),
+ joystick(_joystick), controller(_controller), haptic(_haptic),
+ error(_error), running(_running), loop(_loop) {}
+
+ unsigned char video;
+ unsigned char audio;
+ unsigned char timer;
+ unsigned char events;
+ unsigned char joystick;
+ unsigned char controller;
+ unsigned char haptic;
+ unsigned char error;
+ unsigned char running;
+ unsigned char loop;
};
int init_flatland(FlatWindow*, const flat_status&, float fps = 60);
diff --git a/engine/include/serial/focusable.hpp b/engine/include/serial/focusable.hpp
index 8a05051..e5f5d5b 100644
--- a/engine/include/serial/focusable.hpp
+++ b/engine/include/serial/focusable.hpp
@@ -10,7 +10,8 @@ namespace flat {
class Focusable : virtual public flat::object
{
- bool focused;
+private:
+ bool m_focused;
protected:
diff --git a/engine/include/surface.hpp b/engine/include/surface.hpp
index 6e9026a..0c1ac78 100644
--- a/engine/include/surface.hpp
+++ b/engine/include/surface.hpp
@@ -9,13 +9,13 @@ namespace flat {
class surface : virtual public object, virtual public core::labelled
{
- SDL_Surface * sdl_surface;
- SDL_Surface * parent;
+ SDL_Surface * m_sdl_surface;
+ SDL_Surface * m_parent;
- SDL_Rect * offset;
- SDL_Rect * viewport;
+ SDL_Rect * m_offset;
+ SDL_Rect * m_viewport;
- bool hide;
+ bool m_hide;
public:
diff --git a/engine/include/window.hpp b/engine/include/window.hpp
index 48e8cb0..ddc9472 100644
--- a/engine/include/window.hpp
+++ b/engine/include/window.hpp
@@ -13,25 +13,25 @@ namespace flat {
struct window_status
{
- window_status( unsigned char fullscreen = 0,
- unsigned char hidden = 0,
- unsigned char borderless = 0,
- unsigned char resizable = 1,
- unsigned char minimized = 0,
- unsigned char maximized = 0,
- unsigned char focus = 1)
-
- : fullscreen(fullscreen), hidden(hidden), borderless(borderless),
- resizable(resizable), minimized(minimized), maximized(maximized),
- focus(focus) {}
-
- unsigned char fullscreen:1;
- unsigned char hidden:1;
- unsigned char borderless:1;
- unsigned char resizable:1;
- unsigned char minimized:1;
- unsigned char maximized:1;
- unsigned char focus:1;
+ window_status( unsigned char _fullscreen = 0,
+ unsigned char _hidden = 0,
+ unsigned char _borderless = 0,
+ unsigned char _resizable = 1,
+ unsigned char _minimized = 0,
+ unsigned char _maximized = 0,
+ unsigned char _focus = 1)
+
+ : fullscreen(_fullscreen), hidden(_hidden), borderless(_borderless),
+ resizable(_resizable), minimized(_minimized), maximized(_maximized),
+ focus(_focus) {}
+
+ unsigned char fullscreen;
+ unsigned char hidden;
+ unsigned char borderless;
+ unsigned char resizable;
+ unsigned char minimized;
+ unsigned char maximized;
+ unsigned char focus;
};
@@ -39,14 +39,15 @@ class FlatLayer;
class FlatWindow : virtual public object, public KeyFocusable
{
- std::string title;
- window_status status;
+private:
+ std::string m_title;
+ window_status m_status;
- SDL_Rect * bounds;
- SDL_Window * sdl_window;
- SDL_Surface * screen;
+ SDL_Rect * m_bounds;
+ SDL_Window * m_sdl_window;
+ SDL_Surface * m_screen;
- FlatLayer * main_layer;
+ FlatLayer * m_main_layer;
void key_cb(const SDL_KeyboardEvent*) override;
diff --git a/engine/labelled.cpp b/engine/labelled.cpp
index 48e6091..e39686c 100644
--- a/engine/labelled.cpp
+++ b/engine/labelled.cpp
@@ -5,8 +5,8 @@
using namespace std;
using namespace flat::core;
-labelled::labelled(const std::string& label, bool allow_null)
- : label((!allow_null && label.empty()) ? random_label() : label) {}
+labelled::labelled(const std::string& _label, bool allow_null)
+ : label((!allow_null && _label.empty()) ? random_label() : _label) {}
string labelled::random_label(uint8_t length) {
diff --git a/engine/surface.cpp b/engine/surface.cpp
index 3ea38d4..6145690 100644
--- a/engine/surface.cpp
+++ b/engine/surface.cpp
@@ -2,149 +2,145 @@
#include <iostream>
-using namespace std;
using namespace flat;
surface::surface(const char *filename, uint32_t format, SDL_Surface *parent)
- : core::labelled(filename, true), parent(parent), hide(false)
+ : core::labelled(filename, true), m_parent(parent), m_hide(false)
{
- cout << "surface: loading " << filename << endl;
- sdl_surface = loadOptimizedSurface(filename, format);
+ std::cout << "surface: loading " << filename << std::endl;
+ m_sdl_surface = loadOptimizedSurface(filename, format);
- if (!sdl_surface)
+ if (!m_sdl_surface)
{
- cout << "Warning: could not load surface " << filename << endl;
+ std::cout << "Warning: could not load surface " << filename << std::endl;
}
- offset = new SDL_Rect;
+ m_offset = new SDL_Rect;
- offset->x = 0;
- offset->y = 0;
- offset->w = sdl_surface->w;
- offset->h = sdl_surface->h;
+ m_offset->x = 0;
+ m_offset->y = 0;
+ m_offset->w = m_sdl_surface->w;
+ m_offset->h = m_sdl_surface->h;
- viewport = new SDL_Rect;
+ m_viewport = new SDL_Rect;
- viewport->x = 0;
- viewport->y = 0;
- viewport->w = sdl_surface->w;
- viewport->h = sdl_surface->h;
+ m_viewport->x = 0;
+ m_viewport->y = 0;
+ m_viewport->w = m_sdl_surface->w;
+ m_viewport->h = m_sdl_surface->h;
}
surface::surface(SDL_Surface *sdl_surface, SDL_Surface *parent)
- : flat::object(), parent(parent), hide(false)
+ : flat::object(), m_parent(parent), m_hide(false)
{
- this->sdl_surface = new SDL_Surface(*sdl_surface);
+ m_sdl_surface = new SDL_Surface(*sdl_surface);
- offset = new SDL_Rect;
+ m_offset = new SDL_Rect;
- offset->x = 0;
- offset->y = 0;
- offset->w = sdl_surface->w;
- offset->h = sdl_surface->h;
+ m_offset->x = 0;
+ m_offset->y = 0;
+ m_offset->w = sdl_surface->w;
+ m_offset->h = sdl_surface->h;
- viewport = new SDL_Rect;
+ m_viewport = new SDL_Rect;
- viewport->x = 0;
- viewport->y = 0;
- viewport->w = sdl_surface->w;
- viewport->h = sdl_surface->h;
+ m_viewport->x = 0;
+ m_viewport->y = 0;
+ m_viewport->w = sdl_surface->w;
+ m_viewport->h = sdl_surface->h;
}
-surface::surface(const surface &sprite)
- : flat::object(sprite), parent(sprite.parent), hide(sprite.hide)
+surface::surface(const surface& sprite)
+ : flat::object(sprite), m_parent(sprite.m_parent), m_hide(sprite.m_hide)
{
- offset = new SDL_Rect(*sprite.offset);
-
- viewport = new SDL_Rect(*sprite.viewport);
-
- sdl_surface = copySurface(sprite.sdl_surface);
+ m_offset = new SDL_Rect(*sprite.m_offset);
+ m_viewport = new SDL_Rect(*sprite.m_viewport);
+ m_sdl_surface = copySurface(sprite.m_sdl_surface);
}
surface::~surface()
{
- SDL_FreeSurface(sdl_surface);
+ SDL_FreeSurface(m_sdl_surface);
- delete offset;
- delete viewport;
+ delete m_offset;
+ delete m_viewport;
}
void surface::setOffset(int x, int y, int w, int h)
{
- offset->x = x;
- offset->y = y;
+ m_offset->x = x;
+ m_offset->y = y;
if (w > 0)
- offset->w = w;
+ m_offset->w = w;
if (h > 0)
- offset->h = h;
+ m_offset->h = h;
}
void surface::setViewport(int x, int y, int w, int h)
{
- viewport->x = x;
- viewport->y = y;
- viewport->w = w;
- viewport->h = h;
+ m_viewport->x = x;
+ m_viewport->y = y;
+ m_viewport->w = w;
+ m_viewport->h = h;
}
void surface::setViewport(const SDL_Rect &rect)
{
- *viewport = rect;
+ *m_viewport = rect;
}
void surface::setOffset(const SDL_Rect &offset)
{
- *this->offset = offset;
+ *m_offset = offset;
}
const SDL_Rect * surface::getOffset() const
{
- return offset;
+ return m_offset;
}
const SDL_Rect * surface::getViewport() const
{
- return viewport;
+ return m_viewport;
}
void surface::setParent(SDL_Surface *parent)
{
- this->parent = parent;
+ m_parent = parent;
}
SDL_Surface * surface::getParent()
{
- return parent;
+ return m_parent;
}
SDL_Surface * surface::getSurface()
{
- return sdl_surface;
+ return m_sdl_surface;
}
void surface::setHidden(bool flag)
{
- hide = flag;
+ m_hide = flag;
}
bool surface::isHidden() const
{
- return hide;
+ return m_hide;
}
void surface::blit()
{
- if (!hide)
- SDL_BlitSurface(sdl_surface, viewport, parent, offset);
+ if (!m_hide)
+ SDL_BlitSurface(m_sdl_surface, m_viewport, m_parent, m_offset);
}
SDL_Surface * surface::loadOptimizedSurface(const char *filename, uint32_t format)
{
- SDL_Surface * optimized = 0;
-
+ SDL_Surface * optimized = nullptr;
SDL_Surface * loaded = SDL_LoadBMP(filename);
if (loaded)
diff --git a/engine/window.cpp b/engine/window.cpp
index 20da675..d5425be 100644
--- a/engine/window.cpp
+++ b/engine/window.cpp
@@ -5,89 +5,86 @@
#include "layer.hpp"
#include "core/signal.hpp"
-using namespace std;
using namespace flat;
FlatWindow::FlatWindow( int x, int y,
int width, int height,
- const string& title,
+ const std::string& title,
window_status status)
- : title(title), status(status),
- sdl_window(0), screen(0)
+ : m_title(title), m_status(status),
+ m_sdl_window(nullptr), m_screen(nullptr)
{
- bounds = new SDL_Rect;
-
- bounds->x = x;
- bounds->y = y;
- bounds->w = width;
- bounds->h = height;
+ m_bounds = new SDL_Rect;
+
+ m_bounds->x = x;
+ m_bounds->y = y;
+ m_bounds->w = width;
+ m_bounds->h = height;
- main_layer = new FlatLayer(0);
+ m_main_layer = new FlatLayer(nullptr);
}
FlatWindow::FlatWindow( SDL_Rect *bounds,
- const string& title,
+ const std::string& title,
window_status status)
: FlatWindow(bounds->x, bounds->y, bounds->w, bounds->h, title, status)
-{
-}
+{}
FlatWindow::FlatWindow( int width, int height,
- const string &title,
+ const std::string &title,
window_status status)
- : FlatWindow( SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
+ : FlatWindow(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
width, height,
title, status)
{
}
FlatWindow::FlatWindow(const FlatWindow& win)
-
- : flat::object(win),
- title(win.title), status(win.status),
- sdl_window(0), screen(0)
+ : flat::object(win), Focusable(false),
+ m_title(win.m_title), m_status(win.m_status),
+ m_sdl_window(nullptr), m_screen(nullptr)
{
- bounds = new SDL_Rect;
+ m_bounds = new SDL_Rect;
- *bounds = *win.bounds;
+ *m_bounds = *win.m_bounds;
- main_layer = new FlatLayer(0);
+ m_main_layer = new FlatLayer(nullptr);
}
FlatWindow::~FlatWindow()
{
close();
- delete bounds;
- delete main_layer;
+ delete m_bounds;
+ delete m_main_layer;
}
int FlatWindow::open()
{
- uint32_t win_flags = winstatus_to_flags(status);
+ uint32_t win_flags = winstatus_to_flags(m_status);
- sdl_window = SDL_CreateWindow( title.c_str(),
- bounds->x,
- bounds->y,
- bounds->w,
- bounds->h,
- win_flags);
-
- if (sdl_window == 0)
+ m_sdl_window = SDL_CreateWindow(m_title.c_str(),
+ m_bounds->x,
+ m_bounds->y,
+ m_bounds->w,
+ m_bounds->h,
+ win_flags);
+
+ if (m_sdl_window == nullptr)
{
- cout << "Error: failed to initialize window" << endl;
+ std::cout << "Error: failed to initialize window" << std::endl;
// throw exception
return -1;
}
- screen = SDL_GetWindowSurface(sdl_window);
+ m_screen = SDL_GetWindowSurface(m_sdl_window);
- if (screen == 0)
+ if (m_screen == nullptr)
{
- cout << "Error: SDL_SetVideoMode failed" << endl;
+ std::cout << "Error: SDL_SetVideoMode failed" << std::endl;
// throw exception
return -1;
}
@@ -97,62 +94,60 @@ int FlatWindow::open()
void FlatWindow::close()
{
- if (screen != 0)
- {
- SDL_FreeSurface(screen);
- screen = 0;
+ if (m_screen != nullptr) {
+ SDL_FreeSurface(m_screen);
+ m_screen = nullptr;
}
- if (sdl_window != 0)
- {
- SDL_DestroyWindow(sdl_window);
- sdl_window = 0;
+ if (m_sdl_window != nullptr) {
+ SDL_DestroyWindow(m_sdl_window);
+ m_sdl_window = nullptr;
}
}
int FlatWindow::getWidth() const
{
- return bounds->w;
+ return m_bounds->w;
}
int FlatWindow::getHeight() const
{
- return bounds->h;
+ return m_bounds->h;
}
const SDL_Rect * FlatWindow::getBounds() const
{
- return bounds;
+ return m_bounds;
}
SDL_Window * FlatWindow::getSDLWindow()
{
- return sdl_window;
+ return m_sdl_window;
}
SDL_Surface * FlatWindow::getScreenSurface()
{
- return screen;
+ return m_screen;
}
const std::string& FlatWindow::getTitle() const
{
- return title;
+ return m_title;
}
void FlatWindow::setTitle(const std::string& title)
{
- this->title = title;
+ m_title = title;
}
window_status FlatWindow::getWindowStatus() const
{
- return status;
+ return m_status;
}
void FlatWindow::setWindowStatus(window_status status)
{
- this->status = status;
+ m_status = status;
}
void FlatWindow::key_cb(const SDL_KeyboardEvent *event)
diff --git a/test/signal_test.cpp b/test/signal_test.cpp
index 6f04fcd..3b3fab2 100644
--- a/test/signal_test.cpp
+++ b/test/signal_test.cpp
@@ -14,19 +14,19 @@ using namespace flat::core;
class sender : public object
{
- const char * message;
- channel::ptr chan;
+ const char *m_message;
+ channel::ptr m_chan;
public:
- sender(const char * message, channel::ptr chan) : message(message), chan(chan)
+ sender(const char * message, channel::ptr chan) : m_message(message), m_chan(chan)
{
}
void send()
{
- signal<const char*> msg(message);
- chan->emit(msg);
+ signal<const char*> msg(m_message);
+ m_chan->emit(m_msg);
}
};
@@ -43,7 +43,7 @@ public:
c_listener(channel::ptr chan)
{
- lis = chan->connect(&c_listener::method_listener, this);
+ m_lis = chan->connect(&c_listener::method_listener, this);
}
void method_listener(const char *msg)