From 1250eb967beb20ef760e94ae2665bde43c3cf4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Tue, 17 Jul 2018 10:31:34 -0300 Subject: [PATCH] Replacement of PlusCallback in favor of std::functional ( just for lambdas ). --HG-- branch : dev-functional --- include/eepp/core.hpp | 2 + include/eepp/graphics/console.hpp | 2 +- include/eepp/graphics/shaderprogram.hpp | 2 +- include/eepp/graphics/sprite.hpp | 2 +- include/eepp/graphics/textureatlasloader.hpp | 2 +- include/eepp/maps/mapeditor/mapeditor.hpp | 2 +- include/eepp/maps/tilemap.hpp | 6 +-- include/eepp/math/interpolation1d.hpp | 4 +- include/eepp/math/interpolation2d.hpp | 4 +- include/eepp/network/http.hpp | 2 +- include/eepp/physics/body.hpp | 10 ++--- include/eepp/physics/space.hpp | 22 +++++----- include/eepp/scene/action.hpp | 2 +- include/eepp/scene/node.hpp | 2 +- include/eepp/system/objectloader.hpp | 2 +- include/eepp/system/resourceloader.hpp | 2 +- include/eepp/ui/tools/textureatlaseditor.hpp | 2 +- include/eepp/ui/uinode.hpp | 2 +- include/eepp/ui/uiwidgetcreator.hpp | 4 +- include/eepp/window/input.hpp | 2 +- include/eepp/window/inputtextbuffer.hpp | 2 +- include/eepp/window/window.hpp | 4 +- projects/linux/ee.creator.user | 4 +- src/eepp/graphics/shaderprogram.cpp | 2 +- src/eepp/graphics/sprite.cpp | 8 +--- src/eepp/graphics/textureatlasloader.cpp | 2 +- src/eepp/maps/mapeditor/mapeditor.cpp | 2 +- .../maps/mapeditor/maplayerproperties.cpp | 2 +- .../maps/mapeditor/maplayerproperties.hpp | 2 +- src/eepp/maps/mapeditor/uigotypenew.cpp | 4 +- src/eepp/maps/mapeditor/uigotypenew.hpp | 4 +- src/eepp/maps/mapeditor/uimap.cpp | 10 ++--- src/eepp/maps/mapeditor/uimap.hpp | 12 ++--- src/eepp/maps/mapeditor/uimaplayernew.cpp | 2 +- src/eepp/maps/mapeditor/uimaplayernew.hpp | 2 +- src/eepp/maps/mapeditor/uimapnew.cpp | 4 +- src/eepp/maps/mapeditor/uimapnew.hpp | 4 +- src/eepp/maps/tilemap.cpp | 6 +-- src/eepp/math/interpolation1d.cpp | 10 ++--- src/eepp/math/interpolation2d.cpp | 10 ++--- src/eepp/physics/body.cpp | 10 ++--- src/eepp/physics/space.cpp | 44 +++++++++---------- src/eepp/system/objectloader.cpp | 2 +- src/eepp/system/resourceloader.cpp | 2 +- src/eepp/ui/tools/textureatlaseditor.cpp | 2 +- src/eepp/ui/tools/textureatlasnew.cpp | 2 +- src/eepp/ui/tools/textureatlasnew.hpp | 2 +- src/eepp/ui/uiwidgetcreator.cpp | 4 +- src/eepp/window/inputtextbuffer.cpp | 4 +- src/eepp/window/window.cpp | 2 +- src/examples/physics/physics.cpp | 4 +- src/test/eetest.cpp | 17 ++++--- src/test/eetest.hpp | 2 +- 53 files changed, 136 insertions(+), 135 deletions(-) diff --git a/include/eepp/core.hpp b/include/eepp/core.hpp index e74cfd9b7..b1dd9a003 100644 --- a/include/eepp/core.hpp +++ b/include/eepp/core.hpp @@ -1,6 +1,8 @@ #ifndef EE_BASE_HPP #define EE_BASE_HPP +#include + #include #include diff --git a/include/eepp/graphics/console.hpp b/include/eepp/graphics/console.hpp index 392e90cf5..788b3f7f4 100755 --- a/include/eepp/graphics/console.hpp +++ b/include/eepp/graphics/console.hpp @@ -17,7 +17,7 @@ namespace EE { namespace Graphics { class EE_API Console : protected LogReaderInterface { public: //! The Console Callback return a vector of parameters ( String ) - typedef cb::Callback1& > ConsoleCallback; + typedef std::function& )> ConsoleCallback; /** Instances the console but doesn't create it, you must call Create to initialize the console. */ Console( EE::Window::Window * window = NULL ); diff --git a/include/eepp/graphics/shaderprogram.hpp b/include/eepp/graphics/shaderprogram.hpp index 9aead5856..425c01156 100644 --- a/include/eepp/graphics/shaderprogram.hpp +++ b/include/eepp/graphics/shaderprogram.hpp @@ -30,7 +30,7 @@ class EE_API ShaderProgram { /** Creates the vertex and fragment shader from an array of strings */ static ShaderProgram * New( const char ** VertexShaderData, const Uint32& NumLinesVS, const char ** FragmentShaderData, const Uint32& NumLinesFS, const std::string& Name = "" ); - typedef cb::Callback1 ShaderProgramReloadCb; + typedef std::function ShaderProgramReloadCb; virtual ~ShaderProgram(); diff --git a/include/eepp/graphics/sprite.hpp b/include/eepp/graphics/sprite.hpp index 035c8b42e..13689b2cd 100755 --- a/include/eepp/graphics/sprite.hpp +++ b/include/eepp/graphics/sprite.hpp @@ -15,7 +15,7 @@ namespace EE { namespace Graphics { class EE_API Sprite : public Drawable { public: /// Event ID - Sprite - User Data - typedef cb::Callback3< void, Uint32, Sprite *, void * > SpriteCallback; + typedef std::function SpriteCallback; /** @brief SpriteEvents The events that can be reported by the Sprite */ enum SpriteEvents { diff --git a/include/eepp/graphics/textureatlasloader.hpp b/include/eepp/graphics/textureatlasloader.hpp index 3353b2a4e..73c218b17 100644 --- a/include/eepp/graphics/textureatlasloader.hpp +++ b/include/eepp/graphics/textureatlasloader.hpp @@ -17,7 +17,7 @@ class TextureAtlas; /** @brief The Texture Atlas Loader loads any previously created Texture Atlas. */ class EE_API TextureAtlasLoader { public: - typedef cb::Callback1 GLLoadCallback; + typedef std::function GLLoadCallback; /** Creates an empty loader. The texture atlas can be loaded callin any Load* function. */ TextureAtlasLoader(); diff --git a/include/eepp/maps/mapeditor/mapeditor.hpp b/include/eepp/maps/mapeditor/mapeditor.hpp index 8dcc9d81c..04aa50b1d 100644 --- a/include/eepp/maps/mapeditor/mapeditor.hpp +++ b/include/eepp/maps/mapeditor/mapeditor.hpp @@ -35,7 +35,7 @@ class UIMap; class EE_API MapEditor { public: - typedef cb::Callback0 MapEditorCloseCb; + typedef std::function MapEditorCloseCb; static MapEditor * New( UIWindow * AttatchTo = NULL, const MapEditorCloseCb& callback = MapEditorCloseCb() ); diff --git a/include/eepp/maps/tilemap.hpp b/include/eepp/maps/tilemap.hpp index 95c4a1165..9729be8ba 100644 --- a/include/eepp/maps/tilemap.hpp +++ b/include/eepp/maps/tilemap.hpp @@ -28,9 +28,9 @@ class EE_API TileMap { public: typedef std::map PropertiesMap; typedef std::list GOTypesList; //! Special object types used in this map - typedef cb::Callback4< GameObject *, const Uint32&, const Uint32&, MapLayer *, const Uint32&> CreateGOCb; - typedef cb::Callback0 MapDrawCb; - typedef cb::Callback0 MapUpdateCb; + typedef std::function< GameObject *( const Uint32&, const Uint32&, MapLayer *, const Uint32& )> CreateGOCb; + typedef std::function MapDrawCb; + typedef std::function MapUpdateCb; TileMap(); diff --git a/include/eepp/math/interpolation1d.hpp b/include/eepp/math/interpolation1d.hpp index 6efff336a..41d90a36b 100644 --- a/include/eepp/math/interpolation1d.hpp +++ b/include/eepp/math/interpolation1d.hpp @@ -29,9 +29,9 @@ class EE_API Interpolation1d { ~Interpolation1d(); - typedef cb::Callback1 OnPathEndCallback; + typedef std::function OnPathEndCallback; - typedef cb::Callback1 OnStepCallback; + typedef std::function OnStepCallback; /** Add a new point */ Interpolation1d& add( const Float& pos, const Time& Time = Time::Zero ); diff --git a/include/eepp/math/interpolation2d.hpp b/include/eepp/math/interpolation2d.hpp index 54e4a630e..bb4034aa2 100755 --- a/include/eepp/math/interpolation2d.hpp +++ b/include/eepp/math/interpolation2d.hpp @@ -30,9 +30,9 @@ class EE_API Interpolation2d { ~Interpolation2d(); - typedef cb::Callback1 OnPathEndCallback; + typedef std::function OnPathEndCallback; - typedef cb::Callback1 OnStepCallback; + typedef std::function OnStepCallback; /** Add a new waypoint */ Interpolation2d& add(const Vector2f& pos, const Time& time = Time::Zero ); diff --git a/include/eepp/network/http.hpp b/include/eepp/network/http.hpp index ab6bfa3c3..7f631c2c7 100644 --- a/include/eepp/network/http.hpp +++ b/include/eepp/network/http.hpp @@ -307,7 +307,7 @@ class EE_API Http : NonCopyable { Response downloadRequest(const Request& request, std::string writePath, Time timeout = Time::Zero); /** Definition of the async callback response */ - typedef cb::Callback3 AsyncResponseCallback; + typedef std::function AsyncResponseCallback; /** @brief Sends the request and creates a new thread, when got the response informs the result to the callback. ** This function does not lock the caller thread. diff --git a/include/eepp/physics/body.hpp b/include/eepp/physics/body.hpp index ef7c5767d..638cf4e50 100644 --- a/include/eepp/physics/body.hpp +++ b/include/eepp/physics/body.hpp @@ -11,11 +11,11 @@ class Arbiter; class CP_API Body { public: - typedef cb::Callback3 ShapeIteratorFunc; - typedef cb::Callback3 ConstraintIteratorFunc; - typedef cb::Callback3 ArbiterIteratorFunc; - typedef cb::Callback4 BodyVelocityFunc; - typedef cb::Callback2 BodyPositionFunc; + typedef std::function ShapeIteratorFunc; + typedef std::function ConstraintIteratorFunc; + typedef std::function ArbiterIteratorFunc; + typedef std::function BodyVelocityFunc; + typedef std::function BodyPositionFunc; class ShapeIterator { public: diff --git a/include/eepp/physics/space.hpp b/include/eepp/physics/space.hpp index b89d3afac..d28c4db23 100644 --- a/include/eepp/physics/space.hpp +++ b/include/eepp/physics/space.hpp @@ -12,16 +12,16 @@ CP_NAMESPACE_BEGIN class CP_API Space { public: - typedef cb::Callback3 CollisionBeginFunc; - typedef cb::Callback3 CollisionPreSolveFunc; - typedef cb::Callback3 CollisionPostSolveFunc; - typedef cb::Callback3 CollisionSeparateFunc; - typedef cb::Callback3 PostStepCallback; - typedef cb::Callback2 BBQueryFunc; - typedef cb::Callback4 SegmentQueryFunc; - typedef cb::Callback2 PointQueryFunc; - typedef cb::Callback3 BodyIteratorFunc; - typedef cb::Callback3 ShapeIteratorFunc; + typedef std::function CollisionBeginFunc; + typedef std::function CollisionPreSolveFunc; + typedef std::function CollisionPostSolveFunc; + typedef std::function CollisionSeparateFunc; + typedef std::function PostStepCallback; + typedef std::function BBQueryFunc; + typedef std::function SegmentQueryFunc; + typedef std::function PointQueryFunc; + typedef std::function BodyIteratorFunc; + typedef std::function ShapeIteratorFunc; class CollisionHandler { public: @@ -32,7 +32,7 @@ class CP_API Space { { } - inline void Reset() { + inline void reset() { a = 0; b = 0; data = NULL; diff --git a/include/eepp/scene/action.hpp b/include/eepp/scene/action.hpp index 0c523edbc..f4ade102c 100644 --- a/include/eepp/scene/action.hpp +++ b/include/eepp/scene/action.hpp @@ -20,7 +20,7 @@ class EE_API Action { OnStep }; - typedef cb::Callback2 ActionCallback; + typedef std::function ActionCallback; Action(); diff --git a/include/eepp/scene/node.hpp b/include/eepp/scene/node.hpp index a2481191b..e0df180d4 100644 --- a/include/eepp/scene/node.hpp +++ b/include/eepp/scene/node.hpp @@ -65,7 +65,7 @@ class EE_API Node : public Transformable { public: static Node * New(); - typedef cb::Callback1 EventCallback; + typedef std::function EventCallback; Node(); diff --git a/include/eepp/system/objectloader.hpp b/include/eepp/system/objectloader.hpp index 46a67eaf1..487030a7f 100644 --- a/include/eepp/system/objectloader.hpp +++ b/include/eepp/system/objectloader.hpp @@ -10,7 +10,7 @@ namespace EE { namespace System { /** @brief Base class that defines resources to be loaded in synchronous or asynchronous mode. */ class EE_API ObjectLoader : protected Thread { public: - typedef cb::Callback1 ObjLoadCallback; + typedef std::function ObjLoadCallback; /** @brief LoaderType Definition of the Object Loaders implemented by the engine. */ enum ObjLoaderType { diff --git a/include/eepp/system/resourceloader.hpp b/include/eepp/system/resourceloader.hpp index ca558d24c..c4f5581f8 100644 --- a/include/eepp/system/resourceloader.hpp +++ b/include/eepp/system/resourceloader.hpp @@ -10,7 +10,7 @@ namespace EE { namespace System { /** @brief A simple resource loader that can load a batch of resources synchronously or asynchronously */ class EE_API ResourceLoader { public: - typedef cb::Callback1 ResLoadCallback; + typedef std::function ResLoadCallback; /** @param MaxThreads Set the maximun simultaneous threads to load resources, THREADS_AUTO will use the cpu number of cores. */ ResourceLoader( const Uint32& MaxThreads = THREADS_AUTO ); diff --git a/include/eepp/ui/tools/textureatlaseditor.hpp b/include/eepp/ui/tools/textureatlaseditor.hpp index 8d55feeb7..922896460 100644 --- a/include/eepp/ui/tools/textureatlaseditor.hpp +++ b/include/eepp/ui/tools/textureatlaseditor.hpp @@ -18,7 +18,7 @@ class TextureAtlasTextureRegionEditor; class EE_API TextureAtlasEditor { public: - typedef cb::Callback0 TGEditorCloseCb; + typedef std::function TGEditorCloseCb; static TextureAtlasEditor * New( UIWindow * AttatchTo = NULL, const TGEditorCloseCb& callback = TGEditorCloseCb() ); diff --git a/include/eepp/ui/uinode.hpp b/include/eepp/ui/uinode.hpp index cf7ff412f..a08c7860d 100644 --- a/include/eepp/ui/uinode.hpp +++ b/include/eepp/ui/uinode.hpp @@ -22,7 +22,7 @@ class EE_API UINode : public Node { public: static UINode * New(); - typedef cb::Callback1 EventCallback; + typedef std::function EventCallback; UINode(); diff --git a/include/eepp/ui/uiwidgetcreator.hpp b/include/eepp/ui/uiwidgetcreator.hpp index 2ef3db348..f6fdf1556 100644 --- a/include/eepp/ui/uiwidgetcreator.hpp +++ b/include/eepp/ui/uiwidgetcreator.hpp @@ -8,8 +8,8 @@ namespace EE { namespace UI { class EE_API UIWidgetCreator { public: - typedef cb::Callback1 CustomWidgetCb; - typedef cb::Callback0 RegisterWidgetCb; + typedef std::function CustomWidgetCb; + typedef std::function RegisterWidgetCb; static UIWidget * createFromName( std::string widgetName ); diff --git a/include/eepp/window/input.hpp b/include/eepp/window/input.hpp index 659019545..ea8426861 100644 --- a/include/eepp/window/input.hpp +++ b/include/eepp/window/input.hpp @@ -17,7 +17,7 @@ namespace EE { namespace Window { /** @brief The basic input class. For mouse and keyboard. */ class EE_API Input { public: - typedef cb::Callback1 InputCallback; + typedef std::function InputCallback; virtual ~Input(); diff --git a/include/eepp/window/inputtextbuffer.hpp b/include/eepp/window/inputtextbuffer.hpp index 19a35b672..ac8a153e0 100755 --- a/include/eepp/window/inputtextbuffer.hpp +++ b/include/eepp/window/inputtextbuffer.hpp @@ -24,7 +24,7 @@ enum INPUT_TEXTBUFFER_FLAGS { /** @brief A class to keep a buffer of the user writed text */ class EE_API InputTextBuffer { public: - typedef cb::Callback0 EnterCallback; + typedef std::function EnterCallback; InputTextBuffer( const bool& active, const bool& newLineEnabled, const bool& freeEditing, EE::Window::Window * window = NULL, const Uint32& maxLength = INPUT_LENGHT_MAX ); diff --git a/include/eepp/window/window.hpp b/include/eepp/window/window.hpp index 251772034..06c7dd6aa 100644 --- a/include/eepp/window/window.hpp +++ b/include/eepp/window/window.hpp @@ -151,8 +151,8 @@ class DisplayMode { class EE_API Window { public: - typedef cb::Callback1 WindowResizeCallback; - typedef cb::Callback1 WindowRequestCloseCallback; + typedef std::function WindowResizeCallback; + typedef std::function WindowRequestCloseCallback; Window( WindowSettings Settings, ContextSettings Context, Clipboard * Clipboard, Input * Input, CursorManager * CursorManager ); diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index 7d5dc0c5a..cced14bbe 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -72,7 +72,7 @@ {6d057187-158a-4883-8d5b-d470a6b6b025} 10 0 - 2 + 0 ../../make/linux diff --git a/src/eepp/graphics/shaderprogram.cpp b/src/eepp/graphics/shaderprogram.cpp index 20b028cef..2698448b0 100644 --- a/src/eepp/graphics/shaderprogram.cpp +++ b/src/eepp/graphics/shaderprogram.cpp @@ -197,7 +197,7 @@ void ShaderProgram::reload() { link(); - if ( mReloadCb.IsSet() ) { + if ( mReloadCb ) { mReloadCb( this ); } } diff --git a/src/eepp/graphics/sprite.cpp b/src/eepp/graphics/sprite.cpp index 8d130b0b3..d7ab33754 100755 --- a/src/eepp/graphics/sprite.cpp +++ b/src/eepp/graphics/sprite.cpp @@ -27,7 +27,6 @@ Sprite::Sprite() : mAnimTo( 0 ), mUserData( NULL ) { - mCb.Reset(); } Sprite::Sprite( const std::string& name, const std::string& extension, TextureAtlas * SearchInTextureAtlas ) : @@ -47,7 +46,6 @@ Sprite::Sprite( const std::string& name, const std::string& extension, TextureAt mAnimTo( 0 ), mUserData( NULL ) { - mCb.Reset(); addFramesByPattern( name, extension, SearchInTextureAtlas ); } @@ -68,7 +66,6 @@ Sprite::Sprite( TextureRegion * TextureRegion ) : mAnimTo( 0 ), mUserData( NULL ) { - mCb.Reset(); createStatic( TextureRegion ); } @@ -89,7 +86,6 @@ Sprite::Sprite( const Uint32& TexId, const Sizef &DestSize, const Vector2i &Offs mAnimTo( 0 ), mUserData( NULL ) { - mCb.Reset(); createStatic( TexId, DestSize, Offset, TexSector ); } @@ -835,11 +831,11 @@ void Sprite::setEventsCallback(const SpriteCallback& Cb , void * UserData ) { } void Sprite::clearCallback() { - mCb.Reset(); + mCb = nullptr; } void Sprite::fireEvent( const Uint32& Event ) { - if ( SPR_FGET( SPRITE_FLAG_EVENTS_ENABLED ) && mCb.IsSet() ) { + if ( SPR_FGET( SPRITE_FLAG_EVENTS_ENABLED ) && mCb ) { mCb( Event, this, mUserData ); } } diff --git a/src/eepp/graphics/textureatlasloader.cpp b/src/eepp/graphics/textureatlasloader.cpp index 7c4ba2747..3c773a8d4 100644 --- a/src/eepp/graphics/textureatlasloader.cpp +++ b/src/eepp/graphics/textureatlasloader.cpp @@ -273,7 +273,7 @@ void TextureAtlasLoader::createTextureRegions() { mLoaded = true; - if ( mLoadCallback.IsSet() ) { + if ( mLoadCallback ) { mLoadCallback( this ); } } diff --git a/src/eepp/maps/mapeditor/mapeditor.cpp b/src/eepp/maps/mapeditor/mapeditor.cpp index 5bf346bc6..1fe21a3bb 100644 --- a/src/eepp/maps/mapeditor/mapeditor.cpp +++ b/src/eepp/maps/mapeditor/mapeditor.cpp @@ -1229,7 +1229,7 @@ void MapEditor::onLayerSelect( const Event * Event ) { } void MapEditor::windowClose( const Event * Event ) { - if ( mCloseCb.IsSet() ) + if ( mCloseCb ) mCloseCb(); eeDelete( this ); diff --git a/src/eepp/maps/mapeditor/maplayerproperties.cpp b/src/eepp/maps/mapeditor/maplayerproperties.cpp index 2a30153d8..c60174381 100644 --- a/src/eepp/maps/mapeditor/maplayerproperties.cpp +++ b/src/eepp/maps/mapeditor/maplayerproperties.cpp @@ -143,7 +143,7 @@ void MapLayerProperties::onOKClick( const Event * Event ) { mLayer->setName( mUIInput->getText().toUtf8() ); - if ( mRefreshCb.IsSet() ) { + if ( mRefreshCb ) { mRefreshCb(); } diff --git a/src/eepp/maps/mapeditor/maplayerproperties.hpp b/src/eepp/maps/mapeditor/maplayerproperties.hpp index fe6ff3aaa..43465a390 100644 --- a/src/eepp/maps/mapeditor/maplayerproperties.hpp +++ b/src/eepp/maps/mapeditor/maplayerproperties.hpp @@ -16,7 +16,7 @@ class MapEditor; class EE_API MapLayerProperties { public: - typedef cb::Callback0 RefreshLayerListCb; + typedef std::function RefreshLayerListCb; MapLayerProperties( MapLayer * Map, RefreshLayerListCb Cb = RefreshLayerListCb() ); diff --git a/src/eepp/maps/mapeditor/uigotypenew.cpp b/src/eepp/maps/mapeditor/uigotypenew.cpp index 230efd8e0..2cc138e98 100644 --- a/src/eepp/maps/mapeditor/uigotypenew.cpp +++ b/src/eepp/maps/mapeditor/uigotypenew.cpp @@ -3,7 +3,7 @@ namespace EE { namespace Maps { namespace Private { -UIGOTypeNew::UIGOTypeNew( cb::Callback2 Cb ) : +UIGOTypeNew::UIGOTypeNew( std::function Cb ) : mUITheme( NULL ), mUIWindow( NULL ), mUIInput( NULL ), @@ -57,7 +57,7 @@ UIGOTypeNew::~UIGOTypeNew() { void UIGOTypeNew::onOKClick( const Event * Event ) { if ( mUIInput->getText().size() ) { - if ( mCb.IsSet() ) + if ( mCb ) mCb( mUIInput->getText().toUtf8(), String::hash( mUIInput->getText().toUtf8() ) ); } diff --git a/src/eepp/maps/mapeditor/uigotypenew.hpp b/src/eepp/maps/mapeditor/uigotypenew.hpp index 40aa7b248..42251c91f 100644 --- a/src/eepp/maps/mapeditor/uigotypenew.hpp +++ b/src/eepp/maps/mapeditor/uigotypenew.hpp @@ -11,14 +11,14 @@ namespace EE { namespace Maps { namespace Private { class EE_API UIGOTypeNew { public: - UIGOTypeNew( cb::Callback2 Cb ); + UIGOTypeNew(std::function Cb ); virtual ~UIGOTypeNew(); protected: UITheme * mUITheme; UIWindow * mUIWindow; UITextInput * mUIInput; - cb::Callback2 mCb; + std::function mCb; void onWindowClose( const Event * Event ); diff --git a/src/eepp/maps/mapeditor/uimap.cpp b/src/eepp/maps/mapeditor/uimap.cpp index 368b22c54..534ebfec1 100644 --- a/src/eepp/maps/mapeditor/uimap.cpp +++ b/src/eepp/maps/mapeditor/uimap.cpp @@ -66,7 +66,7 @@ Uint32 UIMap::onDrag( const Vector2f& Pos ) { mDragPoint = Pos; - if ( mUpdateScrollCb.IsSet() ) { + if ( mUpdateScrollCb ) { mUpdateScrollCb(); } @@ -120,7 +120,7 @@ void UIMap::update( const Time& time ) { mSelLight->setRadius( mSelLight->getRadius() - 10 ); } - if ( mLightRadiusChangeCb.IsSet() ) + if ( mLightRadiusChangeCb ) mLightRadiusChangeCb( mSelLight ); } else if ( Flags & EE_BUTTON_RMASK ) { if ( mSelLight == mAddLight ) { @@ -192,7 +192,7 @@ void UIMap::selectPolyObj() { } } } else { - if ( mAlertCb.IsSet() ) { + if ( mAlertCb ) { mAlertCb( "No layer found", "An Object Layer must be selected first." )->setFocus(); } } @@ -321,7 +321,7 @@ void UIMap::tryToSelectLight() { mSelLight = mMap->getLightManager()->getLightOver( mMap->getMouseMapPosf(), mSelLight ); if ( NULL != mSelLight && mSelLight != tLight ) { - if ( mLightSelCb.IsSet() ) + if ( mLightSelCb ) mLightSelCb( mSelLight ); } } @@ -368,7 +368,7 @@ void UIMap::addLight( MapLight * Light ) { mMap->getLightManager()->addLight( Light ); - if ( mLightSelCb.IsSet() ) + if ( mLightSelCb ) mLightSelCb( mSelLight ); } } diff --git a/src/eepp/maps/mapeditor/uimap.hpp b/src/eepp/maps/mapeditor/uimap.hpp index 727457bcd..fc25e31ae 100644 --- a/src/eepp/maps/mapeditor/uimap.hpp +++ b/src/eepp/maps/mapeditor/uimap.hpp @@ -30,12 +30,12 @@ class EE_API UIMap : public UIWindow { INSERT_POLYLINE }; - typedef cb::Callback1 LightSelectCb; - typedef cb::Callback1 LightRadiusChangeCb; - typedef cb::Callback2 ObjAddCb; - typedef cb::Callback2 AlertCb; - typedef cb::Callback0 OnMapLoadCb; - typedef cb::Callback0 UpdateScrollCb; + typedef std::function LightSelectCb; + typedef std::function LightRadiusChangeCb; + typedef std::function ObjAddCb; + typedef std::function AlertCb; + typedef std::function OnMapLoadCb; + typedef std::function UpdateScrollCb; UIMap( UITheme * Theme, TileMap * Map = NULL ); diff --git a/src/eepp/maps/mapeditor/uimaplayernew.cpp b/src/eepp/maps/mapeditor/uimaplayernew.cpp index fa9d3327e..ca5a6ebe6 100644 --- a/src/eepp/maps/mapeditor/uimaplayernew.cpp +++ b/src/eepp/maps/mapeditor/uimaplayernew.cpp @@ -76,7 +76,7 @@ void UIMapLayerNew::onOKClick( const Event * event ) { if ( mUILayerName->getText().size() ) { mLayer = mUIMap->Map()->addLayer( mType, LAYER_FLAG_VISIBLE | LAYER_FLAG_LIGHTS_ENABLED, mUILayerName->getText() ); - if ( mNewLayerCb.IsSet() ) + if ( mNewLayerCb ) mNewLayerCb( this ); } diff --git a/src/eepp/maps/mapeditor/uimaplayernew.hpp b/src/eepp/maps/mapeditor/uimaplayernew.hpp index f79ea4fa6..58f1ea156 100644 --- a/src/eepp/maps/mapeditor/uimaplayernew.hpp +++ b/src/eepp/maps/mapeditor/uimaplayernew.hpp @@ -12,7 +12,7 @@ namespace EE { namespace Maps { namespace Private { class EE_API UIMapLayerNew { public: - typedef cb::Callback1 NewLayerCb; + typedef std::function NewLayerCb; UIMapLayerNew( UIMap * Map, EE_LAYER_TYPE Type, NewLayerCb newLayerCb = NewLayerCb() ); diff --git a/src/eepp/maps/mapeditor/uimapnew.cpp b/src/eepp/maps/mapeditor/uimapnew.cpp index 97ea9ccc6..7e82cd2df 100644 --- a/src/eepp/maps/mapeditor/uimapnew.cpp +++ b/src/eepp/maps/mapeditor/uimapnew.cpp @@ -11,7 +11,7 @@ static UITextView * createTextBox( const String& Text = "", Node * Parent = NULL return Ctrl; } -UIMapNew::UIMapNew( UIMap * Map, cb::Callback0 NewMapCb, bool ResizeMap ) : +UIMapNew::UIMapNew( UIMap * Map, std::function NewMapCb, bool ResizeMap ) : mTheme( NULL ), mUIWindow( NULL ), mUIMap( Map ), @@ -265,7 +265,7 @@ void UIMapNew::onOKClick( const Event * Event ) { FileSystem::fileRemove( mapPath ); } - if ( mNewMapCb.IsSet() ) + if ( mNewMapCb ) mNewMapCb(); } diff --git a/src/eepp/maps/mapeditor/uimapnew.hpp b/src/eepp/maps/mapeditor/uimapnew.hpp index 3576346ae..6648df823 100644 --- a/src/eepp/maps/mapeditor/uimapnew.hpp +++ b/src/eepp/maps/mapeditor/uimapnew.hpp @@ -14,7 +14,7 @@ namespace EE { namespace Maps { namespace Private { class EE_API UIMapNew { public: - UIMapNew( UIMap * Map, cb::Callback0 NewMapCb = cb::Callback0(), bool ResizeMap = false ); + UIMapNew( UIMap * Map, std::function NewMapCb = cb::Callback0(), bool ResizeMap = false ); virtual ~UIMapNew(); protected: @@ -38,7 +38,7 @@ class EE_API UIMapNew { UITextView * mUIGreenTxt; UITextView * mUIBlueTxt; - cb::Callback0 mNewMapCb; + std::function mNewMapCb; Sizei mNewSize; bool mResizeMap; diff --git a/src/eepp/maps/tilemap.cpp b/src/eepp/maps/tilemap.cpp index 04cf41aa8..671bcbb46 100644 --- a/src/eepp/maps/tilemap.cpp +++ b/src/eepp/maps/tilemap.cpp @@ -241,7 +241,7 @@ void TileMap::draw() { mouseOverDraw(); - if ( mDrawCb.IsSet() ) + if ( mDrawCb ) mDrawCb(); GlobalBatchRenderer::instance()->draw(); @@ -448,7 +448,7 @@ void TileMap::update() { for ( Uint32 i = 0; i < mLayerCount; i++ ) mLayers[i]->update( mWindow->getElapsed() ); - if ( mUpdateCb.IsSet() ) + if ( mUpdateCb ) mUpdateCb(); } @@ -656,7 +656,7 @@ GameObject * TileMap::createGameObject( const Uint32& Type, const Uint32& Flags, } default: { - if ( mCreateGOCb.IsSet() ) { + if ( mCreateGOCb ) { return mCreateGOCb( Type, Flags, Layer, DataId ); } else { GameObjectVirtual * tVirtual; diff --git a/src/eepp/math/interpolation1d.cpp b/src/eepp/math/interpolation1d.cpp index 00b2f7c0b..00b2324de 100644 --- a/src/eepp/math/interpolation1d.cpp +++ b/src/eepp/math/interpolation1d.cpp @@ -180,26 +180,26 @@ void Interpolation1d::update( const Time& Elapsed ) { if ( mCurPoint + 1 < mPoints.size() ) { mNexP = &mPoints[ mCurPoint + 1 ]; - if ( mOnStepCallback.IsSet() ) + if ( mOnStepCallback ) mOnStepCallback(*this); } else { - if ( mOnStepCallback.IsSet() ) + if ( mOnStepCallback ) mOnStepCallback(*this); if ( mLoop ) { mNexP = &mPoints[ 0 ]; - if ( mOnPathEndCallback.IsSet() ) + if ( mOnPathEndCallback ) mOnPathEndCallback(*this); } else { mEnable = false; mEnded = true; - if ( mOnPathEndCallback.IsSet() ) { + if ( mOnPathEndCallback ) { mOnPathEndCallback(*this); if ( !mEnable ) - mOnPathEndCallback.Reset(); + mOnPathEndCallback = nullptr; } return; } diff --git a/src/eepp/math/interpolation2d.cpp b/src/eepp/math/interpolation2d.cpp index 60ab91b5a..9631158ee 100755 --- a/src/eepp/math/interpolation2d.cpp +++ b/src/eepp/math/interpolation2d.cpp @@ -201,26 +201,26 @@ void Interpolation2d::update( const Time& Elapsed ) { if ( mCurPoint + 1 < mPoints.size() ) { mNexP = &mPoints[ mCurPoint + 1 ]; - if ( mOnStepCallback.IsSet() ) + if ( mOnStepCallback ) mOnStepCallback(*this); } else { - if ( mOnStepCallback.IsSet() ) + if ( mOnStepCallback ) mOnStepCallback(*this); if ( mLoop ) { mNexP = &mPoints[ 0 ]; - if ( mOnPathEndCallback.IsSet() ) + if ( mOnPathEndCallback ) mOnPathEndCallback(*this); } else { mEnable = false; mEnded = true; - if ( mOnPathEndCallback.IsSet() ) { + if ( mOnPathEndCallback ) { mOnPathEndCallback(*this); if ( !mEnable ) - mOnPathEndCallback.Reset(); + mOnPathEndCallback = nullptr; } return; } diff --git a/src/eepp/physics/body.cpp b/src/eepp/physics/body.cpp index 92019d472..81e08c213 100644 --- a/src/eepp/physics/body.cpp +++ b/src/eepp/physics/body.cpp @@ -191,7 +191,7 @@ void Body::updatePosition( cpFloat dt ) { void Body::bodyVelocityFuncWrapper( cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt ) { Body * tBody = reinterpret_cast( body->data ); - if ( tBody->mVelocityFunc.IsSet() ) { + if ( tBody->mVelocityFunc ) { tBody->mVelocityFunc( reinterpret_cast( body->data ), tovect( gravity ), damping, dt ); } } @@ -205,7 +205,7 @@ void Body::velocityFunc( BodyVelocityFunc func ) { void Body::bodyPositionFuncWrapper( cpBody* body, cpFloat dt ) { Body * tBody = reinterpret_cast( body->data ); - if ( tBody->mPositionFunc.IsSet() ) { + if ( tBody->mPositionFunc ) { tBody->mPositionFunc( reinterpret_cast( body->data ), dt ); } } @@ -259,7 +259,7 @@ void Body::eachShape( ShapeIteratorFunc Func, void * data ) { } void Body::onEachShape( Shape * Shape, ShapeIterator * it ) { - if ( it->Func.IsSet() ) { + if ( it->Func ) { it->Func( it->Body, Shape, it->Data ); } } @@ -275,7 +275,7 @@ void Body::eachConstraint( ConstraintIteratorFunc Func, void * data ) { } void Body::onEachConstraint( Constraint * Constraint, ConstraintIterator * it ) { - if ( it->Func.IsSet() ) { + if ( it->Func ) { it->Func( this, Constraint, it->Data ); } } @@ -292,7 +292,7 @@ void Body::eachArbiter( ArbiterIteratorFunc Func, void * data ) { } void Body::onEachArbiter( Arbiter * Arbiter, ArbiterIterator * it ) { - if ( it->Func.IsSet() ) { + if ( it->Func ) { it->Func( this, Arbiter, it->Data ); } } diff --git a/src/eepp/physics/space.cpp b/src/eepp/physics/space.cpp index f6c88b632..4b369d861 100644 --- a/src/eepp/physics/space.cpp +++ b/src/eepp/physics/space.cpp @@ -423,12 +423,12 @@ cpBool Space::onCollisionBegin( Arbiter * arb, void * data ) { std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); CollisionHandler handler = static_cast( it->second ); - if ( it != mCollisions.end() && handler.begin.IsSet() ) { + if ( it != mCollisions.end() && handler.begin ) { return handler.begin( arb, this, handler.data ); } //} - if ( mCollisionsDefault.begin.IsSet() ) { + if ( mCollisionsDefault.begin ) { return mCollisionsDefault.begin( arb, this, mCollisionsDefault.data ); } @@ -442,12 +442,12 @@ cpBool Space::onCollisionPreSolve( Arbiter * arb, void * data ) { std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); CollisionHandler handler = static_cast( it->second ); - if ( it != mCollisions.end() && handler.preSolve.IsSet() ) { + if ( it != mCollisions.end() && handler.preSolve ) { return handler.preSolve( arb, this, handler.data ); } //} - if ( mCollisionsDefault.preSolve.IsSet() ) { + if ( mCollisionsDefault.preSolve ) { return mCollisionsDefault.preSolve( arb, this, mCollisionsDefault.data ); } @@ -461,13 +461,13 @@ void Space::onCollisionPostSolve( Arbiter * arb, void * data ) { std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); CollisionHandler handler = static_cast( it->second ); - if ( it != mCollisions.end() && handler.postSolve.IsSet() ) { + if ( it != mCollisions.end() && handler.postSolve ) { handler.postSolve( arb, this, handler.data ); return; } //} - if ( mCollisionsDefault.begin.IsSet() ) { + if ( mCollisionsDefault.begin ) { mCollisionsDefault.postSolve( arb, this, mCollisionsDefault.data ); } } @@ -479,13 +479,13 @@ void Space::onCollisionSeparate( Arbiter * arb, void * data ) { std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash ); CollisionHandler handler = static_cast( it->second ); - if ( it != mCollisions.end() && handler.separate.IsSet() ) { + if ( it != mCollisions.end() && handler.separate ) { handler.separate( arb, this, handler.data ); return; } //} - if ( mCollisionsDefault.begin.IsSet() ) { + if ( mCollisionsDefault.begin ) { mCollisionsDefault.separate( arb, this, mCollisionsDefault.data ); } } @@ -493,7 +493,7 @@ void Space::onCollisionSeparate( Arbiter * arb, void * data ) { void Space::onPostStepCallback( void * obj, void * data ) { PostStepCallbackCont * Cb = reinterpret_cast ( data ); - if ( Cb->Callback.IsSet() ) { + if ( Cb->Callback ) { Cb->Callback( this, obj, Cb->Data ); } @@ -502,19 +502,19 @@ void Space::onPostStepCallback( void * obj, void * data ) { } void Space::onBBQuery( Shape * shape, BBQuery * query ) { - if ( query->Func.IsSet() ) { + if ( query->Func ) { query->Func( shape, query->Data ); } } void Space::onSegmentQuery( Shape * shape, cpFloat t, cVect n , SegmentQuery * query ) { - if ( query->Func.IsSet() ) { + if ( query->Func ) { query->Func( shape, t, n, query->Data ); } } void Space::onPointQuery( Shape * shape, PointQuery * query ) { - if ( query->Func.IsSet() ) { + if ( query->Func ) { query->Func( shape, query->Data ); } } @@ -522,10 +522,10 @@ void Space::onPointQuery( Shape * shape, PointQuery * query ) { void Space::addCollisionHandler( const CollisionHandler& handler ) { cpHashValue hash = CP_HASH_PAIR( handler.a, handler.b ); - cpCollisionBeginFunc f1 = ( handler.begin.IsSet() ) ? &RecieverCollisionBeginFunc : NULL; - cpCollisionPreSolveFunc f2 = ( handler.preSolve.IsSet() ) ? &RecieverCollisionPreSolveFunc : NULL; - cpCollisionPostSolveFunc f3 = ( handler.postSolve.IsSet() ) ? &RecieverCollisionPostSolve : NULL; - cpCollisionSeparateFunc f4 = ( handler.separate.IsSet() ) ? &RecieverCollisionSeparateFunc : NULL; + cpCollisionBeginFunc f1 = ( handler.begin ) ? &RecieverCollisionBeginFunc : NULL; + cpCollisionPreSolveFunc f2 = ( handler.preSolve ) ? &RecieverCollisionPreSolveFunc : NULL; + cpCollisionPostSolveFunc f3 = ( handler.postSolve ) ? &RecieverCollisionPostSolve : NULL; + cpCollisionSeparateFunc f4 = ( handler.separate ) ? &RecieverCollisionSeparateFunc : NULL; cpSpaceAddCollisionHandler( mSpace, handler.a, handler.b, f1, f2, f3, f4, (void*)hash ); @@ -540,10 +540,10 @@ void Space::removeCollisionHandler( cpCollisionType a, cpCollisionType b ) { } void Space::setDefaultCollisionHandler( const CollisionHandler& handler ) { - cpCollisionBeginFunc f1 = ( handler.begin.IsSet() ) ? &RecieverCollisionBeginFunc : NULL; - cpCollisionPreSolveFunc f2 = ( handler.preSolve.IsSet() ) ? &RecieverCollisionPreSolveFunc : NULL; - cpCollisionPostSolveFunc f3 = ( handler.postSolve.IsSet() ) ? &RecieverCollisionPostSolve : NULL; - cpCollisionSeparateFunc f4 = ( handler.separate.IsSet() ) ? &RecieverCollisionSeparateFunc : NULL; + cpCollisionBeginFunc f1 = ( handler.begin ) ? &RecieverCollisionBeginFunc : NULL; + cpCollisionPreSolveFunc f2 = ( handler.preSolve ) ? &RecieverCollisionPreSolveFunc : NULL; + cpCollisionPostSolveFunc f3 = ( handler.postSolve ) ? &RecieverCollisionPostSolve : NULL; + cpCollisionSeparateFunc f4 = ( handler.separate ) ? &RecieverCollisionSeparateFunc : NULL; cpSpaceSetDefaultCollisionHandler( mSpace, f1, f2, f3, f4, NULL ); @@ -614,7 +614,7 @@ void Space::eachBody( BodyIteratorFunc Func, void * data ) { } void Space::onEachBody( Body * Body, BodyIterator * it ) { - if ( it->Func.IsSet() ) { + if ( it->Func ) { it->Func( it->Space, Body, it->Data ); } } @@ -630,7 +630,7 @@ void Space::eachShape( ShapeIteratorFunc Func, void * data ) { } void Space::onEachShape( Shape * Shape, ShapeIterator * it ) { - if ( it->Func.IsSet() ) { + if ( it->Func ) { it->Func( it->Space, Shape, it->Data ); } } diff --git a/src/eepp/system/objectloader.cpp b/src/eepp/system/objectloader.cpp index d0764216f..7816c9f77 100644 --- a/src/eepp/system/objectloader.cpp +++ b/src/eepp/system/objectloader.cpp @@ -23,7 +23,7 @@ void ObjectLoader::load() { } void ObjectLoader::load( ObjLoadCallback Cb ) { - if ( Cb.IsSet() ) { + if ( Cb ) { mLoadCbs.push_back( Cb ); } diff --git a/src/eepp/system/resourceloader.cpp b/src/eepp/system/resourceloader.cpp index ce2a5c5ba..86cd635a8 100644 --- a/src/eepp/system/resourceloader.cpp +++ b/src/eepp/system/resourceloader.cpp @@ -70,7 +70,7 @@ bool ResourceLoader::clear( const bool& ClearObjectsLoaded ) { } void ResourceLoader::load( ResLoadCallback Cb ) { - if ( Cb.IsSet() ) + if ( Cb ) mLoadCbs.push_back( Cb ); load(); diff --git a/src/eepp/ui/tools/textureatlaseditor.cpp b/src/eepp/ui/tools/textureatlaseditor.cpp index bf497d88d..071f1956a 100644 --- a/src/eepp/ui/tools/textureatlaseditor.cpp +++ b/src/eepp/ui/tools/textureatlaseditor.cpp @@ -242,7 +242,7 @@ void TextureAtlasEditor::onDestHChange( const Event * Event ) { } void TextureAtlasEditor::windowClose( const Event * Event ) { - if ( mCloseCb.IsSet() ) + if ( mCloseCb ) mCloseCb(); eeDelete( this ); diff --git a/src/eepp/ui/tools/textureatlasnew.cpp b/src/eepp/ui/tools/textureatlasnew.cpp index 8390210b6..fbb868a11 100644 --- a/src/eepp/ui/tools/textureatlasnew.cpp +++ b/src/eepp/ui/tools/textureatlasnew.cpp @@ -179,7 +179,7 @@ void TextureAtlasNew::textureAtlasSave( const Event * Event ) { texturePacker->save( FPath, static_cast ( mSaveFileType->getListBox()->getItemSelectedIndex() ) ); - if ( mNewTGCb.IsSet() ) + if ( mNewTGCb ) mNewTGCb( texturePacker ); mUIWindow->closeWindow(); diff --git a/src/eepp/ui/tools/textureatlasnew.hpp b/src/eepp/ui/tools/textureatlasnew.hpp index 4ae79a0b8..169ffe90c 100644 --- a/src/eepp/ui/tools/textureatlasnew.hpp +++ b/src/eepp/ui/tools/textureatlasnew.hpp @@ -12,7 +12,7 @@ namespace EE { namespace UI { namespace Tools { class EE_API TextureAtlasNew { public: - typedef cb::Callback1 TGCreateCb; + typedef std::function TGCreateCb; TextureAtlasNew( TGCreateCb NewTGCb = TGCreateCb() ); diff --git a/src/eepp/ui/uiwidgetcreator.cpp b/src/eepp/ui/uiwidgetcreator.cpp index 7088f7ac6..e72afb7b5 100644 --- a/src/eepp/ui/uiwidgetcreator.cpp +++ b/src/eepp/ui/uiwidgetcreator.cpp @@ -74,11 +74,11 @@ UIWidget * UIWidgetCreator::createFromName( std::string widgetName ) { else if ( widgetName == "layout" ) return UILayout::New(); if ( registeredWidget.find( widgetName ) != registeredWidget.end() ) { - return registeredWidget[ widgetName ].Call(); + return registeredWidget[ widgetName ](); } if ( widgetCallback.find( widgetName ) != widgetCallback.end() ) { - return widgetCallback[ widgetName ].Call( widgetName ); + return widgetCallback[ widgetName ]( widgetName ); } return NULL; diff --git a/src/eepp/window/inputtextbuffer.cpp b/src/eepp/window/inputtextbuffer.cpp index 848c98fd3..1ec8f0634 100755 --- a/src/eepp/window/inputtextbuffer.cpp +++ b/src/eepp/window/inputtextbuffer.cpp @@ -385,7 +385,7 @@ void InputTextBuffer::update( InputEvent* Event ) { setChangedSinceLastUpdate( true ); } - if ( mEnterCall.IsSet() ) + if ( mEnterCall ) mEnterCall(); } else if ( c == KEY_LEFT ) { @@ -489,7 +489,7 @@ void InputTextBuffer::update( InputEvent* Event ) { if ( setSupportNewLine() && canAdd() ) mText += '\n'; - if ( mEnterCall.IsSet() ) + if ( mEnterCall ) mEnterCall(); } } diff --git a/src/eepp/window/window.cpp b/src/eepp/window/window.cpp index 752912ac9..89c5439b0 100644 --- a/src/eepp/window/window.cpp +++ b/src/eepp/window/window.cpp @@ -440,7 +440,7 @@ void Window::logFailureInit( const std::string& ClassName, const std::string& Ba } void Window::onCloseRequest() { - if ( mCloseRequestCallback.IsSet() && !mCloseRequestCallback.Call( this ) ) { + if ( mCloseRequestCallback && !mCloseRequestCallback( this ) ) { return; } diff --git a/src/examples/physics/physics.cpp b/src/examples/physics/physics.cpp index fcef03af7..be6386b4a 100644 --- a/src/examples/physics/physics.cpp +++ b/src/examples/physics/physics.cpp @@ -6,7 +6,7 @@ To understand the conceptos of space, body, shapes, etc you can read the Chipmunk documentation: http://chipmunk-physics.net/release/ChipmunkLatest-Docs/ */ -typedef cb::Callback0 SceneCb; +typedef std::function SceneCb; struct physicDemo { SceneCb init; @@ -327,7 +327,7 @@ void demo3Create() { handler.separate = cb::Make3( &blockerSeparate ); mSpace->addCollisionHandler( handler ); - handler.Reset(); // Reset all the values and the callbacks ( set the callbacks as !IsSet() + handler.reset(); // Reset all the values and the callbacks ( set the callbacks as !IsSet() handler.a = CATCH_SENSOR_TYPE; handler.b = BALL_TYPE; diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 57c8e29b5..7280edb31 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -491,15 +491,18 @@ void EETest::createBaseUI() { w->setParent( C )->setSize( 20, 20 )->setPosition( 260, 130 ); w->setBackgroundFillEnabled( true )->setColor( Color::Green ); w->setRotation( 45 ); - w->addEventListener( Event::MouseEnter, cb::Make1( [] ( const Event* event ) { + + w->addEventListener( Event::MouseEnter, [] ( const Event* event ) { static_cast( event->getNode() )->getBackground()->setColor( Color::Yellow ); - } ) ); - w->addEventListener( Event::MouseExit, cb::Make1( [] ( const Event* event ) { + } ); + + w->addEventListener( Event::MouseExit, [] ( const Event* event ) { static_cast( event->getNode() )->getBackground()->setColor( Color::Green ); - } ) ); - w->addEventListener( Event::MouseClick, cb::Make1( [] ( const Event* event ) { + } ); + + w->addEventListener( Event::MouseClick, [] ( const Event* event ) { static_cast( event->getNode() )->getBackground()->setColor( Color::Red ); - } ) ); + } ); C = reinterpret_cast ( C->getParent() ); @@ -2199,7 +2202,7 @@ void EETest::demo2Create() { handler.separate = cb::Make3( this, &EETest::blockerSeparate ); mSpace->addCollisionHandler( handler ); - handler.Reset(); // Reset all the values and the callbacks ( set the callbacks as !IsSet() + handler.reset(); // Reset all the values and the callbacks ( set the callbacks as !IsSet() handler.a = CATCH_SENSOR_TYPE; handler.b = BALL_TYPE; diff --git a/src/test/eetest.hpp b/src/test/eetest.hpp index c41af0789..fa714d814 100644 --- a/src/test/eetest.hpp +++ b/src/test/eetest.hpp @@ -19,7 +19,7 @@ struct Emitter { class EETest : private Thread { public: - typedef cb::Callback0 SceneCb; + typedef std::function SceneCb; void init(); void update();