JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
jngl
Achievement.hpp
Go to the documentation of this file.
1
// Copyright 2023-2025 Jan Niklas Hasse <jhasse@bixense.com>
2
// For conditions of distribution and use, see copyright notice in LICENSE.txt
5
#pragma once
6
7
#include <
functional
>
8
#include <
string
>
9
10
namespace
jngl
{
11
12
class
Sprite
;
13
43
struct
Achievement
{
45
Achievement
(
std::string
id
,
std::string
name,
std::string
description,
std::string
icon
,
46
int
initialValue = 0,
int
maxValue = 1);
47
49
std::string
id
;
50
51
std::string
name;
52
std::string
description;
53
55
std::string
icon
;
56
57
int
maxValue;
58
59
int
getValue()
const
;
60
void
increaseValue(
int
by);
61
62
// if set "customDisplayValue(<value>) of customDisplayValue(<maxValue>)" will be displayed
63
std::function
<int(
int
)> customDisplayValue;
64
65
private
:
66
int
value;
67
};
68
69
}
// namespace jngl
std::string
jngl::Sprite
Higher-level representation of an image.
Definition
Sprite.hpp:26
std::function
functional
jngl
JNGL's main namespace.
Definition
Achievement.hpp:10
string
jngl::Achievement
Represents one unlockable Achievement (aka Trophy)
Definition
Achievement.hpp:43
jngl::Achievement::Achievement
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).
jngl::Achievement::icon
std::string icon
filename for achievement icon, will be loaded when the achievement is displayed
Definition
Achievement.hpp:55
jngl::Achievement::id
std::string id
API Name.
Definition
Achievement.hpp:49