qmlfrontend/engine_interface.h
author KoBeWi
Sat, 29 Jun 2019 19:05:50 +0200
changeset 15202 30117eeea7b7
parent 14859 aed75d439027
child 15222 b32c52c76977
permissions -rw-r--r--
Update Polish translation: Lua 100%, update pl.txt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14159
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
14276
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14159
diff changeset
     4
#include <stddef.h>
14159
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
14859
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
     8
#define ENUM_CLASS enum
14159
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" {
14859
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    11
#else
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    12
#define ENUM_CLASS enum
14159
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
14375
ef2fc0210362 Rename protocol_version to hedgewars_engine_protocol_version to ensure use of correct library
unC0Rr
parents: 14303
diff changeset
    24
typedef uint32_t hedgewars_engine_protocol_version_t();
14159
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);
14378
4409344db447 Rework EngineInstance::generatePreview, add preview cleanup function in enginelib
unC0Rr
parents: 14377
diff changeset
    28
typedef void dispose_preview_t(EngineInstance* engine_state);
14159
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
14276
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14159
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: 14159
diff changeset
    32
                        size_t size);
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14159
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: 14159
diff changeset
    34
                          size_t size);
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14159
diff changeset
    35
14299
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14276
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: 14276
diff changeset
    37
                                        uint16_t width, uint16_t height,
14303
00b56ec8b7df Pass opengl context to engine
unC0Rr
parents: 14299
diff changeset
    38
                                        void (*(const char*))());
14299
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14276
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: 14276
diff changeset
    40
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14276
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: 14276
diff changeset
    42
14718
cc6ab1e3f7d5 Allow to move camera around
unc0rr
parents: 14378
diff changeset
    43
typedef void move_camera_t(EngineInstance* engine_state, int32_t delta_x,
cc6ab1e3f7d5 Allow to move camera around
unc0rr
parents: 14378
diff changeset
    44
                           int32_t delta_y);
cc6ab1e3f7d5 Allow to move camera around
unc0rr
parents: 14378
diff changeset
    45
14859
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    46
ENUM_CLASS SimpleEventType{
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    47
    SwitchHedgehog, Timer, LongJump, HighJump, Accept, Deny,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    48
};
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    49
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    50
ENUM_CLASS LongEventType{
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    51
    ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Precision, Attack,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    52
};
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    53
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    54
ENUM_CLASS LongEventState{
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    55
    Set,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    56
    Unset,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    57
};
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    58
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    59
ENUM_CLASS PositionedEventType{
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    60
    CursorMove,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    61
    CursorClick,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    62
};
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    63
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    64
typedef void simple_event_t(EngineInstance* engine_state,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    65
                            SimpleEventType event_type);
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    66
typedef void long_event_t(EngineInstance* engine_state,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    67
                          LongEventType event_type, LongEventState state);
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    68
typedef void positioned_event_t(EngineInstance* engine_state,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    69
                                PositionedEventType event_type, int32_t x,
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14718
diff changeset
    70
                                int32_t y);
14159
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