diff options
author | cflip <cflip@cflip.net> | 2022-02-27 10:14:25 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2022-02-27 10:14:25 -0700 |
commit | 12909a3ea80639a67edd854d441614abdcd4dc12 (patch) | |
tree | dd9104fd929e70378eccc342aba89dd076bb0a4b | |
parent | 5aba1f0f337679467c18cddbcbd2ed3f378a1229 (diff) |
Rename TrainCar to Train
Although the name isn't entirely accurate, it looks nicer.
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/train.cpp | 8 | ||||
-rw-r--r-- | src/train.h | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp index 4fa5e47..e9d7e59 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,7 +85,7 @@ int main(int argc, char **argv) Level level(32, 32); Bitmap bitmap(Width, Height); - TrainCar car; + Train car; int xOffs = 0, yOffs = 0; int xDrag, yDrag; diff --git a/src/train.cpp b/src/train.cpp index 046c580..632f0f2 100644 --- a/src/train.cpp +++ b/src/train.cpp @@ -3,7 +3,7 @@ #include "level.h" #include "bitmap.h" -void TrainCar::update(Level& level) +void Train::update(Level& level) { auto tile = level.get(x, y); if (tile == 0) @@ -45,7 +45,7 @@ void TrainCar::update(Level& level) nextTile(); } -void TrainCar::draw(Bitmap& bitmap, int xo, int yo) +void Train::draw(Bitmap& bitmap, int xo, int yo) { float xi = ((float)x + (float)(m_nextX - x) * m_progress) * 24; float yi = ((float)y + (float)(m_nextY - y) * m_progress) * 24; @@ -54,7 +54,7 @@ void TrainCar::draw(Bitmap& bitmap, int xo, int yo) bitmap.blit(m_sprite, xx, yy, 0, 0, 24, 24); } -void TrainCar::setPosition(int tx, int ty) +void Train::setPosition(int tx, int ty) { x = tx; y = ty; @@ -62,7 +62,7 @@ void TrainCar::setPosition(int tx, int ty) nextTile(); } -void TrainCar::nextTile() +void Train::nextTile() { if (m_dir == North) { m_nextX = x; m_nextY = y - 1; } if (m_dir == East) { m_nextX = x + 1; m_nextY = y; } diff --git a/src/train.h b/src/train.h index 05b0da5..13f278a 100644 --- a/src/train.h +++ b/src/train.h @@ -11,9 +11,9 @@ enum CarDirection { class Level; -class TrainCar { +class Train { public: - TrainCar() + Train() : m_sprite("../res/car.png") {} void update(Level&); |