4 #include "vg/vg_steam.h"
5 #include "vg/vg_steam_utils.h"
6 #include "vg/vg_steam_networking.h"
7 #include "vg/vg_steam_auth.h"
8 #include "vg/vg_steam_http.h"
11 * We only want to use steamworks if building for the networked version,
12 * theres not much point otherwise. We mainly want steamworks for setting
13 * achievements etc.. so that includes our own server too.
15 * This file also wraps the functions and interfaces that we want to use to
16 * make them a bit easier to read, since they are the flat API they have very
17 * long names. in non-networked builds they will return default errors or do
21 static void recv_steam_warning( int severity
, const char *msg
)
24 vg_low( "%s\n", msg
);
26 vg_info( "%s\n", msg
);
29 static int steam_ready
= 0;
30 static void *hSteamNetworkingSockets
,
33 static HSteamPipe hSteamClientPipe
;
35 static int steam_init(void)
38 vg_info( "Initializing steamworks\n" );
40 if( !SteamAPI_Init() )
43 vg_error( "Steamworks failed to initialize\n" );
49 SteamAPI_ManualDispatch_Init();
51 /* Connect interfaces */
52 hSteamClientPipe
= SteamAPI_GetHSteamPipe();
53 hSteamNetworkingSockets
= SteamAPI_SteamNetworkingSockets_SteamAPI();
54 hSteamUser
= SteamAPI_SteamUser();
56 ISteamUtils
*utils
= SteamAPI_SteamUtils();
57 SteamAPI_ISteamUtils_SetWarningMessageHook( utils
, recv_steam_warning
);
60 vg_success( "\nSteamworks API running\n" );
66 static void steam_update(void)
69 steamworks_event_loop( hSteamClientPipe
);
72 static void steam_end(void *nothing
)
76 vg_info( "Shutting down\n..." );