Add a basic achievements manager.

This commit is contained in:
Bartosz Taudul 2024-06-06 18:06:15 +02:00
parent f6f8fb3d27
commit 8051ceaa43
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 59 additions and 0 deletions

View File

@ -22,6 +22,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/../cmake/vendor.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/server.cmake) include(${CMAKE_CURRENT_LIST_DIR}/../cmake/server.cmake)
set(SERVER_FILES set(SERVER_FILES
TracyAchievements.cpp
TracyBadVersion.cpp TracyBadVersion.cpp
TracyColor.cpp TracyColor.cpp
TracyEventDebug.cpp TracyEventDebug.cpp

View File

@ -0,0 +1,32 @@
#include <assert.h>
#include "TracyAchievements.hpp"
namespace tracy
{
AchievementsMgr::AchievementsMgr()
{
m_queue.emplace_back( "Discover achievements!" );
m_queue.emplace_back( "Achievements are fun!" );
m_queue.emplace_back( "The new beginnings are always the best!" );
}
const std::string* AchievementsMgr::GetNextQueue()
{
if( m_queue.empty() ) return nullptr;
return &m_queue.front();
}
void AchievementsMgr::PopQueue()
{
assert( !m_queue.empty() );
m_queue.erase( m_queue.begin() );
}
bool AchievementsMgr::NeedsUpdates() const
{
return !m_queue.empty();
}
}

View File

@ -0,0 +1,26 @@
#ifndef __TRACYACHIEVEMENTS_HPP__
#define __TRACYACHIEVEMENTS_HPP__
#include <string>
#include <vector>
namespace tracy
{
class AchievementsMgr
{
public:
AchievementsMgr();
const std::string* GetNextQueue();
void PopQueue();
bool NeedsUpdates() const;
private:
std::vector<std::string> m_queue;
};
}
#endif