Tramway SDK
signal.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_FRAMEWORK_SIGNAL_H
5#define TRAM_SDK_FRAMEWORK_SIGNAL_H
6
7#include <framework/message.h>
8#include <framework/event.h>
9#include <framework/uid.h>
10
11namespace tram {
12
13typedef uint32_t signal_t;
14
15struct Value;
16
17struct Signal {
18 enum Type : signal_t {
34 };
35
37
39 void* data;
40
41 float delay;
42 int limit;
43
45
46 static signal_t Register(const char* name);
47 static signal_t GetType(name_t name);
49};
50
52public:
53 void Fire(signal_t signal, id_t sender);
54 void Fire(signal_t signal, id_t sender, Value value);
55 void Add(const Signal& signal);
56public:
58 size_t signal_count = 0;
59};
60
61}
62
63#endif // TRAM_SDK_FRAMEWORK_SIGNAL_H
Definition: signal.h:51
void Add(const Signal &signal)
Definition: signal.cpp:123
void Fire(signal_t signal, id_t sender)
Definition: signal.cpp:63
size_t signal_count
Definition: signal.h:58
Signal signals[10]
Definition: signal.h:57
Generic, type-safe union.
Definition: value.h:18
Definition: api.h:9
uint32_t id_t
Definition: core.h:11
uint32_t message_t
Definition: message.h:11
uint32_t signal_t
Definition: signal.h:13
Definition: signal.h:17
signal_t type
Definition: signal.h:36
static name_t GetName(signal_t type)
Gets a nessage type name.
Definition: signal.cpp:58
static signal_t GetType(name_t name)
Finds a message type from a name.
Definition: signal.cpp:42
static signal_t Register(const char *name)
Registers a new message type.
Definition: signal.cpp:36
name_t receiver
Definition: signal.h:38
message_t message_type
Definition: signal.h:44
Type
Definition: signal.h:18
@ CLOSE
Definition: signal.h:26
@ NONE
Definition: signal.h:19
@ END_CLOSE
Definition: signal.h:28
@ EXIT_TRIGGER
Definition: signal.h:31
@ KILL
Definition: signal.h:21
@ END_OPEN
Definition: signal.h:27
@ ACTIVATE
Definition: signal.h:22
@ PROGRESS
Definition: signal.h:32
@ USE
Definition: signal.h:23
@ LAST_SIGNAL
Definition: signal.h:33
@ ENTER_TRIGGER
Definition: signal.h:30
@ SPAWN
Definition: signal.h:20
@ OPEN
Definition: signal.h:25
@ LOCKED_USE
Definition: signal.h:24
@ TRIGGER
Definition: signal.h:29
float delay
Definition: signal.h:41
void * data
Definition: signal.h:39
int limit
Definition: signal.h:42
Definition: uid.h:11