qmlfrontend/flib.h
author unc0rr
Fri, 22 Dec 2017 23:59:03 +0100
branchqmlfrontend
changeset 12857 90f927b4b9e1
parent 11842 qmlFrontend/flib.h@93e6c401cc3d
child 12858 0c6fb706f747
permissions -rw-r--r--
Start hacking new frontend
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10416
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     1
#ifndef FLIB_H
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     2
#define FLIB_H
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     3
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     4
#include <stdint.h>
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     5
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     6
#ifdef __cplusplus
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     7
extern "C" {
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     8
#endif
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
     9
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    10
enum MessageType {
11434
23912c93935a - Implement engine runs queue
unc0rr
parents: 11433
diff changeset
    11
    MSG_RENDERINGPREVIEW
23912c93935a - Implement engine runs queue
unc0rr
parents: 11433
diff changeset
    12
    , MSG_PREVIEW
11827
8c71c5a1172f - Add state to engine callback for it to know what engine is sending
unc0rr
parents: 11443
diff changeset
    13
    , MSG_PREVIEWHOGCOUNT
10444
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10440
diff changeset
    14
    , MSG_ADDPLAYINGTEAM
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10440
diff changeset
    15
    , MSG_REMOVEPLAYINGTEAM
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10440
diff changeset
    16
    , MSG_ADDTEAM
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10440
diff changeset
    17
    , MSG_REMOVETEAM
10452
03519fd9f98d Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents: 10450
diff changeset
    18
    , MSG_TEAMCOLOR
11443
5182d44fb733 - Hedgehogs number display
unc0rr
parents: 11440
diff changeset
    19
    , MSG_HEDGEHOGSNUMBER
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents: 10896
diff changeset
    20
    , MSG_NETDATA
11842
93e6c401cc3d Preparation to sending engine messages to net.
unc0rr
parents: 11827
diff changeset
    21
    , MSG_TONET
11434
23912c93935a - Implement engine runs queue
unc0rr
parents: 11433
diff changeset
    22
    , MSG_FLIBEVENT
11415
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    23
    , MSG_CONNECTED
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    24
    , MSG_DISCONNECTED
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    25
    , MSG_ADDLOBBYCLIENT
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    26
    , MSG_REMOVELOBBYCLIENT
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    27
    , MSG_LOBBYCHATLINE
11424
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    28
    , MSG_ADDROOMCLIENT
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    29
    , MSG_REMOVEROOMCLIENT
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    30
    , MSG_ROOMCHATLINE
11418
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11416
diff changeset
    31
    , MSG_ADDROOM
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11416
diff changeset
    32
    , MSG_UPDATEROOM
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11416
diff changeset
    33
    , MSG_REMOVEROOM
11423
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11418
diff changeset
    34
    , MSG_ERROR
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11418
diff changeset
    35
    , MSG_WARNING
11424
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    36
    , MSG_MOVETOLOBBY
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    37
    , MSG_MOVETOROOM
11430
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11424
diff changeset
    38
    , MSG_NICKNAME
11431
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11430
diff changeset
    39
    , MSG_SEED
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11430
diff changeset
    40
    , MSG_THEME
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11430
diff changeset
    41
    , MSG_SCRIPT
11433
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11431
diff changeset
    42
    , MSG_FEATURESIZE
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11431
diff changeset
    43
    , MSG_MAPGEN
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11431
diff changeset
    44
    , MSG_MAP
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11431
diff changeset
    45
    , MSG_MAZESIZE
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11431
diff changeset
    46
    , MSG_TEMPLATE
11437
6e641b5453f9 Accept ammo scheme from network
unc0rr
parents: 11434
diff changeset
    47
    , MSG_AMMO
11440
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11437
diff changeset
    48
    , MSG_SCHEME
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    49
};
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    50
10416
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    51
typedef union string255_
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    52
    {
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    53
        struct {
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    54
            unsigned char s[256];
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    55
        };
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    56
        struct {
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    57
            unsigned char len;
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    58
            unsigned char str[255];
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    59
        };
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    60
    } string255;
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    61
10418
091d2c0216c3 Move away from passing shortstrings into C code, now IPC works
unc0rr
parents: 10416
diff changeset
    62
typedef void RunEngine_t(int argc, const char ** argv);
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents: 10896
diff changeset
    63
typedef void registerUIMessagesCallback_t(void * context, void (*)(void * context, MessageType mt, const char * msg, uint32_t len));
10424
4be6cd55f1cf - Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents: 10420
diff changeset
    64
typedef void flibInit_t(const char * localPrefix, const char * userPrefix);
4be6cd55f1cf - Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents: 10420
diff changeset
    65
typedef void flibFree_t();
11434
23912c93935a - Implement engine runs queue
unc0rr
parents: 11433
diff changeset
    66
typedef void passFlibEvent_t(const char * data);
10896
5a74923120d5 Start network support: only setting up a connection for now
unc0rr
parents: 10888
diff changeset
    67
10416
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    68
#ifdef __cplusplus
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    69
}
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    70
#endif
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    71
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    72
#endif // FLIB_H