-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
85 lines (63 loc) · 2.65 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
LibGamerzilla
Library to interact with gamerzilla plugin for hubzilla.
To build - cmake and make. To install, make install.
FOR GAME DEVELOPERS
At the start of your game call the GamerzillaStart, GamerzillaInitGame
and GamerzillaSetGame functions. The first should be called with server
argument set to false and the saveDir a directory to save achievements
when offline.
GamerzillaStart(false, "save/");
GamerzillaInitGame will clear the Gamerzilla structure which is needed
for GamerzillaSetGame. GamerzillaSetGame will make a copy of the
structure so it can be destroyed after calling the function. The
function returns a game ID which you will need to pass into other
functions.
Gamerzilla g;
GamerzillaTrophy trophy[1];
GamerzillaInitGame(&g);
g.short_name = strdup("test");
g.name = strdup("Test");
g.image = strdup("test.png");
g.version = 1;
g.numTrophy = 1;
g.trophy = trophy;
trophy[0].name = strdup("Win Game");
trophy[0].desc = strdup("Win Game");
trophy[0].max_progress = 0;
int game_id = GamerzillaSetGame(&g);
Version number must be greater than zero. You are not allowed to remove
trophies. All future versions should only add new trophies.
When the game is shutting down, you can call GamerzillaQuit to clean up
memory.
GamerzillaQuit();
During the game you can call GamerzillaSetTophy and
GamerzillaSetTophyStat to record information about trophies. Setting the
stat for a trophy sets it to a new value. If you want to add to a
previous value you will need to retrieve it with
GamerzillaGetTrophyStat.
GamerzillaSetTophy(game_id, "Win Game");
int progress;
GamerzillaGetTrophyStat(game_id, "Slayer", &progress)
GamerzillaSetTophyStat(game_id, "Slayer", progress + 2);
All of this assumes you are working offline or connecting to a local
process to update your trophies online. It is possible to connect
directly from the game instead. Before you call GamerzillaGameInit, you
must call GamerzillaConnect.
GamerzillaConnect("http://yourhuzilla.com/", "username", "password");
The recommended use to a local game manager instead of connecting
directly.
FOR GAME MANAGERS
The interface for game managers is not entirely fleshed out yet. You
will need to call GamerzillaInit. The first argument is true and the
second will store all trophy information when offline.
GamerzillaStart(true, "./server/");
Assuming you want to update online information, you will then need to
call GamerzillaConnect.
GamerzillaConnect("http://yourhuzilla.com/", "username", "password");
After that you must periodically call the GamerzillaServerProcess
function. You could dedicate a thread to performing this task or call it
will a timeout value.
while (true)
{
GamerzillaServerProcess(NULL);
}