MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / applyScrolling

Method applyScrolling

game/ui/tileview/tileview.cpp:194–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void TileView::applyScrolling()
195{
196 Vec3<float> newPos = this->centerPos;
197 if (this->viewMode == TileViewMode::Isometric)
198 {
199 if (scrollLeftKB || scrollLeftM)
200 {
201 newPos.x -= isoScrollSpeed.x;
202 newPos.y += isoScrollSpeed.y;
203 }
204 if (scrollRightKB || scrollRightM)
205 {
206 newPos.x += isoScrollSpeed.x;
207 newPos.y -= isoScrollSpeed.y;
208 }
209 if (scrollUpKB || scrollUpM)
210 {
211 newPos.y -= isoScrollSpeed.y;
212 newPos.x -= isoScrollSpeed.x;
213 }
214 if (scrollDownKB || scrollDownM)
215 {
216 newPos.y += isoScrollSpeed.y;
217 newPos.x += isoScrollSpeed.x;
218 }
219 }
220 else if (this->viewMode == TileViewMode::Strategy)
221 {
222 if (scrollLeftKB || scrollLeftM)
223 newPos.x -= stratScrollSpeed.x;
224 if (scrollRightKB || scrollRightM)
225 newPos.x += stratScrollSpeed.x;
226 if (scrollUpKB || scrollUpM)
227 newPos.y -= stratScrollSpeed.y;
228 if (scrollDownKB || scrollDownM)
229 newPos.y += stratScrollSpeed.y;
230 }
231 else
232 {
233 LogError("Unknown view mode");
234 }
235
236 this->setScreenCenterTile(newPos);
237}
238
239void TileView::renderStrategyOverlay(Renderer &r)
240{

Callers

nothing calls this directly

Calls 1

setScreenCenterTileMethod · 0.95

Tested by

no test coverage detected