diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-21 13:16:25 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-21 13:16:25 -0400 |
commit | bb12ecd88fe16e4009b0d8927c5653d72972e284 (patch) | |
tree | 69e2e23b43605ffa24fe2c64251a1fab8ff0dfd7 /src/achievements_pane.cpp | |
parent | 0e69963e29fd7e3f9e4bdf876246c400d2f07f19 (diff) | |
download | lingo-ap-tracker-bb12ecd88fe16e4009b0d8927c5653d72972e284.tar.gz lingo-ap-tracker-bb12ecd88fe16e4009b0d8927c5653d72972e284.tar.bz2 lingo-ap-tracker-bb12ecd88fe16e4009b0d8927c5653d72972e284.zip |
Show list of achievements on the side
Diffstat (limited to 'src/achievements_pane.cpp')
-rw-r--r-- | src/achievements_pane.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/achievements_pane.cpp b/src/achievements_pane.cpp new file mode 100644 index 0000000..8ec3727 --- /dev/null +++ b/src/achievements_pane.cpp | |||
@@ -0,0 +1,33 @@ | |||
1 | #include "achievements_pane.h" | ||
2 | |||
3 | #include "ap_state.h" | ||
4 | #include "game_data.h" | ||
5 | |||
6 | AchievementsPane::AchievementsPane(wxWindow* parent) | ||
7 | : wxListView(parent, wxID_ANY) { | ||
8 | AppendColumn("Achievement"); | ||
9 | |||
10 | for (int panel_id : GD_GetAchievementPanels()) { | ||
11 | achievement_names_.push_back(GD_GetPanel(panel_id).achievement_name); | ||
12 | } | ||
13 | |||
14 | std::sort(std::begin(achievement_names_), std::end(achievement_names_)); | ||
15 | |||
16 | for (int i = 0; i < achievement_names_.size(); i++) { | ||
17 | InsertItem(i, achievement_names_.at(i)); | ||
18 | } | ||
19 | |||
20 | SetColumnWidth(0, wxLIST_AUTOSIZE); | ||
21 | |||
22 | UpdateIndicators(); | ||
23 | } | ||
24 | |||
25 | void AchievementsPane::UpdateIndicators() { | ||
26 | for (int i = 0; i < achievement_names_.size(); i++) { | ||
27 | if (AP_HasAchievement(achievement_names_.at(i))) { | ||
28 | SetItemTextColour(i, *wxBLACK); | ||
29 | } else { | ||
30 | SetItemTextColour(i, *wxRED); | ||
31 | } | ||
32 | } | ||
33 | } | ||