migrant a SDL3
This commit is contained in:
@@ -18,21 +18,21 @@ constexpr int ICONSIZE = 16;
|
||||
constexpr SDL_Point PADDING = {8, 8};
|
||||
constexpr SDL_Point DESP = {ICONSIZE + 4, 5};
|
||||
|
||||
constexpr SDL_Rect CONTROLLER_UP = {16, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect CONTROLLER_DOWN = {48, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect CONTROLLER_LEFT = {64, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect LEFT_BUTTON = {112, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect TOP_BUTTON = {80, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect RIGHT_BUTTON = {96, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect START_BUTTON = {0, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect CONTROLLER_UP = {16, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect CONTROLLER_DOWN = {48, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect CONTROLLER_LEFT = {64, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect LEFT_BUTTON = {112, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect TOP_BUTTON = {80, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect RIGHT_BUTTON = {96, 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect START_BUTTON = {0, 0, ICONSIZE, ICONSIZE};
|
||||
|
||||
constexpr SDL_Rect CONTROLLER_UP_POS = {PADDING.x, PADDING.y + 18 * 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect CONTROLLER_DOWN_POS = {PADDING.x, PADDING.y + 18 * 1, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect CONTROLLER_LEFT_POS = {PADDING.x, PADDING.y + 18 * 2, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect LEFT_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 3, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect TOP_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 4, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect RIGHT_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 5, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_Rect START_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 6, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect CONTROLLER_UP_POS = {PADDING.x, PADDING.y + 18 * 0, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect CONTROLLER_DOWN_POS = {PADDING.x, PADDING.y + 18 * 1, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect CONTROLLER_LEFT_POS = {PADDING.x, PADDING.y + 18 * 2, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect LEFT_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 3, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect TOP_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 4, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect RIGHT_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 5, ICONSIZE, ICONSIZE};
|
||||
constexpr SDL_FRect START_BUTTON_POS = {PADDING.x, PADDING.y + 18 * 6, ICONSIZE, ICONSIZE};
|
||||
|
||||
// [SINGLETON] Crearemos el objeto onScreenHelp con esta función estática
|
||||
void OnScreenHelp::init()
|
||||
@@ -100,7 +100,7 @@ void OnScreenHelp::fillTexture()
|
||||
auto controllersTexture = Resource::get()->getTexture("controllers.png");
|
||||
|
||||
// Crea el sprite para dibujar los gráficos
|
||||
auto sprite = std::make_unique<Sprite>(controllersTexture, (SDL_Rect){0, 0, 16, 16});
|
||||
auto sprite = std::make_unique<Sprite>(controllersTexture, (SDL_FRect){0, 0, 16, 16});
|
||||
|
||||
// Borra la textura
|
||||
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 0);
|
||||
@@ -108,7 +108,7 @@ void OnScreenHelp::fillTexture()
|
||||
|
||||
// Pon el color de fondo con el bisel
|
||||
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0x55, 0x5D, 0x77, 255);
|
||||
SDL_Rect rect;
|
||||
SDL_FRect rect;
|
||||
rect = {4, 0, dest.w - (4 * 2), dest.h};
|
||||
SDL_RenderFillRect(Screen::get()->getRenderer(), &rect);
|
||||
|
||||
@@ -146,7 +146,7 @@ void OnScreenHelp::setSize()
|
||||
const auto x = 0;
|
||||
const auto y = (param.game.height - height) / 2;
|
||||
|
||||
dest = (SDL_Rect){x, y, width, height};
|
||||
dest = (SDL_FRect){x, y, width, height};
|
||||
|
||||
hiddenPos = -width;
|
||||
showingPos = 0;
|
||||
@@ -182,7 +182,7 @@ auto OnScreenHelp::getLargestStringSize() -> int const
|
||||
}
|
||||
|
||||
// Renderizara el boton y el texto
|
||||
void OnScreenHelp::renderButton(Sprite *sprite, Text *text, const SDL_Rect &buttonClip, const SDL_Rect &buttonPos, int textId)
|
||||
void OnScreenHelp::renderButton(Sprite *sprite, Text *text, const SDL_FRect &buttonClip, const SDL_FRect &buttonPos, int textId)
|
||||
{
|
||||
sprite->setSpriteClip(buttonClip);
|
||||
sprite->setPosition(buttonPos);
|
||||
|
||||
Reference in New Issue
Block a user