Interface IReceiver
Any receiver class needs to derive from this interface using a specific event type and implement receive.
Template arguments
interface IReceiver(E)
if (isEvent!E);
Methods
Name | Description |
---|---|
receive
|
Will be called each time an event of type E is emitted. |
Example
@event struct MyEvent
{
int data;
}
class MySystem : IReceiver!MyEvent
{
this(EventManager evtManager)
{
evtManager .subscribe!MyEvent(this);
}
void receive(MyEvent event)
{
import std .stdio : write;
// do something with event
write(event .data);
}
}
Authors
Claude Merle
Copyright
© 2015-2016 Claude Merle
License
This file is part of EntitySysD.
EntitySysD is free software: you can redistribute it and/or modify it under the terms of the Lesser GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
EntitySysD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public License for more details.
You should have received a copy of the Lesser GNU General Public License along with EntitySysD. If not, see http://www.gnu.org/licenses/.