forked from jaildesigner-jailgames/jaildoctors_dilemma
eliminades les opcions de configuracio de posicio de les notificacions
This commit is contained in:
@@ -59,7 +59,6 @@ constexpr bool SOUND_ENABLED = true; // Sonido habilitado por defecto
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
// NOTIFICATIONS
|
// NOTIFICATIONS
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
constexpr Options::NotificationPosition NOTIFICATION_POSITION = Options::NotificationPosition::UPPER_LEFT; // Posición de las notificaciones por defecto
|
|
||||||
constexpr bool NOTIFICATION_SOUND = true; // Sonido de las notificaciones por defecto
|
constexpr bool NOTIFICATION_SOUND = true; // Sonido de las notificaciones por defecto
|
||||||
const Uint8 NOTIFICATION_COLOR = static_cast<Uint8>(PaletteColor::BLUE); // Color de las notificaciones por defecto
|
const Uint8 NOTIFICATION_COLOR = static_cast<Uint8>(PaletteColor::BLUE); // Color de las notificaciones por defecto
|
||||||
|
|
||||||
|
|||||||
@@ -20,22 +20,6 @@ constexpr int convertVolume(int volume_percent) {
|
|||||||
}
|
}
|
||||||
} // namespace VolumeHelpers
|
} // namespace VolumeHelpers
|
||||||
|
|
||||||
// Posiciones de las notificaciones
|
|
||||||
enum class NotificationPosition {
|
|
||||||
UPPER_LEFT,
|
|
||||||
UPPER_CENTER,
|
|
||||||
UPPER_RIGHT,
|
|
||||||
BOTTOM_LEFT,
|
|
||||||
BOTTOM_CENTER,
|
|
||||||
BOTTOM_RIGHT,
|
|
||||||
TOP,
|
|
||||||
BOTTOM,
|
|
||||||
LEFT,
|
|
||||||
RIGHT,
|
|
||||||
CENTER,
|
|
||||||
UNKNOWN,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Tipos de control de teclado
|
// Tipos de control de teclado
|
||||||
enum class ControlScheme {
|
enum class ControlScheme {
|
||||||
CURSOR,
|
CURSOR,
|
||||||
@@ -52,54 +36,18 @@ namespace Options {
|
|||||||
|
|
||||||
// Estructura para las opciones de las notificaciones
|
// Estructura para las opciones de las notificaciones
|
||||||
struct Notification {
|
struct Notification {
|
||||||
NotificationPosition pos; // Ubicación de las notificaciones en pantalla
|
|
||||||
bool sound; // Indica si las notificaciones suenan
|
bool sound; // Indica si las notificaciones suenan
|
||||||
Uint8 color; // Color de las notificaciones
|
Uint8 color; // Color de las notificaciones
|
||||||
|
|
||||||
// Constructor por defecto
|
// Constructor por defecto
|
||||||
Notification()
|
Notification()
|
||||||
: pos(GameDefaults::NOTIFICATION_POSITION),
|
: sound(GameDefaults::NOTIFICATION_SOUND),
|
||||||
sound(GameDefaults::NOTIFICATION_SOUND),
|
|
||||||
color(GameDefaults::NOTIFICATION_COLOR) {}
|
color(GameDefaults::NOTIFICATION_COLOR) {}
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Notification(NotificationPosition p, bool s, Uint8 c)
|
Notification(bool s, Uint8 c)
|
||||||
: pos(p),
|
: sound(s),
|
||||||
sound(s),
|
|
||||||
color(c) {}
|
color(c) {}
|
||||||
|
|
||||||
// Método que devuelve la posición horizontal
|
|
||||||
NotificationPosition getHorizontalPosition() const {
|
|
||||||
switch (pos) {
|
|
||||||
case NotificationPosition::UPPER_LEFT:
|
|
||||||
case NotificationPosition::BOTTOM_LEFT:
|
|
||||||
return NotificationPosition::LEFT;
|
|
||||||
case NotificationPosition::UPPER_CENTER:
|
|
||||||
case NotificationPosition::BOTTOM_CENTER:
|
|
||||||
return NotificationPosition::CENTER;
|
|
||||||
case NotificationPosition::UPPER_RIGHT:
|
|
||||||
case NotificationPosition::BOTTOM_RIGHT:
|
|
||||||
return NotificationPosition::RIGHT;
|
|
||||||
default:
|
|
||||||
return NotificationPosition::UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Método que devuelve la posición vertical
|
|
||||||
NotificationPosition getVerticalPosition() const {
|
|
||||||
switch (pos) {
|
|
||||||
case NotificationPosition::UPPER_LEFT:
|
|
||||||
case NotificationPosition::UPPER_CENTER:
|
|
||||||
case NotificationPosition::UPPER_RIGHT:
|
|
||||||
return NotificationPosition::TOP;
|
|
||||||
case NotificationPosition::BOTTOM_LEFT:
|
|
||||||
case NotificationPosition::BOTTOM_CENTER:
|
|
||||||
case NotificationPosition::BOTTOM_RIGHT:
|
|
||||||
return NotificationPosition::BOTTOM;
|
|
||||||
default:
|
|
||||||
return NotificationPosition::UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Estructura para albergar trucos
|
// Estructura para albergar trucos
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void Notifier::update() {
|
|||||||
|
|
||||||
switch (notification.state) {
|
switch (notification.state) {
|
||||||
case NotificationStatus::RISING: {
|
case NotificationStatus::RISING: {
|
||||||
const int DIRECTION = (Options::notifications.getVerticalPosition() == Options::NotificationPosition::TOP) ? 1 : -1;
|
const int DIRECTION = 1;
|
||||||
notification.rect.y += DIRECTION;
|
notification.rect.y += DIRECTION;
|
||||||
|
|
||||||
if (notification.rect.y == notification.y) {
|
if (notification.rect.y == notification.y) {
|
||||||
@@ -80,7 +80,7 @@ void Notifier::update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case NotificationStatus::VANISHING: {
|
case NotificationStatus::VANISHING: {
|
||||||
const int DIRECTION = (Options::notifications.getVerticalPosition() == Options::NotificationPosition::TOP) ? -1 : 1;
|
const int DIRECTION = -1;
|
||||||
notification.rect.y += DIRECTION;
|
notification.rect.y += DIRECTION;
|
||||||
|
|
||||||
if (notification.rect.y == notification.y - notification.travel_dist) {
|
if (notification.rect.y == notification.y - notification.travel_dist) {
|
||||||
@@ -145,31 +145,15 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
|||||||
const auto SHAPE = NotificationShape::SQUARED;
|
const auto SHAPE = NotificationShape::SQUARED;
|
||||||
|
|
||||||
// Posición horizontal
|
// Posición horizontal
|
||||||
float desp_h = 0;
|
float desp_h = ((Options::game.width / 2) - (WIDTH / 2));
|
||||||
switch (Options::notifications.getHorizontalPosition()) {
|
;
|
||||||
case Options::NotificationPosition::LEFT:
|
|
||||||
desp_h = PADDING_OUT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Options::NotificationPosition::CENTER:
|
|
||||||
desp_h = ((Options::game.width / 2) - (WIDTH / 2));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Options::NotificationPosition::RIGHT:
|
|
||||||
desp_h = Options::game.width - WIDTH - PADDING_OUT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
desp_h = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Posición vertical
|
// Posición vertical
|
||||||
const int DESP_V = (Options::notifications.getVerticalPosition() == Options::NotificationPosition::TOP) ? PADDING_OUT : Options::game.height - HEIGHT - PADDING_OUT;
|
const int DESP_V = PADDING_OUT;
|
||||||
|
|
||||||
// Offset
|
// Offset
|
||||||
const auto TRAVEL_DIST = HEIGHT + PADDING_OUT;
|
const auto TRAVEL_DIST = HEIGHT + PADDING_OUT;
|
||||||
const int TRAVEL_MOD = (Options::notifications.getVerticalPosition() == Options::NotificationPosition::TOP) ? 1 : -1;
|
const int TRAVEL_MOD = 1;
|
||||||
const int OFFSET = !notifications_.empty() ? notifications_.back().y + (TRAVEL_MOD * notifications_.back().travel_dist) : DESP_V;
|
const int OFFSET = !notifications_.empty() ? notifications_.back().y + (TRAVEL_MOD * notifications_.back().travel_dist) : DESP_V;
|
||||||
|
|
||||||
// Crea la notificacion
|
// Crea la notificacion
|
||||||
@@ -183,7 +167,7 @@ void Notifier::show(std::vector<std::string> texts, NotificationText text_is, Ui
|
|||||||
n.texts = texts;
|
n.texts = texts;
|
||||||
n.shape = SHAPE;
|
n.shape = SHAPE;
|
||||||
n.display_duration = display_duration;
|
n.display_duration = display_duration;
|
||||||
const float Y_POS = OFFSET + ((Options::notifications.getVerticalPosition() == Options::NotificationPosition::TOP) ? -TRAVEL_DIST : TRAVEL_DIST);
|
const float Y_POS = OFFSET + -TRAVEL_DIST;
|
||||||
n.rect = {desp_h, Y_POS, WIDTH, HEIGHT};
|
n.rect = {desp_h, Y_POS, WIDTH, HEIGHT};
|
||||||
|
|
||||||
// Crea la textura
|
// Crea la textura
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ int main(int argc, char* argv[]) {
|
|||||||
auto director = std::make_unique<Director>(argc, const_cast<const char**>(argv));
|
auto director = std::make_unique<Director>(argc, const_cast<const char**>(argv));
|
||||||
|
|
||||||
// Bucle principal
|
// Bucle principal
|
||||||
return director->run();
|
return Director::run();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user