summaryrefslogtreecommitdiff
path: root/train.cpp
diff options
context:
space:
mode:
authorJun Zhang <jun@junz.org>2022-01-30 12:30:02 +0800
committerGitHub <noreply@github.com>2022-01-29 21:30:02 -0700
commitcb7af3f4cac90f95926477b4001f9f80037568d5 (patch)
tree022f4700c796a9935acd3ee0d0fd80a812a78464 /train.cpp
parent99b4763f1028e72bb06d8db6c7e8ace469f8989c (diff)
refactor: adjust the project infra. (#1)
* refactor: adjust the project infra. This patch adds cmake build system to the project, and adjust infrastructure stuff. Signed-off-by: Jun Zhang <jun@junz.org> * fix: remove compiler flags that only exist in GCC. Signed-off-by: Jun Zhang <jun@junz.org>
Diffstat (limited to 'train.cpp')
-rw-r--r--train.cpp52
1 files changed, 0 insertions, 52 deletions
diff --git a/train.cpp b/train.cpp
deleted file mode 100644
index e369887..0000000
--- a/train.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "train.h"
-
-#include "level.h"
-#include "bitmap.h"
-
-void TrainCar::update(Level& level)
-{
- auto tile = level.get(x, y);
- if (tile == 0)
- return;
-
- if (m_progress < 12) {
- m_progress++;
- return;
- }
- else {
- m_progress = 0;
- }
-
- auto n = level.get(x, y - 1);
- auto e = level.get(x + 1, y);
- auto s = level.get(x, y + 1);
- auto w = level.get(x - 1, y);
-
- if (m_dir == North) {
- if (n == SouthEast) m_dir = East;
- if (n == SouthWest) m_dir = West;
- y--;
- }
- else if (m_dir == East) {
- if (e == NorthWest) m_dir = North;
- if (e == SouthWest) m_dir = South;
- x++;
- }
- else if (m_dir == South) {
- if (s == NorthEast) m_dir = East;
- if (s == NorthWest) m_dir = West;
- y++;
- }
- else if (m_dir == West) {
- if (w == NorthEast) m_dir = North;
- if (w == SouthEast) m_dir = South;
- x--;
- }
-}
-
-void TrainCar::draw(Bitmap& bitmap, int xo, int yo)
-{
- int xx = (x - y) * (24 / 2) - xo;
- int yy = (x + y) * (24 / 4) - yo;
- bitmap.blit(m_sprite, xx, yy, 0, 0, 24, 24);
-} \ No newline at end of file