|
8 | 8 | #include "json/json.h" |
9 | 9 |
|
10 | 10 | ProfileViewer::ProfileViewer(std::string profileName): |
11 | | - Window_(Point(CENTERED, CENTERED), Point(260, 350)), |
| 11 | + ScrollWindow(Point(CENTERED, CENTERED), Point(260, 350)), |
12 | 12 | name(profileName), |
13 | 13 | avatar(NULL), |
14 | 14 | ageLabel(NULL), |
@@ -81,6 +81,8 @@ void ProfileViewer::OnTick(float dt) |
81 | 81 | this->AddComponent(locationLabel); |
82 | 82 | this->AddComponent(websiteLabel); |
83 | 83 | this->AddComponent(biographyLabel); |
| 84 | + if (biographyLabel->GetSize().Y+115 > this->GetSize().Y) |
| 85 | + this->SetScrollable(true, biographyLabel->GetSize().Y+117-this->GetSize().Y*2); |
84 | 86 |
|
85 | 87 | // If we don't do this average score will have a ton of decimal points, round to 2 here |
86 | 88 | float average = root["User"]["Saves"]["AverageScore"].asFloat(); |
@@ -128,13 +130,13 @@ void ProfileViewer::OnTick(float dt) |
128 | 130 | void ProfileViewer::OnDraw(VideoBuffer *buf) |
129 | 131 | { |
130 | 132 | if (avatar) |
131 | | - buf->DrawImage(avatar, 210, 10, 40, 40); |
132 | | - buf->DrawText(10, 22, "Age:", 175, 175, 175, 255); |
133 | | - buf->DrawText(10, 34, "Location:", 175, 175, 175, 255); |
134 | | - buf->DrawText(10, 46, "Website:", 175, 175, 175, 255); |
135 | | - buf->DrawText(10, 58, "Saves:", 175, 175, 175, 255); |
136 | | - buf->DrawText(15, 70, "Count:", 175, 175, 175, 255); |
137 | | - buf->DrawText(15, 82, "Average Score:", 175, 175, 175, 255); |
138 | | - buf->DrawText(15, 94, "Highest Score:", 175, 175, 175, 255); |
139 | | - buf->DrawText(10, 106, "Biography:", 175, 175, 175, 255); |
| 133 | + buf->DrawImage(avatar, 210, 10-GetScrollPosition(), 40, 40); |
| 134 | + buf->DrawText(10, 22-GetScrollPosition(), "Age:", 175, 175, 175, 255); |
| 135 | + buf->DrawText(10, 34-GetScrollPosition(), "Location:", 175, 175, 175, 255); |
| 136 | + buf->DrawText(10, 46-GetScrollPosition(), "Website:", 175, 175, 175, 255); |
| 137 | + buf->DrawText(10, 58-GetScrollPosition(), "Saves:", 175, 175, 175, 255); |
| 138 | + buf->DrawText(15, 70-GetScrollPosition(), "Count:", 175, 175, 175, 255); |
| 139 | + buf->DrawText(15, 82-GetScrollPosition(), "Average Score:", 175, 175, 175, 255); |
| 140 | + buf->DrawText(15, 94-GetScrollPosition(), "Highest Score:", 175, 175, 175, 255); |
| 141 | + buf->DrawText(10, 106-GetScrollPosition(), "Biography:", 175, 175, 175, 255); |
140 | 142 | } |
0 commit comments