|
JNGL
Easy to use cross-platform 2D game library
|
Represents one unlockable Achievement (aka Trophy) More...
#include <jngl/Achievement.hpp>
Public Member Functions | |
| Achievement (std::string id, std::string name, std::string description, std::string icon, int initialValue=0, int maxValue=1) | |
| The id must match the ID you set in Steamworks (if you use Steam, otherwise it's unused). | |
| int | getValue () const |
| void | increaseValue (int by) |
Public Attributes | |
| std::string | id |
| API Name. | |
| std::string | name |
| std::string | description |
| std::string | icon |
| filename for achievement icon, will be loaded when the achievement is displayed | |
| int | maxValue |
| std::function< int(int)> | customDisplayValue |
Represents one unlockable Achievement (aka Trophy)
This struct holds all the necessary information about a specific achievement and provides integration to the Steam SDK (if available). One way to handle achievements is to create a Singleton class which holds all achievements as member variables:
Then you can unlock the achievements like this:
Definition at line 43 of file Achievement.hpp.
| std::string id |
API Name.
Definition at line 49 of file Achievement.hpp.
| std::string name |
Definition at line 51 of file Achievement.hpp.
| std::string description |
Definition at line 52 of file Achievement.hpp.
| std::string icon |
filename for achievement icon, will be loaded when the achievement is displayed
Definition at line 55 of file Achievement.hpp.
| int maxValue |
Definition at line 57 of file Achievement.hpp.
| std::function<int(int)> customDisplayValue |
Definition at line 63 of file Achievement.hpp.