; BlitzSteam - Steam wrapper for Blitz ; Copyright (C) 2015 Xaymar (Michael Fabian Dirks) ; ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU Lesser General Public License as ; published by the Free Software Foundation, either version 3 of the ; License, or (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU Lesser General Public License ; along with this program. If not, see . Include "../BlitzSteam.bb" ;---------------------------------------------------------------- ;! Configuration ;---------------------------------------------------------------- Const APPID = 480 ; Test App / SpaceWar Const FRAMERATE = 60 Const RESOLUTION_X = 1024 Const RESOLUTION_Y = 768 Const RESOLUTION_Z = 32 Const RESOLUTION_MODE = 2 ;---------------------------------------------------------------- ;! Init Code ;---------------------------------------------------------------- Global Timer = CreateTimer(FRAMERATE) Global ServerListResponse_ServerResponded_p%:ServerListResponse_ServerResponded(0, 0, 0) Global ServerListResponse_RefreshComplete_p%:ServerListResponse_RefreshComplete(0, 0, 0) Graphics3D RESOLUTION_X, RESOLUTION_Y, RESOLUTION_Z, RESOLUTION_MODE SetBuffer BackBuffer() If Not BS_SteamAPI_Init() Then RuntimeError "Failed to initialize Steam!" ;---------------------------------------------------------------- ;! Main Code ;---------------------------------------------------------------- Local Bank =CreateBank(1) Local pRequestServersResponse = BS_ISteamMatchmakingServerListResponse_New(0, ServerListResponse_ServerResponded_p, 0, ServerListResponse_RefreshComplete_p) Local hRequest = BS_ISteamMatchmakingServers_RequestInternetServerList(BS_SteamMatchmakingServers(), 480, Bank, 0, pRequestServersResponse) While Not KeyHit(1) WaitTimer Timer BS_SteamAPI_RunCallbacks() Wend BS_ISteamMatchmakingServers_ReleaseRequest(BS_SteamMatchmakingServers(), hRequest) BS_SteamAPI_Shutdown() ;---------------------------------------------------------------- ;! Functions ;---------------------------------------------------------------- Function ServerListResponse_ServerResponded(pData%, hRequest%, iServer%) If (Not ServerListResponse_ServerResponded_p) ServerListResponse_ServerResponded_p = BP_GetFunctionPointer() Return EndIf Print iServer Return End Function Function ServerListResponse_RefreshComplete(pData%, hRequest%, eMatchMakingServerResponse%) If (Not ServerListResponse_RefreshComplete_p) ServerListResponse_RefreshComplete_p = BP_GetFunctionPointer() Return EndIf Select eMatchMakingServerResponse Case BS_EMatchMakingServerResponse_ServerResponded Print "Got Servers" Case BS_EMatchMakingServerResponse_ServerFailedToRespond Print "Server did not respond" Case BS_EMatchMakingServerResponse_NoServersListedOnMasterServer Print "No Servers listed for this game." Default Print "Unknown" End Select Return End Function ;~IDEal Editor Parameters: ;~C#Blitz3D