40 lines
803 B
C++
40 lines
803 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include "text.h"
|
|
#include "utils.h" // Para Color
|
|
|
|
class UIMessage
|
|
{
|
|
public:
|
|
UIMessage(std::shared_ptr<Text> text_renderer, const std::string& message_text, const Color& color);
|
|
|
|
void show(float base_x, float base_y);
|
|
void hide();
|
|
void update();
|
|
void render();
|
|
|
|
bool isVisible() const;
|
|
|
|
private:
|
|
// Configuración
|
|
std::shared_ptr<Text> text_renderer_;
|
|
std::string text_;
|
|
Color color_;
|
|
|
|
// Estado
|
|
bool visible_ = false;
|
|
bool animating_ = false;
|
|
float base_x_ = 0.0f;
|
|
float base_y_ = 0.0f;
|
|
float y_offset_ = 0.0f;
|
|
|
|
// Animación
|
|
float start_y_ = 0.0f;
|
|
float target_y_ = 0.0f;
|
|
int anim_step_ = 0;
|
|
static constexpr int ANIMATION_STEPS = 12;
|
|
|
|
void updateAnimation();
|
|
}; |