author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 06 May 2019 01:25:50 +0200 | |
changeset 14909 | b5a9dd36c7ea |
parent 14875 | aed75d439027 |
child 15238 | b32c52c76977 |
permissions | -rw-r--r-- |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
1 |
#ifndef ENGINE_H |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
2 |
#define ENGINE_H |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
3 |
|
14292
1aac8a62be6f
Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents:
14175
diff
changeset
|
4 |
#include <stddef.h> |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
5 |
#include <stdint.h> |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
6 |
|
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
7 |
#ifdef __cplusplus |
14875
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
8 |
#define ENUM_CLASS enum |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
9 |
namespace Engine { |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
10 |
extern "C" { |
14875
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
11 |
#else |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
12 |
#define ENUM_CLASS enum |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
13 |
#endif |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
14 |
|
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
15 |
typedef struct _EngineInstance EngineInstance; |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
16 |
|
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
17 |
typedef struct { |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
18 |
uint32_t width; |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
19 |
uint32_t height; |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
20 |
uint8_t hedgehogs_number; |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
21 |
unsigned char* land; |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
22 |
} PreviewInfo; |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
23 |
|
14391
ef2fc0210362
Rename protocol_version to hedgewars_engine_protocol_version to ensure use of correct library
unC0Rr
parents:
14319
diff
changeset
|
24 |
typedef uint32_t hedgewars_engine_protocol_version_t(); |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
25 |
typedef EngineInstance* start_engine_t(); |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
26 |
typedef void generate_preview_t(EngineInstance* engine_state, |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
27 |
PreviewInfo* preview); |
14394
4409344db447
Rework EngineInstance::generatePreview, add preview cleanup function in enginelib
unC0Rr
parents:
14393
diff
changeset
|
28 |
typedef void dispose_preview_t(EngineInstance* engine_state); |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
29 |
typedef void cleanup_t(EngineInstance* engine_state); |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
30 |
|
14292
1aac8a62be6f
Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents:
14175
diff
changeset
|
31 |
typedef void send_ipc_t(EngineInstance* engine_state, uint8_t* buf, |
1aac8a62be6f
Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents:
14175
diff
changeset
|
32 |
size_t size); |
1aac8a62be6f
Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents:
14175
diff
changeset
|
33 |
typedef size_t read_ipc_t(EngineInstance* engine_state, uint8_t* buf, |
1aac8a62be6f
Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents:
14175
diff
changeset
|
34 |
size_t size); |
1aac8a62be6f
Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents:
14175
diff
changeset
|
35 |
|
14315
21be7838a127
Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents:
14292
diff
changeset
|
36 |
typedef void setup_current_gl_context_t(EngineInstance* engine_state, |
21be7838a127
Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents:
14292
diff
changeset
|
37 |
uint16_t width, uint16_t height, |
14319 | 38 |
void (*(const char*))()); |
14315
21be7838a127
Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents:
14292
diff
changeset
|
39 |
typedef void render_frame_t(EngineInstance* engine_state); |
21be7838a127
Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents:
14292
diff
changeset
|
40 |
|
21be7838a127
Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents:
14292
diff
changeset
|
41 |
typedef bool advance_simulation_t(EngineInstance* engine_state, uint32_t ticks); |
21be7838a127
Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents:
14292
diff
changeset
|
42 |
|
14734 | 43 |
typedef void move_camera_t(EngineInstance* engine_state, int32_t delta_x, |
44 |
int32_t delta_y); |
|
45 |
||
14875
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
46 |
ENUM_CLASS SimpleEventType{ |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
47 |
SwitchHedgehog, Timer, LongJump, HighJump, Accept, Deny, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
48 |
}; |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
49 |
|
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
50 |
ENUM_CLASS LongEventType{ |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
51 |
ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Precision, Attack, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
52 |
}; |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
53 |
|
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
54 |
ENUM_CLASS LongEventState{ |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
55 |
Set, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
56 |
Unset, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
57 |
}; |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
58 |
|
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
59 |
ENUM_CLASS PositionedEventType{ |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
60 |
CursorMove, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
61 |
CursorClick, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
62 |
}; |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
63 |
|
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
64 |
typedef void simple_event_t(EngineInstance* engine_state, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
65 |
SimpleEventType event_type); |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
66 |
typedef void long_event_t(EngineInstance* engine_state, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
67 |
LongEventType event_type, LongEventState state); |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
68 |
typedef void positioned_event_t(EngineInstance* engine_state, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
69 |
PositionedEventType event_type, int32_t x, |
aed75d439027
Implement external events approach to input user actions into engine.
unc0rr
parents:
14734
diff
changeset
|
70 |
int32_t y); |
14175
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
71 |
#ifdef __cplusplus |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
72 |
} |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
73 |
}; |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
74 |
#endif |
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
75 |
|
8354b390f1a2
Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff
changeset
|
76 |
#endif // ENGINE_H |