summary refs log tree commit diff stats
path: root/src/renderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer.cpp')
-rw-r--r--src/renderer.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/renderer.cpp b/src/renderer.cpp index 139b493..87e6553 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp
@@ -299,8 +299,8 @@ void Renderer::renderGame(
299 if (!game.map.at(x,y).litTiles.count({sx, sy})) 299 if (!game.map.at(x,y).litTiles.count({sx, sy}))
300 { 300 {
301 SDL_Rect rect { 301 SDL_Rect rect {
302 (sx - leftmost) * TILE_WIDTH + xInterp, 302 (sx - leftmost) * TILE_WIDTH,
303 (sy - topmost) * TILE_HEIGHT + yInterp, 303 (sy - topmost) * TILE_HEIGHT,
304 TILE_WIDTH, 304 TILE_WIDTH,
305 TILE_HEIGHT}; 305 TILE_HEIGHT};
306 306
@@ -390,28 +390,6 @@ void Renderer::renderTitle(int num, double fade) {
390 SDL_RenderPresent(ren_.get()); 390 SDL_RenderPresent(ren_.get());
391} 391}
392 392
393std::tuple<int, int, int, int> Renderer::calculateZoomRect(const Game& game)
394{
395 int w = game.curZoom * TILE_WIDTH * ZOOM_X_FACTOR;
396 int h = game.curZoom * TILE_HEIGHT * ZOOM_Y_FACTOR;
397 int x = (game.map.getTrueX(game.player_x) * TILE_WIDTH) - (w / 2);
398 int y = (game.map.getTrueY(game.player_y) * TILE_HEIGHT) - (h / 2);
399
400 /*if (game.zooming)
401 {
402 double interp =
403 static_cast<double>(game.zoomProgress) /
404 static_cast<double>(game.zoomLength);
405
406 x = (x - game.lastZoomLeft) * interp + game.lastZoomLeft;
407 y = (y - game.lastZoomTop) * interp + game.lastZoomTop;
408 w = (w - game.lastZoomWidth) * interp + game.lastZoomWidth;
409 h = (h - game.lastZoomHeight) * interp + game.lastZoomHeight;
410 }*/
411
412 return {x, y, w, h};
413}
414
415void Renderer::loadTextureFromFile(std::string_view path, texture_ptr& texture) { 393void Renderer::loadTextureFromFile(std::string_view path, texture_ptr& texture) {
416 surface_ptr pfs(IMG_Load(path.data())); 394 surface_ptr pfs(IMG_Load(path.data()));
417 if (!pfs) 395 if (!pfs)