forked from jaildesigner-jailgames/jaildoctors_dilemma
linter
This commit is contained in:
@@ -14,10 +14,9 @@
|
||||
// Constructor
|
||||
Scoreboard::Scoreboard(std::shared_ptr<ScoreboardData> data)
|
||||
: item_surface_(Resource::get()->getSurface("items.gif")),
|
||||
data_(data),
|
||||
clock_(ClockData()) {
|
||||
const float SURFACE_WIDTH_ = Options::game.width;
|
||||
constexpr float SURFACE_HEIGHT_ = 6.0F * BLOCK;
|
||||
data_(data) {
|
||||
const float SURFACE_WIDTH = Options::game.width;
|
||||
constexpr float SURFACE_HEIGHT = 6.0F * BLOCK;
|
||||
|
||||
// Reserva memoria para los objetos
|
||||
auto player_texture = Resource::get()->getSurface(Options::cheats.alternate_skin == Options::Cheat::State::ENABLED ? "player2.gif" : "player.gif");
|
||||
@@ -25,8 +24,8 @@ Scoreboard::Scoreboard(std::shared_ptr<ScoreboardData> data)
|
||||
player_sprite_ = std::make_shared<SurfaceAnimatedSprite>(player_texture, player_animations);
|
||||
player_sprite_->setCurrentAnimation("walk_menu");
|
||||
|
||||
surface_ = std::make_shared<Surface>(SURFACE_WIDTH_, SURFACE_HEIGHT_);
|
||||
surface_dest_ = {0, Options::game.height - SURFACE_HEIGHT_, SURFACE_WIDTH_, SURFACE_HEIGHT_};
|
||||
surface_ = std::make_shared<Surface>(SURFACE_WIDTH, SURFACE_HEIGHT);
|
||||
surface_dest_ = {0, Options::game.height - SURFACE_HEIGHT, SURFACE_WIDTH, SURFACE_HEIGHT};
|
||||
|
||||
// Inicializa las variables
|
||||
counter_ = 0;
|
||||
@@ -67,13 +66,13 @@ void Scoreboard::update() {
|
||||
|
||||
// Obtiene el tiempo transcurrido de partida
|
||||
Scoreboard::ClockData Scoreboard::getTime() {
|
||||
const Uint32 timeElapsed = SDL_GetTicks() - data_->ini_clock - paused_time_elapsed_;
|
||||
const Uint32 TIME_ELAPSED = SDL_GetTicks() - data_->ini_clock - paused_time_elapsed_;
|
||||
|
||||
ClockData time;
|
||||
time.hours = timeElapsed / 3600000;
|
||||
time.minutes = timeElapsed / 60000;
|
||||
time.seconds = timeElapsed / 1000;
|
||||
time.separator = (timeElapsed % 1000 <= 500) ? ":" : " ";
|
||||
time.hours = TIME_ELAPSED / 3600000;
|
||||
time.minutes = TIME_ELAPSED / 60000;
|
||||
time.seconds = TIME_ELAPSED / 1000;
|
||||
time.separator = (TIME_ELAPSED % 1000 <= 500) ? ":" : " ";
|
||||
|
||||
return time;
|
||||
}
|
||||
@@ -128,21 +127,21 @@ void Scoreboard::fillTexture() {
|
||||
constexpr int LINE2 = 3 * BLOCK;
|
||||
|
||||
// Dibuja las vidas
|
||||
const int desp = (counter_ / 40) % 8;
|
||||
const int frame = desp % 4;
|
||||
player_sprite_->setCurrentAnimationFrame(frame);
|
||||
const int DESP = (counter_ / 40) % 8;
|
||||
const int FRAME = DESP % 4;
|
||||
player_sprite_->setCurrentAnimationFrame(FRAME);
|
||||
player_sprite_->setPosY(LINE2);
|
||||
for (int i = 0; i < data_->lives; ++i) {
|
||||
player_sprite_->setPosX(8 + (16 * i) + desp);
|
||||
const int index = i % color_.size();
|
||||
player_sprite_->render(1, color_.at(index));
|
||||
player_sprite_->setPosX(8 + (16 * i) + DESP);
|
||||
const int INDEX = i % color_.size();
|
||||
player_sprite_->render(1, color_.at(INDEX));
|
||||
}
|
||||
|
||||
// Muestra si suena la música
|
||||
if (data_->music) {
|
||||
const Uint8 c = data_->color;
|
||||
const Uint8 C = data_->color;
|
||||
SDL_FRect clip = {0, 8, 8, 8};
|
||||
item_surface_->renderWithColorReplace(20 * BLOCK, LINE2, 1, c, &clip);
|
||||
item_surface_->renderWithColorReplace(20 * BLOCK, LINE2, 1, C, &clip);
|
||||
}
|
||||
|
||||
// Escribe los textos
|
||||
|
||||
Reference in New Issue
Block a user