qmlFrontend/flib.h
author unc0rr
Wed, 25 Nov 2015 22:10:01 +0300
branchqmlfrontend
changeset 11431 80a9b14bb8d3
parent 11430 f88b3948adf3
child 11433 bca9afcc3a72
permissions -rw-r--r--
Some game config methods and signals
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 {
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    11
    MSG_PREVIEW
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
    12
    , 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
    13
    , 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
    14
    , 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
    15
    , MSG_REMOVETEAM
10452
03519fd9f98d Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents: 10450
diff changeset
    16
    , MSG_TEAMCOLOR
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents: 10896
diff changeset
    17
    , MSG_NETDATA
11415
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    18
    , MSG_CONNECTED
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    19
    , MSG_DISCONNECTED
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    20
    , MSG_ADDLOBBYCLIENT
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    21
    , MSG_REMOVELOBBYCLIENT
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 10951
diff changeset
    22
    , MSG_LOBBYCHATLINE
11424
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    23
    , MSG_ADDROOMCLIENT
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    24
    , MSG_REMOVEROOMCLIENT
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    25
    , MSG_ROOMCHATLINE
11418
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11416
diff changeset
    26
    , MSG_ADDROOM
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11416
diff changeset
    27
    , MSG_UPDATEROOM
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11416
diff changeset
    28
    , MSG_REMOVEROOM
11423
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11418
diff changeset
    29
    , MSG_ERROR
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11418
diff changeset
    30
    , MSG_WARNING
11424
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    31
    , MSG_MOVETOLOBBY
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    32
    , MSG_MOVETOROOM
11430
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11424
diff changeset
    33
    , MSG_NICKNAME
11431
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11430
diff changeset
    34
    , MSG_SEED
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11430
diff changeset
    35
    , MSG_THEME
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11430
diff changeset
    36
    , MSG_SCRIPT
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    37
};
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    38
10416
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    39
typedef union string255_
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    40
    {
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    41
        struct {
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    42
            unsigned char s[256];
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    43
        };
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    44
        struct {
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    45
            unsigned char len;
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    46
            unsigned char str[255];
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    47
        };
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    48
    } string255;
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    49
10418
091d2c0216c3 Move away from passing shortstrings into C code, now IPC works
unc0rr
parents: 10416
diff changeset
    50
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
    51
typedef void registerUIMessagesCallback_t(void * context, void (*)(void * context, MessageType mt, const char * msg, uint32_t len));
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    52
typedef void getPreview_t();
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    53
typedef void runQuickGame_t();
10448
4cb727e029fa - Allow to delete teams from config
unc0rr
parents: 10444
diff changeset
    54
typedef void runLocalGame_t();
10450
bf9e30b4ef9b - Store index of color instead of its value
unc0rr
parents: 10448
diff changeset
    55
typedef void resetGameConfig_t();
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    56
typedef void setSeed_t(const char * seed);
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    57
typedef char *getSeed_t();
10612
eb3c1a289a23 Script combobox.wiki
unc0rr
parents: 10517
diff changeset
    58
typedef void setTheme_t(const char * themeName);
eb3c1a289a23 Script combobox.wiki
unc0rr
parents: 10517
diff changeset
    59
typedef void setScript_t(const char * scriptName);
10819
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10616
diff changeset
    60
typedef void setScheme_t(const char * schemeName);
10888
a04e04aaf599 Ammo schemes list, almost works
unc0rr
parents: 10819
diff changeset
    61
typedef void setAmmo_t(const char * ammoName);
10424
4be6cd55f1cf - Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents: 10420
diff changeset
    62
typedef void flibInit_t(const char * localPrefix, const char * userPrefix);
4be6cd55f1cf - Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents: 10420
diff changeset
    63
typedef void flibFree_t();
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents: 10896
diff changeset
    64
typedef void passNetData_t(const char * data);
11416
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11415
diff changeset
    65
typedef void sendChatLine_t(const char * msg);
11423
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11418
diff changeset
    66
typedef void joinRoom_t(const char * roomName);
11424
86c13e5662f1 - Some refactoring
unc0rr
parents: 11423
diff changeset
    67
typedef void partRoom_t(const char * message);
10416
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    68
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents: 10432
diff changeset
    69
typedef char **getThemesList_t();
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents: 10432
diff changeset
    70
typedef void freeThemesList_t(char **list);
10436
084e046f6bd5 flib provides theme icons, qmlFrontend shows them
unc0rr
parents: 10434
diff changeset
    71
typedef uint32_t getThemeIcon_t(char * theme, char * buffer, uint32_t size);
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents: 10432
diff changeset
    72
10517
844bd43db47a getScriptsList implementation
unc0rr
parents: 10456
diff changeset
    73
typedef char **getScriptsList_t();
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents: 10612
diff changeset
    74
typedef char **getSchemesList_t();
10888
a04e04aaf599 Ammo schemes list, almost works
unc0rr
parents: 10819
diff changeset
    75
typedef char **getAmmosList_t();
10517
844bd43db47a getScriptsList implementation
unc0rr
parents: 10456
diff changeset
    76
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10436
diff changeset
    77
typedef char **getTeamsList_t();
10452
03519fd9f98d Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents: 10450
diff changeset
    78
typedef void tryAddTeam_t(const char * teamName);
03519fd9f98d Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents: 10450
diff changeset
    79
typedef void tryRemoveTeam_t(const char * teamName);
03519fd9f98d Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents: 10450
diff changeset
    80
typedef void changeTeamColor_t(const char * teamName, int32_t dir);
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10436
diff changeset
    81
10896
5a74923120d5 Start network support: only setting up a connection for now
unc0rr
parents: 10888
diff changeset
    82
typedef void connectOfficialServer_t();
5a74923120d5 Start network support: only setting up a connection for now
unc0rr
parents: 10888
diff changeset
    83
10416
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    84
#ifdef __cplusplus
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    85
}
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    86
#endif
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    87
1c301054694d - Remove --port command
unc0rr
parents:
diff changeset
    88
#endif // FLIB_H