qmlfrontend/engine_interface.h
author alfadur
Wed, 10 Apr 2019 16:14:33 +0300
changeset 14803 50fcef24003f
parent 14734 cc6ab1e3f7d5
child 14875 aed75d439027
permissions -rw-r--r--
add typed protocol flags
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
     8
namespace Engine {
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
     9
extern "C" {
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    10
#endif
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    11
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    12
typedef struct _EngineInstance EngineInstance;
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    13
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    14
typedef struct {
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    15
  uint32_t width;
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    16
  uint32_t height;
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    17
  uint8_t hedgehogs_number;
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    18
  unsigned char* land;
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    19
} PreviewInfo;
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    20
14391
ef2fc0210362 Rename protocol_version to hedgewars_engine_protocol_version to ensure use of correct library
unC0Rr
parents: 14319
diff changeset
    21
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
    22
typedef EngineInstance* start_engine_t();
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    23
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
    24
                                PreviewInfo* preview);
14394
4409344db447 Rework EngineInstance::generatePreview, add preview cleanup function in enginelib
unC0Rr
parents: 14393
diff changeset
    25
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
    26
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
    27
14292
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14175
diff changeset
    28
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
    29
                        size_t size);
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14175
diff changeset
    30
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
    31
                          size_t size);
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14175
diff changeset
    32
14315
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14292
diff changeset
    33
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
    34
                                        uint16_t width, uint16_t height,
14319
00b56ec8b7df Pass opengl context to engine
unC0Rr
parents: 14315
diff changeset
    35
                                        void (*(const char*))());
14315
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14292
diff changeset
    36
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
    37
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14292
diff changeset
    38
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
    39
14734
cc6ab1e3f7d5 Allow to move camera around
unc0rr
parents: 14394
diff changeset
    40
typedef void move_camera_t(EngineInstance* engine_state, int32_t delta_x,
cc6ab1e3f7d5 Allow to move camera around
unc0rr
parents: 14394
diff changeset
    41
                           int32_t delta_y);
cc6ab1e3f7d5 Allow to move camera around
unc0rr
parents: 14394
diff changeset
    42
14175
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    43
#ifdef __cplusplus
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    44
}
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    45
};
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    46
#endif
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    47
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    48
#endif  // ENGINE_H