Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module events;
- import std.conv,std.stdio;
- struct Event
- {
- T opCast(T)()
- {
- // enforce(T.type == 0);
- return cast(T)this;
- }
- int type;
- int num_elements;
- }
- struct JoystickButtonPressed
- {
- int joystick;
- int button;
- bool down;
- int usecs;
- Event event;
- alias event this;
- }
- void send() {
- auto e = JoystickButtonPressed(0,1,true,0,Event(0,4));
- recieve(e);
- }
- void recieve(ref Event e) {
- //auto j = to!JoystickButtonPressed(e);
- //writeln("event type %i button %i",j.type,j.button);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement