From 4c610d6ccff254df995343406e51a6724d2d17c5 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 30 Jan 2021 13:11:59 -0500 Subject: Game now renders onto a 320x240 canvas that gets stretched up --- src/consts.h | 7 +++++-- src/renderer.cpp | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/consts.h b/src/consts.h index d6bf90b..fcfdff2 100644 --- a/src/consts.h +++ b/src/consts.h @@ -4,7 +4,10 @@ const int GAME_WIDTH = 640; const int GAME_HEIGHT = 480; -const int MOVEMENT_SPEED = 4; -const int PARTY_FRAME_DELAY = 20;// / MOVEMENT_SPEED; +const int CANVAS_WIDTH = 320; +const int CANVAS_HEIGHT = 240; + +const int MOVEMENT_SPEED = 2; +const int PARTY_FRAME_DELAY = 10;// / MOVEMENT_SPEED; #endif /* end of include guard: CONSTS_H_9561E49C */ diff --git a/src/renderer.cpp b/src/renderer.cpp index 77f0a0c..18b8ed8 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -35,8 +35,8 @@ void Renderer::render(Game& game) { ren_.get(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, - GAME_WIDTH, - GAME_HEIGHT)); + CANVAS_WIDTH, + CANVAS_HEIGHT)); if (!canvas) { @@ -50,7 +50,7 @@ void Renderer::render(Game& game) { for (const Sprite& sprite : game.getSpritesByY() | game.spriteView()) { SDL_Rect src { sprite.getFrame() * sprite.size().w(), 0, sprite.size().w(), sprite.size().h() }; - SDL_Rect dest { sprite.loc().x(), sprite.loc().y(), sprite.size().w() * 4, sprite.size().h() * 4 }; + SDL_Rect dest { sprite.loc().x(), sprite.loc().y(), sprite.size().w(), sprite.size().h() }; SDL_RenderCopy(ren_.get(), textures_.at(sprite.getTextureId()).get(), &src, &dest); } -- cgit 1.4.1