Last active
January 16, 2018 01:22
-
-
Save Turupawn/5a8f2db420bc160978087a1ca3ef44bc to your computer and use it in GitHub Desktop.
Steamworks Delete Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "steam_api.h" | |
class CGameManager | |
{ | |
public: | |
void DeleteItem(); | |
bool finished = false; | |
PublishedFileId_t nPublishedFileID = (PublishedFileId_t) 1231783969; | |
private: | |
void onItemDeleted(DeleteItemResult_t *pCallback, bool bIOFailure); | |
CCallResult<CGameManager, DeleteItemResult_t> m_DeleteItemResult; | |
}; | |
//We delete the mod by providing it's ID | |
void CGameManager::DeleteItem() | |
{ | |
SteamAPICall_t hSteamAPICall = SteamUGC()->DeleteItem( nPublishedFileID ); | |
m_DeleteItemResult.Set(hSteamAPICall, this,&CGameManager::onItemDeleted); | |
} | |
void CGameManager::onItemDeleted(DeleteItemResult_t *pCallback, bool bIOFailure) | |
{ | |
if(pCallback->m_eResult == k_EResultOK && !bIOFailure) | |
{ | |
std::cout << "Item deleted" << std::endl; | |
} | |
finished = true; | |
} | |
int main() | |
{ | |
if(SteamAPI_Init()) | |
{ | |
CGameManager gameManager; | |
gameManager.DeleteItem(); | |
while(!gameManager.finished) | |
{ | |
SteamAPI_RunCallbacks(); | |
} | |
} | |
std::cout << "Process finished" << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment