about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-01 17:54:50 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-01 17:54:50 -0400
commit9798316b43773e4c7d15851202977a3069f28577 (patch)
tree143b3b356dd577d32228550a176f317157842865
parentd7eb71dc931c812b57d39566f71069a51cb66f4d (diff)
downloadlingo-ap-tracker-9798316b43773e4c7d15851202977a3069f28577.tar.gz
lingo-ap-tracker-9798316b43773e4c7d15851202977a3069f28577.tar.bz2
lingo-ap-tracker-9798316b43773e4c7d15851202977a3069f28577.zip
Added map background
-rw-r--r--CMakeLists.txt1
-rwxr-xr-xassets/lingo_map.pngbin0 -> 396452 bytes
-rw-r--r--tracker_frame.cpp6
-rw-r--r--tracker_panel.cpp27
-rw-r--r--tracker_panel.h23
5 files changed, 57 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index dffa7ab..cb5cf25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -9,6 +9,7 @@ include(${wxWidgets_USE_FILE})
9add_executable(lingo_ap_tracker 9add_executable(lingo_ap_tracker
10 main.cpp 10 main.cpp
11 tracker_frame.cpp 11 tracker_frame.cpp
12 tracker_panel.cpp
12) 13)
13set_property(TARGET lingo_ap_tracker PROPERTY CXX_STANDARD 17) 14set_property(TARGET lingo_ap_tracker PROPERTY CXX_STANDARD 17)
14set_property(TARGET lingo_ap_tracker PROPERTY CXX_STANDARD_REQUIRED ON) 15set_property(TARGET lingo_ap_tracker PROPERTY CXX_STANDARD_REQUIRED ON)
diff --git a/assets/lingo_map.png b/assets/lingo_map.png new file mode 100755 index 0000000..73486af --- /dev/null +++ b/assets/lingo_map.png
Binary files differ
diff --git a/tracker_frame.cpp b/tracker_frame.cpp index 83f42a6..0c3827e 100644 --- a/tracker_frame.cpp +++ b/tracker_frame.cpp
@@ -1,7 +1,11 @@
1#include "tracker_frame.h" 1#include "tracker_frame.h"
2 2
3#include "tracker_panel.h"
4
3TrackerFrame::TrackerFrame() 5TrackerFrame::TrackerFrame()
4 : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") { 6 : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") {
7 ::wxInitAllImageHandlers();
8
5 wxMenu *menuFile = new wxMenu(); 9 wxMenu *menuFile = new wxMenu();
6 menuFile->Append(wxID_EXIT); 10 menuFile->Append(wxID_EXIT);
7 11
@@ -19,6 +23,8 @@ TrackerFrame::TrackerFrame()
19 23
20 Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT); 24 Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT);
21 Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT); 25 Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT);
26
27 new TrackerPanel(this);
22} 28}
23 29
24void TrackerFrame::OnAbout(wxCommandEvent &event) { 30void TrackerFrame::OnAbout(wxCommandEvent &event) {
diff --git a/tracker_panel.cpp b/tracker_panel.cpp new file mode 100644 index 0000000..74bf605 --- /dev/null +++ b/tracker_panel.cpp
@@ -0,0 +1,27 @@
1#include "tracker_panel.h"
2
3TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) {
4 map_image_ = wxImage("assets/lingo_map.png", wxBITMAP_TYPE_PNG);
5 if (!map_image_.IsOk()) {
6 return;
7 }
8
9 Redraw();
10
11 Bind(wxEVT_PAINT, &TrackerPanel::OnPaint, this);
12}
13
14void TrackerPanel::OnPaint(wxPaintEvent &event) {
15 if (GetSize() != rendered_.GetSize()) {
16 Redraw();
17 }
18
19 wxPaintDC dc(this);
20 dc.DrawBitmap(rendered_, 0, 0);
21}
22
23void TrackerPanel::Redraw() {
24 wxSize sz = GetSize();
25 rendered_ = wxBitmap(
26 map_image_.Scale(sz.GetWidth(), sz.GetHeight(), wxIMAGE_QUALITY_NORMAL));
27}
diff --git a/tracker_panel.h b/tracker_panel.h new file mode 100644 index 0000000..49b4d23 --- /dev/null +++ b/tracker_panel.h
@@ -0,0 +1,23 @@
1#ifndef TRACKER_PANEL_H_D675A54D
2#define TRACKER_PANEL_H_D675A54D
3
4#include <wx/wxprec.h>
5
6#ifndef WX_PRECOMP
7#include <wx/wx.h>
8#endif
9
10class TrackerPanel : public wxPanel {
11public:
12 TrackerPanel(wxWindow *parent);
13
14private:
15 void OnPaint(wxPaintEvent &event);
16
17 void Redraw();
18
19 wxImage map_image_;
20 wxBitmap rendered_;
21};
22
23#endif /* end of include guard: TRACKER_PANEL_H_D675A54D */