mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-11 17:17:42 +03:00
Replacement of PlusCallback in favor of std::functional ( just for lambdas ).
--HG-- branch : dev-functional
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef EE_BASE_HPP
|
||||
#define EE_BASE_HPP
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <eepp/thirdparty/PlusCallback/callback.hpp>
|
||||
|
||||
#include <eepp/config.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<void, const std::vector < String >& > ConsoleCallback;
|
||||
typedef std::function<void( const std::vector < String >& )> ConsoleCallback;
|
||||
|
||||
/** Instances the console but doesn't create it, you must call Create to initialize the console. */
|
||||
Console( EE::Window::Window * window = NULL );
|
||||
|
||||
@@ -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<void, ShaderProgram*> ShaderProgramReloadCb;
|
||||
typedef std::function<void( ShaderProgram* )> ShaderProgramReloadCb;
|
||||
|
||||
virtual ~ShaderProgram();
|
||||
|
||||
|
||||
@@ -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<void( Uint32, Sprite *, void * )> SpriteCallback;
|
||||
|
||||
/** @brief SpriteEvents The events that can be reported by the Sprite */
|
||||
enum SpriteEvents {
|
||||
|
||||
@@ -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<void, TextureAtlasLoader *> GLLoadCallback;
|
||||
typedef std::function<void( TextureAtlasLoader * )> GLLoadCallback;
|
||||
|
||||
/** Creates an empty loader. The texture atlas can be loaded callin any Load* function. */
|
||||
TextureAtlasLoader();
|
||||
|
||||
@@ -35,7 +35,7 @@ class UIMap;
|
||||
|
||||
class EE_API MapEditor {
|
||||
public:
|
||||
typedef cb::Callback0<void> MapEditorCloseCb;
|
||||
typedef std::function<void()> MapEditorCloseCb;
|
||||
|
||||
static MapEditor * New( UIWindow * AttatchTo = NULL, const MapEditorCloseCb& callback = MapEditorCloseCb() );
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ class EE_API TileMap {
|
||||
public:
|
||||
typedef std::map<std::string, std::string> PropertiesMap;
|
||||
typedef std::list<std::string> GOTypesList; //! Special object types used in this map
|
||||
typedef cb::Callback4< GameObject *, const Uint32&, const Uint32&, MapLayer *, const Uint32&> CreateGOCb;
|
||||
typedef cb::Callback0<void> MapDrawCb;
|
||||
typedef cb::Callback0<void> MapUpdateCb;
|
||||
typedef std::function< GameObject *( const Uint32&, const Uint32&, MapLayer *, const Uint32& )> CreateGOCb;
|
||||
typedef std::function<void()> MapDrawCb;
|
||||
typedef std::function<void()> MapUpdateCb;
|
||||
|
||||
TileMap();
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ class EE_API Interpolation1d {
|
||||
|
||||
~Interpolation1d();
|
||||
|
||||
typedef cb::Callback1<void,Interpolation1d&> OnPathEndCallback;
|
||||
typedef std::function<void(Interpolation1d&)> OnPathEndCallback;
|
||||
|
||||
typedef cb::Callback1<void,Interpolation1d&> OnStepCallback;
|
||||
typedef std::function<void(Interpolation1d&)> OnStepCallback;
|
||||
|
||||
/** Add a new point */
|
||||
Interpolation1d& add( const Float& pos, const Time& Time = Time::Zero );
|
||||
|
||||
@@ -30,9 +30,9 @@ class EE_API Interpolation2d {
|
||||
|
||||
~Interpolation2d();
|
||||
|
||||
typedef cb::Callback1<void,Interpolation2d&> OnPathEndCallback;
|
||||
typedef std::function<void(Interpolation2d&)> OnPathEndCallback;
|
||||
|
||||
typedef cb::Callback1<void,Interpolation2d&> OnStepCallback;
|
||||
typedef std::function<void(Interpolation2d&)> OnStepCallback;
|
||||
|
||||
/** Add a new waypoint */
|
||||
Interpolation2d& add(const Vector2f& pos, const Time& time = Time::Zero );
|
||||
|
||||
@@ -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<void, const Http&, Http::Request&, Http::Response&> AsyncResponseCallback;
|
||||
typedef std::function<void( const Http&, Http::Request&, Http::Response& )> 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.
|
||||
|
||||
@@ -11,11 +11,11 @@ class Arbiter;
|
||||
|
||||
class CP_API Body {
|
||||
public:
|
||||
typedef cb::Callback3<void, Body *, Shape *, void * > ShapeIteratorFunc;
|
||||
typedef cb::Callback3<void, Body *, Constraint *, void *> ConstraintIteratorFunc;
|
||||
typedef cb::Callback3<void, Body *, Arbiter *, void *> ArbiterIteratorFunc;
|
||||
typedef cb::Callback4<void, Body *, cVect, cpFloat, cpFloat> BodyVelocityFunc;
|
||||
typedef cb::Callback2<void, Body *, cpFloat> BodyPositionFunc;
|
||||
typedef std::function<void( Body *, Shape *, void * )> ShapeIteratorFunc;
|
||||
typedef std::function<void( Body *, Constraint *, void *)> ConstraintIteratorFunc;
|
||||
typedef std::function<void( Body *, Arbiter *, void *)> ArbiterIteratorFunc;
|
||||
typedef std::function<void( Body *, cVect, cpFloat, cpFloat)> BodyVelocityFunc;
|
||||
typedef std::function<void( Body *, cpFloat )> BodyPositionFunc;
|
||||
|
||||
class ShapeIterator {
|
||||
public:
|
||||
|
||||
@@ -12,16 +12,16 @@ CP_NAMESPACE_BEGIN
|
||||
|
||||
class CP_API Space {
|
||||
public:
|
||||
typedef cb::Callback3<int , Arbiter *, Space * , void * > CollisionBeginFunc;
|
||||
typedef cb::Callback3<int , Arbiter *, Space * , void * > CollisionPreSolveFunc;
|
||||
typedef cb::Callback3<void , Arbiter *, Space * , void * > CollisionPostSolveFunc;
|
||||
typedef cb::Callback3<void , Arbiter *, Space * , void * > CollisionSeparateFunc;
|
||||
typedef cb::Callback3<void , Space * , void * , void * > PostStepCallback;
|
||||
typedef cb::Callback2<void , Shape * , void * > BBQueryFunc;
|
||||
typedef cb::Callback4<void , Shape * , cpFloat , cVect , void * > SegmentQueryFunc;
|
||||
typedef cb::Callback2<void , Shape * , void * > PointQueryFunc;
|
||||
typedef cb::Callback3<void , Space * , Body * , void * > BodyIteratorFunc;
|
||||
typedef cb::Callback3<void , Space * , Shape * , void * > ShapeIteratorFunc;
|
||||
typedef std::function<int ( Arbiter *, Space * , void * )> CollisionBeginFunc;
|
||||
typedef std::function<int ( Arbiter *, Space * , void * )> CollisionPreSolveFunc;
|
||||
typedef std::function<void ( Arbiter *, Space * , void * )> CollisionPostSolveFunc;
|
||||
typedef std::function<void ( Arbiter *, Space * , void * )> CollisionSeparateFunc;
|
||||
typedef std::function<void ( Space * , void * , void * )> PostStepCallback;
|
||||
typedef std::function<void ( Shape * , void * )> BBQueryFunc;
|
||||
typedef std::function<void ( Shape * , cpFloat , cVect , void * )> SegmentQueryFunc;
|
||||
typedef std::function<void ( Shape * , void * )> PointQueryFunc;
|
||||
typedef std::function<void ( Space * , Body * , void * )> BodyIteratorFunc;
|
||||
typedef std::function<void ( Space * , Shape * , void * )> ShapeIteratorFunc;
|
||||
|
||||
class CollisionHandler {
|
||||
public:
|
||||
@@ -32,7 +32,7 @@ class CP_API Space {
|
||||
{
|
||||
}
|
||||
|
||||
inline void Reset() {
|
||||
inline void reset() {
|
||||
a = 0;
|
||||
b = 0;
|
||||
data = NULL;
|
||||
|
||||
@@ -20,7 +20,7 @@ class EE_API Action {
|
||||
OnStep
|
||||
};
|
||||
|
||||
typedef cb::Callback2<void,Action*,const ActionType&> ActionCallback;
|
||||
typedef std::function<void(Action*,const ActionType&)> ActionCallback;
|
||||
|
||||
Action();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class EE_API Node : public Transformable {
|
||||
public:
|
||||
static Node * New();
|
||||
|
||||
typedef cb::Callback1<void, const Event*> EventCallback;
|
||||
typedef std::function<void( const Event* )> EventCallback;
|
||||
|
||||
Node();
|
||||
|
||||
|
||||
@@ -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<void, ObjectLoader *> ObjLoadCallback;
|
||||
typedef std::function<void( ObjectLoader * )> ObjLoadCallback;
|
||||
|
||||
/** @brief LoaderType Definition of the Object Loaders implemented by the engine. */
|
||||
enum ObjLoaderType {
|
||||
|
||||
@@ -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<void, ResourceLoader *> ResLoadCallback;
|
||||
typedef std::function<void( ResourceLoader * )> 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 );
|
||||
|
||||
@@ -18,7 +18,7 @@ class TextureAtlasTextureRegionEditor;
|
||||
|
||||
class EE_API TextureAtlasEditor {
|
||||
public:
|
||||
typedef cb::Callback0<void> TGEditorCloseCb;
|
||||
typedef std::function<void()> TGEditorCloseCb;
|
||||
|
||||
static TextureAtlasEditor * New( UIWindow * AttatchTo = NULL, const TGEditorCloseCb& callback = TGEditorCloseCb() );
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class EE_API UINode : public Node {
|
||||
public:
|
||||
static UINode * New();
|
||||
|
||||
typedef cb::Callback1<void, const Event*> EventCallback;
|
||||
typedef std::function<void( const Event* )> EventCallback;
|
||||
|
||||
UINode();
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace EE { namespace UI {
|
||||
|
||||
class EE_API UIWidgetCreator {
|
||||
public:
|
||||
typedef cb::Callback1<UIWidget*, std::string> CustomWidgetCb;
|
||||
typedef cb::Callback0<UIWidget*> RegisterWidgetCb;
|
||||
typedef std::function<UIWidget*( std::string )> CustomWidgetCb;
|
||||
typedef std::function<UIWidget*()> RegisterWidgetCb;
|
||||
|
||||
static UIWidget * createFromName( std::string widgetName );
|
||||
|
||||
|
||||
@@ -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<void, InputEvent*> InputCallback;
|
||||
typedef std::function<void( InputEvent* )> InputCallback;
|
||||
|
||||
virtual ~Input();
|
||||
|
||||
|
||||
@@ -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<void> EnterCallback;
|
||||
typedef std::function<void()> EnterCallback;
|
||||
|
||||
InputTextBuffer( const bool& active, const bool& newLineEnabled, const bool& freeEditing, EE::Window::Window * window = NULL, const Uint32& maxLength = INPUT_LENGHT_MAX );
|
||||
|
||||
|
||||
@@ -151,8 +151,8 @@ class DisplayMode {
|
||||
|
||||
class EE_API Window {
|
||||
public:
|
||||
typedef cb::Callback1<void, Window*> WindowResizeCallback;
|
||||
typedef cb::Callback1<bool, Window*> WindowRequestCloseCallback;
|
||||
typedef std::function<void( Window* )> WindowResizeCallback;
|
||||
typedef std::function<bool( Window* )> WindowRequestCloseCallback;
|
||||
|
||||
Window( WindowSettings Settings, ContextSettings Context, Clipboard * Clipboard, Input * Input, CursorManager * CursorManager );
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.5.0, 2018-03-17T18:27:20. -->
|
||||
<!-- Written by QtCreator 4.6.1, 2018-07-17T01:25:03. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
@@ -72,7 +72,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{6d057187-158a-4883-8d5b-d470a6b6b025}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">10</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">2</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">../../make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
|
||||
@@ -197,7 +197,7 @@ void ShaderProgram::reload() {
|
||||
|
||||
link();
|
||||
|
||||
if ( mReloadCb.IsSet() ) {
|
||||
if ( mReloadCb ) {
|
||||
mReloadCb( this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ void TextureAtlasLoader::createTextureRegions() {
|
||||
|
||||
mLoaded = true;
|
||||
|
||||
if ( mLoadCallback.IsSet() ) {
|
||||
if ( mLoadCallback ) {
|
||||
mLoadCallback( this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1229,7 +1229,7 @@ void MapEditor::onLayerSelect( const Event * Event ) {
|
||||
}
|
||||
|
||||
void MapEditor::windowClose( const Event * Event ) {
|
||||
if ( mCloseCb.IsSet() )
|
||||
if ( mCloseCb )
|
||||
mCloseCb();
|
||||
|
||||
eeDelete( this );
|
||||
|
||||
@@ -143,7 +143,7 @@ void MapLayerProperties::onOKClick( const Event * Event ) {
|
||||
|
||||
mLayer->setName( mUIInput->getText().toUtf8() );
|
||||
|
||||
if ( mRefreshCb.IsSet() ) {
|
||||
if ( mRefreshCb ) {
|
||||
mRefreshCb();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class MapEditor;
|
||||
|
||||
class EE_API MapLayerProperties {
|
||||
public:
|
||||
typedef cb::Callback0<void> RefreshLayerListCb;
|
||||
typedef std::function<void()> RefreshLayerListCb;
|
||||
|
||||
MapLayerProperties( MapLayer * Map, RefreshLayerListCb Cb = RefreshLayerListCb() );
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace EE { namespace Maps { namespace Private {
|
||||
|
||||
UIGOTypeNew::UIGOTypeNew( cb::Callback2<void, std::string, Uint32> Cb ) :
|
||||
UIGOTypeNew::UIGOTypeNew( std::function<void( std::string, Uint32 )> 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() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@ namespace EE { namespace Maps { namespace Private {
|
||||
|
||||
class EE_API UIGOTypeNew {
|
||||
public:
|
||||
UIGOTypeNew( cb::Callback2<void, std::string, Uint32> Cb );
|
||||
UIGOTypeNew(std::function<void(std::string, Uint32)> Cb );
|
||||
|
||||
virtual ~UIGOTypeNew();
|
||||
protected:
|
||||
UITheme * mUITheme;
|
||||
UIWindow * mUIWindow;
|
||||
UITextInput * mUIInput;
|
||||
cb::Callback2<void, std::string, Uint32> mCb;
|
||||
std::function<void( std::string, Uint32 )> mCb;
|
||||
|
||||
void onWindowClose( const Event * Event );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ class EE_API UIMap : public UIWindow {
|
||||
INSERT_POLYLINE
|
||||
};
|
||||
|
||||
typedef cb::Callback1<void, MapLight *> LightSelectCb;
|
||||
typedef cb::Callback1<void, MapLight *> LightRadiusChangeCb;
|
||||
typedef cb::Callback2<void, Uint32, Polygon2f> ObjAddCb;
|
||||
typedef cb::Callback2<UIMessageBox*, const String&, const String&> AlertCb;
|
||||
typedef cb::Callback0<void> OnMapLoadCb;
|
||||
typedef cb::Callback0<void> UpdateScrollCb;
|
||||
typedef std::function<void( MapLight * )> LightSelectCb;
|
||||
typedef std::function<void( MapLight * )> LightRadiusChangeCb;
|
||||
typedef std::function<void( Uint32, Polygon2f )> ObjAddCb;
|
||||
typedef std::function<UIMessageBox*( const String&, const String& )> AlertCb;
|
||||
typedef std::function<void()> OnMapLoadCb;
|
||||
typedef std::function<void()> UpdateScrollCb;
|
||||
|
||||
UIMap( UITheme * Theme, TileMap * Map = NULL );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace EE { namespace Maps { namespace Private {
|
||||
|
||||
class EE_API UIMapLayerNew {
|
||||
public:
|
||||
typedef cb::Callback1<void, UIMapLayerNew*> NewLayerCb;
|
||||
typedef std::function<void( UIMapLayerNew* )> NewLayerCb;
|
||||
|
||||
UIMapLayerNew( UIMap * Map, EE_LAYER_TYPE Type, NewLayerCb newLayerCb = NewLayerCb() );
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ static UITextView * createTextBox( const String& Text = "", Node * Parent = NULL
|
||||
return Ctrl;
|
||||
}
|
||||
|
||||
UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap ) :
|
||||
UIMapNew::UIMapNew( UIMap * Map, std::function<void()> 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace EE { namespace Maps { namespace Private {
|
||||
|
||||
class EE_API UIMapNew {
|
||||
public:
|
||||
UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb = cb::Callback0<void>(), bool ResizeMap = false );
|
||||
UIMapNew( UIMap * Map, std::function<void()> NewMapCb = cb::Callback0<void>(), bool ResizeMap = false );
|
||||
|
||||
virtual ~UIMapNew();
|
||||
protected:
|
||||
@@ -38,7 +38,7 @@ class EE_API UIMapNew {
|
||||
UITextView * mUIGreenTxt;
|
||||
UITextView * mUIBlueTxt;
|
||||
|
||||
cb::Callback0<void> mNewMapCb;
|
||||
std::function<void()> mNewMapCb;
|
||||
|
||||
Sizei mNewSize;
|
||||
bool mResizeMap;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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*>( body->data );
|
||||
|
||||
if ( tBody->mVelocityFunc.IsSet() ) {
|
||||
if ( tBody->mVelocityFunc ) {
|
||||
tBody->mVelocityFunc( reinterpret_cast<Body*>( 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*>( body->data );
|
||||
|
||||
if ( tBody->mPositionFunc.IsSet() ) {
|
||||
if ( tBody->mPositionFunc ) {
|
||||
tBody->mPositionFunc( reinterpret_cast<Body*>( 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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,12 +423,12 @@ cpBool Space::onCollisionBegin( Arbiter * arb, void * data ) {
|
||||
std::map< cpHashValue, CollisionHandler >::iterator it = mCollisions.find( hash );
|
||||
CollisionHandler handler = static_cast<CollisionHandler>( 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<CollisionHandler>( 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<CollisionHandler>( 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<CollisionHandler>( 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<PostStepCallbackCont *> ( 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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ void ObjectLoader::load() {
|
||||
}
|
||||
|
||||
void ObjectLoader::load( ObjLoadCallback Cb ) {
|
||||
if ( Cb.IsSet() ) {
|
||||
if ( Cb ) {
|
||||
mLoadCbs.push_back( Cb );
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -242,7 +242,7 @@ void TextureAtlasEditor::onDestHChange( const Event * Event ) {
|
||||
}
|
||||
|
||||
void TextureAtlasEditor::windowClose( const Event * Event ) {
|
||||
if ( mCloseCb.IsSet() )
|
||||
if ( mCloseCb )
|
||||
mCloseCb();
|
||||
|
||||
eeDelete( this );
|
||||
|
||||
@@ -179,7 +179,7 @@ void TextureAtlasNew::textureAtlasSave( const Event * Event ) {
|
||||
|
||||
texturePacker->save( FPath, static_cast<Image::SaveType> ( mSaveFileType->getListBox()->getItemSelectedIndex() ) );
|
||||
|
||||
if ( mNewTGCb.IsSet() )
|
||||
if ( mNewTGCb )
|
||||
mNewTGCb( texturePacker );
|
||||
|
||||
mUIWindow->closeWindow();
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace EE { namespace UI { namespace Tools {
|
||||
|
||||
class EE_API TextureAtlasNew {
|
||||
public:
|
||||
typedef cb::Callback1<void, TexturePacker *> TGCreateCb;
|
||||
typedef std::function<void( TexturePacker * )> TGCreateCb;
|
||||
|
||||
TextureAtlasNew( TGCreateCb NewTGCb = TGCreateCb() );
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<void> SceneCb;
|
||||
typedef std::function<void()> 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;
|
||||
|
||||
@@ -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<void, const Event*>( [] ( const Event* event ) {
|
||||
|
||||
w->addEventListener( Event::MouseEnter, [] ( const Event* event ) {
|
||||
static_cast<UIWidget*>( event->getNode() )->getBackground()->setColor( Color::Yellow );
|
||||
} ) );
|
||||
w->addEventListener( Event::MouseExit, cb::Make1<void, const Event*>( [] ( const Event* event ) {
|
||||
} );
|
||||
|
||||
w->addEventListener( Event::MouseExit, [] ( const Event* event ) {
|
||||
static_cast<UIWidget*>( event->getNode() )->getBackground()->setColor( Color::Green );
|
||||
} ) );
|
||||
w->addEventListener( Event::MouseClick, cb::Make1<void, const Event*>( [] ( const Event* event ) {
|
||||
} );
|
||||
|
||||
w->addEventListener( Event::MouseClick, [] ( const Event* event ) {
|
||||
static_cast<UIWidget*>( event->getNode() )->getBackground()->setColor( Color::Red );
|
||||
} ) );
|
||||
} );
|
||||
|
||||
C = reinterpret_cast<UINode*> ( 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;
|
||||
|
||||
@@ -19,7 +19,7 @@ struct Emitter {
|
||||
|
||||
class EETest : private Thread {
|
||||
public:
|
||||
typedef cb::Callback0<void> SceneCb;
|
||||
typedef std::function<void()> SceneCb;
|
||||
|
||||
void init();
|
||||
void update();
|
||||
|
||||
Reference in New Issue
Block a user