MegaWiFi 1.5
MegaWiFi API documentation
gamejolt.h File Reference

GameJolt Game API implementation for MegaWiFi. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  gj_trophy
 Holds the data of a single trophy. More...
 
struct  gj_time
 Holds the date/time from server. More...
 
struct  gj_score
 Holds data of a single score. More...
 
struct  gj_score_table
 Holds data of a single score table. More...
 
struct  gj_user
 Holds user data. More...
 

Macros

#define GJ_TROPHY_RESPONSE_TABLE(X_MACRO)
 Reply fields to a trophy fetch request. More...
 
#define GJ_TIME_RESPONSE_TABLE(X_MACRO)
 Reply fields to a time fetch request. More...
 
#define GJ_SCORE_RESPONSE_TABLE(X_MACRO)
 Reply field to a scores fetch request. More...
 
#define GJ_SCORE_TABLE_RESPONSE_TABLE(X_MACRO)
 Reply fields to a scores tables request. More...
 
#define GJ_SCORE_GETRANK_RESPONSE_TABLE(X_MACRO)
 Reply fields to a scores get-rank request. More...
 
#define GJ_USER_RESPONSE_TABLE(X_MACRO)
 Reply fields to a users fetch request. More...
 
#define X_AS_STRUCT(field, decoder, type)    type field;
 Expands a response table as a structure with its fields. More...
 

Enumerations

enum  gj_error
 Module error codes. More...
 
enum  gj_trophy_difficulty
 Difficulty to achieve the trophy. More...
 
enum  gj_data_store_update_operation
 Operations supported by gj_data_store_update() function. More...
 

Functions

bool gj_init (const char *endpoint, const char *game_id, const char *private_key, const char *username, const char *user_token, char *reply_buf, uint16_t buf_len, uint16_t tout_frames)
 Initialize the GameJolt API. More...
 
enum gj_error gj_get_error (void)
 Return the last error code. More...
 
char * gj_trophies_fetch (bool achieved, const char *trophy_id)
 Fetch player trophies. More...
 
char * gj_trophy_get_next (char *pos, struct gj_trophy *trophy)
 Decode the trophy raw data for the next entry. More...
 
bool gj_trophy_add_achieved (const char *trophy_id)
 Mark a trophy as achieved. More...
 
bool gj_trophy_remove_achieved (const char *trophy_id)
 Mark a trophy as not achieved. More...
 
const char * gj_trophy_difficulty_str (enum gj_trophy_difficulty difficulty)
 Get the string corresponding to a trophy difficulty. More...
 
bool gj_time (struct gj_time *time)
 Get the date and time from server. More...
 
char * gj_scores_fetch (const char *limit, const char *table_id, const char *guest, const char *better_than, const char *worse_than, bool only_user)
 Fetch scores data. More...
 
char * gj_score_get_next (char *pos, struct gj_score *score)
 Decode the score raw data for the next entry. More...
 
char * gj_scores_tables_fetch (void)
 Fetch score tables. More...
 
char * gj_score_table_get_next (char *pos, struct gj_score_table *score_table)
 Decode the score tables raw data for the next entry. More...
 
char * gj_scores_get_rank (const char *sort, const char *table_id)
 Get ranking corresponding to a sort parameter. More...
 
bool gj_scores_add (const char *score, const char *sort, const char *table_id, const char *guest, const char *extra_data)
 Add a score to a scoreboard. More...
 
bool gj_data_store_set (const char *key, const char *data, bool user_store)
 Sets a key/value pair in the data store. More...
 
char * gj_data_store_keys_fetch (const char *pattern, bool user_store)
 Fetch data store keys. More...
 
char * gj_data_store_key_next (char *pos, char **key)
 Decode the key data from a gj_data_store_keys_fetch() call. More...
 
char * data_store_fetch (const char *key, bool user_store)
 Retrieve data from the data store. More...
 
char * gj_data_store_update (const char *key, enum gj_data_store_update_operation operation, const char *value, bool user_store)
 Update data in the data store. More...
 
bool gj_data_store_remove (const char *key, bool user_store)
 Remove data from the data store. More...
 
bool gj_sessions_open (void)
 Open a game session for the player. More...
 
bool gj_sessions_ping (bool active)
 Ping a session, and allow setting it as active or idle. More...
 
bool gj_sessions_check (const char *username, const char *user_token)
 Checks if a user session is active in the game. More...
 
bool gj_sessions_close (void)
 Close a previously opened session. More...
 
char * gj_users_fetch (const char *username, const char *user_id)
 Get user data. More...
 
char * gj_user_get_next (char *pos, struct gj_user *user)
 Decode the user raw data for the next entry. More...
 
bool gj_users_auth (void)
 Check user credentials. More...
 
char * gj_friends_fetch (void)
 Get friends list. More...
 
char * gj_friend_get_next (char *pos, char **user_id)
 Decode the friend raw data for the next entry. More...
 
char * gj_request (const char **path, uint8_t num_paths, const char **key, const char **value, uint8_t num_kv_pairs, uint32_t *out_len)
 Generic GameJolt Game API request. More...
 

Detailed Description

GameJolt Game API implementation for MegaWiFi.

Definition in file gamejolt.h.