fix(snakegame): remap controls to fixed buttons, replace footer labels with arrows, and improve game feel (food placement, pacing, game-over lockout)
This commit is contained in:
@@ -16,15 +16,18 @@ public:
|
||||
private:
|
||||
enum class Dir { Up, Down, Left, Right };
|
||||
|
||||
static constexpr int BLOCK = 18;
|
||||
static constexpr int BLOCK = 28;
|
||||
static constexpr int HEADER_H = 34;
|
||||
static constexpr int FOOTER_H = 30;
|
||||
static constexpr int FOOTER_H = 38;
|
||||
static constexpr int ARROW_SIZE = 16;
|
||||
static constexpr int ARROW_BOTTOM_PAD = 14;
|
||||
static constexpr int MAX_SNAKE_LEN = 2048;
|
||||
static constexpr unsigned long TICK_START_MS = 170;
|
||||
static constexpr unsigned long TICK_MIN_MS = 80;
|
||||
static constexpr unsigned long TICK_START_MS = 320;
|
||||
static constexpr unsigned long TICK_MIN_MS = 200;
|
||||
static constexpr unsigned long TICK_STEP_MS = 6;
|
||||
static constexpr int POINTS_PER_FOOD = 10;
|
||||
static constexpr int SPEEDUP_EVERY_POINTS = 50;
|
||||
static constexpr unsigned long GAME_OVER_LOCKOUT_MS = 3000;
|
||||
|
||||
int screenW_ = 0;
|
||||
int screenH_ = 0;
|
||||
@@ -51,7 +54,8 @@ private:
|
||||
bool won_ = false;
|
||||
bool renderPending_ = false;
|
||||
|
||||
unsigned long lastMove_ = 0;
|
||||
unsigned long lastMove_ = 0;
|
||||
unsigned long gameOverAt_ = 0;
|
||||
|
||||
void resetGame();
|
||||
void placeFood();
|
||||
@@ -59,4 +63,5 @@ private:
|
||||
void handleDirectionInput();
|
||||
void updateGame();
|
||||
void drawFooterLabels() const;
|
||||
void drawArrow(Dir dir, int cx, int cy, int size) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user