Comments (3)
Could you give an example of usage? Or how this could be used for an application.
from wink-signals.
An example would be:
#define NORMAL 0
#define HIGHEST 2
#define HIGH 1
EventManager.addSignal<void (Event&>("MyEvent", &Function1, NORMAL);
EventManager.addSignal<void (Event&>("MyEvent", &Function2, HIGHEST);
EventManager.addSignal<void (Event&>("MyEvent", &Function3, HIGH);
EventManager.execute("MyEvent", &EventStructure);
Function1, Function3 and Function2 is executed in that order. The example is for a game that use delegates to make an event system.
Function1
(
setEventCancelled(canMove());
)
Funcion3
(
if( isCancelled() )
return
TriggerACustomMovementEvent()
)
Function2
(
if( !isCancelled() )
return;
updateTiles()
)
from wink-signals.
One thing I'd like to mention, a signal can have multiple "slots"* (a.k.a. functions) connected to it. Are you sure you're referring to a signal? All a signal really is a wrapper for a vector of slots.
Also, I don't really have time to implement any of this anytime soon (I'm quite busy with other projects ATM). Perhaps you could do it and make a fork. If you do try to keep the same naming conventions.
*std::function, and my custom slots work with signals. Just thought I'd mention it, if I didn't in the README, as I haven't updated this library in months.
from wink-signals.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wink-signals.