2020-08-20 19:59:45 +00:00
|
|
|
static const screen_x_t PLAYFIELD_LEFT = 0;
|
|
|
|
static const screen_y_t PLAYFIELD_TOP = 64;
|
|
|
|
static const screen_x_t PLAYFIELD_RIGHT = RES_X;
|
|
|
|
static const screen_y_t PLAYFIELD_BOTTOM = RES_Y;
|
2020-06-06 14:48:29 +00:00
|
|
|
|
2020-11-22 16:01:54 +00:00
|
|
|
static const pixel_t PLAYFIELD_W = (PLAYFIELD_RIGHT - PLAYFIELD_LEFT);
|
|
|
|
static const pixel_t PLAYFIELD_H = (PLAYFIELD_BOTTOM - PLAYFIELD_TOP);
|
|
|
|
|
2020-08-25 18:29:24 +00:00
|
|
|
static const screen_x_t PLAYFIELD_CENTER_X = (
|
2020-06-05 19:45:55 +00:00
|
|
|
((PLAYFIELD_RIGHT - PLAYFIELD_LEFT) / 2) + PLAYFIELD_LEFT
|
|
|
|
);
|
2021-05-26 19:41:17 +00:00
|
|
|
|
|
|
|
inline pixel_t playfield_fraction_x(float fraction = 1.0f) {
|
|
|
|
return ((int)(PLAYFIELD_W * fraction));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline pixel_t playfield_fraction_y(float fraction = 1.0f) {
|
|
|
|
return ((int)(PLAYFIELD_H * fraction));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef rand
|
|
|
|
// Calculates a random X value that spans the given [fraction] of the
|
|
|
|
// playfield.
|
|
|
|
static inline pixel_t playfield_rand_x(float fraction = 1.0f) {
|
|
|
|
return (rand() % playfield_fraction_x(fraction));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculates a random Y value that spans the given [fraction] of the
|
|
|
|
// playfield.
|
|
|
|
static inline pixel_t playfield_rand_y(float fraction = 1.0f) {
|
|
|
|
return (rand() % playfield_fraction_y(fraction));
|
|
|
|
}
|
|
|
|
#endif
|