diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-01-30 13:11:59 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-01-30 13:11:59 -0500 |
commit | 4c610d6ccff254df995343406e51a6724d2d17c5 (patch) | |
tree | 541aecec28fce88951755f82a517131a82d383e1 | |
parent | e3fcd5fc180b48e0710fbcbf6cfa94e906b8219c (diff) | |
download | tanetane-4c610d6ccff254df995343406e51a6724d2d17c5.tar.gz tanetane-4c610d6ccff254df995343406e51a6724d2d17c5.tar.bz2 tanetane-4c610d6ccff254df995343406e51a6724d2d17c5.zip |
Game now renders onto a 320x240 canvas that gets stretched up
-rw-r--r-- | src/consts.h | 7 | ||||
-rw-r--r-- | 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 @@ | |||
4 | const int GAME_WIDTH = 640; | 4 | const int GAME_WIDTH = 640; |
5 | const int GAME_HEIGHT = 480; | 5 | const int GAME_HEIGHT = 480; |
6 | 6 | ||
7 | const int MOVEMENT_SPEED = 4; | 7 | const int CANVAS_WIDTH = 320; |
8 | const int PARTY_FRAME_DELAY = 20;// / MOVEMENT_SPEED; | 8 | const int CANVAS_HEIGHT = 240; |
9 | |||
10 | const int MOVEMENT_SPEED = 2; | ||
11 | const int PARTY_FRAME_DELAY = 10;// / MOVEMENT_SPEED; | ||
9 | 12 | ||
10 | #endif /* end of include guard: CONSTS_H_9561E49C */ | 13 | #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) { | |||
35 | ren_.get(), | 35 | ren_.get(), |
36 | SDL_PIXELFORMAT_RGBA8888, | 36 | SDL_PIXELFORMAT_RGBA8888, |
37 | SDL_TEXTUREACCESS_TARGET, | 37 | SDL_TEXTUREACCESS_TARGET, |
38 | GAME_WIDTH, | 38 | CANVAS_WIDTH, |
39 | GAME_HEIGHT)); | 39 | CANVAS_HEIGHT)); |
40 | 40 | ||
41 | if (!canvas) | 41 | if (!canvas) |
42 | { | 42 | { |
@@ -50,7 +50,7 @@ void Renderer::render(Game& game) { | |||
50 | 50 | ||
51 | for (const Sprite& sprite : game.getSpritesByY() | game.spriteView()) { | 51 | for (const Sprite& sprite : game.getSpritesByY() | game.spriteView()) { |
52 | SDL_Rect src { sprite.getFrame() * sprite.size().w(), 0, sprite.size().w(), sprite.size().h() }; | 52 | SDL_Rect src { sprite.getFrame() * sprite.size().w(), 0, sprite.size().w(), sprite.size().h() }; |
53 | SDL_Rect dest { sprite.loc().x(), sprite.loc().y(), sprite.size().w() * 4, sprite.size().h() * 4 }; | 53 | SDL_Rect dest { sprite.loc().x(), sprite.loc().y(), sprite.size().w(), sprite.size().h() }; |
54 | SDL_RenderCopy(ren_.get(), textures_.at(sprite.getTextureId()).get(), &src, &dest); | 54 | SDL_RenderCopy(ren_.get(), textures_.at(sprite.getTextureId()).get(), &src, &dest); |
55 | } | 55 | } |
56 | 56 | ||