BIG MOVES
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// src/render/background.cpp
|
||||
|
||||
#include "../background_dark_inverted.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// src/render/loop.cpp
|
||||
#include "loop.h"
|
||||
#include "../background_dark_inverted.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include "player_positioning.h"
|
||||
#include "background.h"
|
||||
#include "mbed.h"
|
||||
#include "player.h"
|
||||
#include "player_mask.h"
|
||||
#include "../assets/character_frames.h"
|
||||
#include <cstring>
|
||||
|
||||
extern BufferedSerial serial_port;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// src/render/player.cpp
|
||||
#include "player.h"
|
||||
#include "player_mask.h"
|
||||
#include "../assets/character_frames.h"
|
||||
#include <cstdio>
|
||||
|
||||
void draw_character(int x, int y, CharacterFrame frame) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// src/render/player.h
|
||||
#pragma once
|
||||
#include "player_mask.h"
|
||||
#include "../assets/character_frames.h"
|
||||
|
||||
// Draw the player object starting at given (x, y)
|
||||
void draw_character(int x, int y, CharacterFrame frame);
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
// src/render/player_mask.h
|
||||
|
||||
#pragma once
|
||||
|
||||
// Player frame 1
|
||||
static const char *CHARACTER_MASK_FRAME_1[] = {
|
||||
".....a@$..",
|
||||
".....7PF..",
|
||||
"..yaM@@__y",
|
||||
"..@.y@FFF~",
|
||||
"..._$M@_..",
|
||||
"yaa@~.`@y.",
|
||||
"........@r"
|
||||
};
|
||||
|
||||
// Player frame 2
|
||||
static const char *CHARACTER_MASK_FRAME_2[] = {
|
||||
".g@$",
|
||||
".7PF",
|
||||
"y@$.",
|
||||
"0@F.",
|
||||
"4@$.",
|
||||
"y$@.",
|
||||
"u@.."
|
||||
};
|
||||
|
||||
// Player frame 3 (triggered)
|
||||
static const char *CHARACTER_MASK_FRAME_3[] = {
|
||||
".._$@.",
|
||||
".$By`.",
|
||||
"4@$@@a",
|
||||
"aa@W@."
|
||||
};
|
||||
|
||||
enum class CharacterFrame {
|
||||
Walk1 = 0,
|
||||
Walk2,
|
||||
Crawl1,
|
||||
COUNT // number of frames, must stay last
|
||||
};
|
||||
|
||||
// Combine frames for easy access
|
||||
static const char **PLAYER_FRAMES[] = {
|
||||
CHARACTER_MASK_FRAME_1, // Walk1
|
||||
CHARACTER_MASK_FRAME_2, // Walk1
|
||||
CHARACTER_MASK_FRAME_3 // Crawl1
|
||||
};
|
||||
|
||||
static const int CHARACTER_FRAME_COUNT = static_cast<int>(CharacterFrame::COUNT);
|
||||
|
||||
// Height per frame
|
||||
static const int CHARACTER_HEIGHT_1 = sizeof(CHARACTER_MASK_FRAME_1) / sizeof(CHARACTER_MASK_FRAME_1[0]);
|
||||
static const int CHARACTER_HEIGHT_2 = sizeof(CHARACTER_MASK_FRAME_2) / sizeof(CHARACTER_MASK_FRAME_2[0]);
|
||||
static const int CHARACTER_HEIGHT_3 = sizeof(CHARACTER_MASK_FRAME_3) / sizeof(CHARACTER_MASK_FRAME_3[0]);
|
||||
@@ -1,6 +1,6 @@
|
||||
// src/render/player_positioning.cpp
|
||||
#include "player_positioning.h"
|
||||
#include "../background_dark_inverted.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include <cstdio>
|
||||
|
||||
// Convert a pivot coordinate (bottom-left) to the top-left draw position
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/render/player_positioning.h
|
||||
#pragma once
|
||||
#include "../background_dark_inverted.h"
|
||||
#include "player_mask.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include "../assets/character_frames.h"
|
||||
|
||||
struct CharacterPosition {
|
||||
int x;
|
||||
|
||||
Reference in New Issue
Block a user