qmlfrontend/engine_interface.h
author alfadur
Tue, 28 Mar 2023 17:53:30 +0300
changeset 15944 ccd458b08113
parent 15893 5b3beb90e1a6
child 16016 4933920eba89
permissions -rw-r--r--
add iteration overhead benchmark
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14154
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
14271
1aac8a62be6f Implement send_ipc and read_ipc in engine lib, send_ipc in frontend
unC0Rr
parents: 14154
diff changeset
     4
#include <stddef.h>
14154
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
15893
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
     7
#include "../rust/lib-hedgewars-engine/target/lib-hedgewars-engine.hpp"
15217
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
     8
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
     9
#ifndef Q_NAMESPACE
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    10
#define Q_NAMESPACE
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    11
#endif
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    12
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    13
#ifndef Q_ENUM_NS
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    14
#define Q_ENUM_NS(x)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    15
#endif
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    16
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    17
#ifndef Q_DECLARE_METATYPE
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    18
#define Q_DECLARE_METATYPE(x)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    19
#endif
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    20
14154
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    21
namespace Engine {
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    22
extern "C" {
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    23
15893
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    24
using EngineInstance = hwengine::EngineInstance;
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    25
using PreviewInfo = hwengine::PreviewInfo;
14154
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    26
15893
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    27
using hedgewars_engine_protocol_version_t =
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    28
    decltype(hwengine::hedgewars_engine_protocol_version);
14294
21be7838a127 Add advance_simulation() function to engine lib, some WIP on frontend
unc0rr
parents: 14271
diff changeset
    29
15893
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    30
using start_engine_t = decltype(hwengine::start_engine);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    31
using generate_preview_t = decltype(hwengine::generate_preview);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    32
using dispose_preview_t = decltype(hwengine::dispose_preview);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    33
using cleanup_t = decltype(hwengine::cleanup);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    34
using send_ipc_t = decltype(hwengine::send_ipc);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    35
using read_ipc_t = decltype(hwengine::read_ipc);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    36
using setup_current_gl_context_t = decltype(hwengine::setup_current_gl_context);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    37
using render_frame_t = decltype(hwengine::render_frame);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    38
using advance_simulation_t = decltype(hwengine::advance_simulation);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    39
using move_camera_t = decltype(hwengine::move_camera);
14854
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14713
diff changeset
    40
15893
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    41
using simple_event_t = decltype(hwengine::simple_event);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    42
using long_event_t = decltype(hwengine::long_event);
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    43
using positioned_event_t = decltype(hwengine::positioned_event);
14854
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14713
diff changeset
    44
15893
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    45
using SimpleEventType = hwengine::SimpleEventType;
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    46
using LongEventType = hwengine::LongEventType;
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    47
using LongEventState = hwengine::LongEventState;
5b3beb90e1a6 Implement generation of c header from rust interface, adapt qmlfrontend
unC0Rr
parents: 15891
diff changeset
    48
using PositionedEventType = hwengine::PositionedEventType;
14854
aed75d439027 Implement external events approach to input user actions into engine.
unc0rr
parents: 14713
diff changeset
    49
15217
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    50
}  // extern "C"
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    51
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    52
Q_NAMESPACE
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    53
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    54
Q_ENUM_NS(SimpleEventType)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    55
Q_ENUM_NS(LongEventType)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    56
Q_ENUM_NS(LongEventState)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    57
Q_ENUM_NS(PositionedEventType)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    58
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    59
};  // namespace
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    60
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    61
Q_DECLARE_METATYPE(Engine::SimpleEventType)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    62
Q_DECLARE_METATYPE(Engine::LongEventType)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    63
Q_DECLARE_METATYPE(Engine::LongEventState)
b32c52c76977 Marry C enums, Qt's metaobject system and QML
unc0rr
parents: 14854
diff changeset
    64
Q_DECLARE_METATYPE(Engine::PositionedEventType)
14154
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    65
8354b390f1a2 Some refactoring of qmlfrontend. It now shows land preview generated by hedgewars-engine
unC0Rr
parents:
diff changeset
    66
#endif  // ENGINE_H