🎨 Updated string macros

This commit is contained in:
Scott Lahteine
2021-09-25 02:27:07 -05:00
parent dc4d2165f2
commit 262cd757fc
51 changed files with 237 additions and 234 deletions

View File

@@ -50,8 +50,8 @@ inline void reset_bricks(const uint16_t v) {
void reset_ball() {
constexpr uint8_t ball_dist = 24;
bdat.bally = BTOF(PADDLE_Y - ball_dist);
bdat.ballv = FTOP(1.3f);
bdat.ballh = -FTOP(1.25f);
bdat.ballv = FTOF(1.3f);
bdat.ballh = -FTOF(1.25f);
uint8_t bx = bdat.paddle_x + (PADDLE_W) / 2 + ball_dist;
if (bx >= LCD_PIXEL_WIDTH - 10) { bx -= ball_dist * 2; bdat.ballh = -bdat.ballh; }
bdat.ballx = BTOF(bx);

View File

@@ -63,7 +63,7 @@
#define SNAKE_SIZ SNAKE_BOX
#endif
constexpr fixed_t snakev = FTOP(0.20);
constexpr fixed_t snakev = FTOF(0.20);
snake_data_t &sdat = marlin_game_data.snake;
@@ -125,7 +125,7 @@ void snake_reset() {
// Init the head and velocity
sdat.snakex = BTOF(1);
sdat.snakey = BTOF(GAME_H / 2);
//snakev = FTOP(0.25);
//snakev = FTOF(0.25);
// Init the tail with a cw turn
sdat.snake_dir = 0;

View File

@@ -27,7 +27,7 @@ typedef struct { int8_t x, y; } pos_t;
// Simple 8:8 fixed-point
typedef int16_t fixed_t;
#define FTOP(F) fixed_t((F)*256.0f)
#define FTOF(F) fixed_t((F)*256.0f)
#define PTOF(P) (float(P)*(1.0f/256.0f))
#define BTOF(X) (fixed_t(X)<<8)
#define FTOB(X) int8_t(fixed_t(X)>>8)

View File

@@ -114,7 +114,7 @@ class MenuItem_confirm : public MenuItemBase {
static inline void select_screen(
PGM_P const yes, PGM_P const no,
selectFunc_t yesFunc, selectFunc_t noFunc,
PGM_P const pref, const progmem_str string, PGM_P const suff=nullptr
PGM_P const pref, FSTR_P const string, PGM_P const suff=nullptr
) {
char str[strlen_P((PGM_P)string) + 1];
strcpy_P(str, (PGM_P)string);