#include <BuildMenu.hxx>
|
| BuildMenuButton (const std::string &tx, const std::string &category) |
|
| BuildMenuButton (const std::string &tx, const std::string &category, const TileData &tile) |
|
Ptr | addCategoryButton (const std::string &tx, const std::string &id, const TileData &tile) |
|
Ptr | addTileButton (const std::string &tx, const std::string &id, const TileData &tile) |
|
Ptr | addActionButton (const std::string &tx, const std::string &action, const std::string &tooltip) |
|
Ptr | addButtonImpl (const std::string &tx, const std::string &id, const TileData &tile) |
|
void | scaleCenterImage (SDL_Rect &ret, int btnW, int btnH, int imgW, int imgH) const |
| takes an SDL_Rect, default button width and height, and image width and height and scales the image to fit on a button of the default button size (maintaining the aspect ration of the original image). More...
|
|
const ImVec2 & | getBtnSize () const |
|
const std::string & | getId () const |
|
const Items & | getButtons () const |
|
void | hideItems () |
|
Definition at line 9 of file BuildMenu.hxx.
◆ Items
◆ Ptr
◆ BuildMenuButton() [1/2]
◆ BuildMenuButton() [2/2]
Definition at line 465 of file BuildMenu.cxx.
480 m_destRect = ImVec4((
float)destRect.x, (
float)destRect.y, (
float)destRect.w, (
float)destRect.h);
◆ addActionButton()
Definition at line 483 of file BuildMenu.cxx.
486 auto btn = std::make_shared<BuildMenuButton>(tx, action);
488 btn->m_background =
true;
489 btn->m_parent =
this;
490 btn->m_action = action;
◆ addButtonImpl()
Definition at line 495 of file BuildMenu.cxx.
497 auto btn = std::make_shared<BuildMenuButton>(tx,
id, tile);
498 btn->m_parent =
this;
◆ addCategoryButton()
◆ addTileButton()
◆ getBtnSize()
const ImVec2& BuildMenuButton::getBtnSize |
( |
| ) |
const |
|
inline |
◆ getButtons()
const Items& BuildMenuButton::getButtons |
( |
| ) |
const |
|
inline |
◆ getId()
◆ hideItems()
void BuildMenuButton::hideItems |
( |
| ) |
|
◆ scaleCenterImage()
void BuildMenuButton::scaleCenterImage |
( |
SDL_Rect & |
ret, |
|
|
int |
btnW, |
|
|
int |
btnH, |
|
|
int |
imgW, |
|
|
int |
imgH |
|
) |
| const |
takes an SDL_Rect, default button width and height, and image width and height and scales the image to fit on a button of the default button size (maintaining the aspect ration of the original image).
- Parameters
-
ret | the address of a rect that will contain the size of the scaled image |
btnW | the default button width |
btnH | the default button height |
imgW | the width of the image to scale |
imgH | the height of the image to scale |
Definition at line 503 of file BuildMenu.cxx.
507 float ratio = (float)imgH / (
float)imgW;
509 ret.h =
static_cast<int>(ceil((
float)btnH * ratio));
511 ret.y = btnH - ret.h;
515 float ratio = (float)imgW / (
float)imgH;
516 ret.w =
static_cast<int>(ceil((
float)btnW * ratio));
518 ret.x =
static_cast<int>(ceil(((
float)(btnW - ret.w)) / 2));
◆ m_action
◆ m_background
bool BuildMenuButton::m_background = false |
◆ m_btnSize
ImVec2 BuildMenuButton::m_btnSize |
◆ m_buttons
Items BuildMenuButton::m_buttons |
◆ m_destRect
ImVec4 BuildMenuButton::m_destRect |
◆ m_id
◆ m_open
bool BuildMenuButton::m_open = false |
◆ m_parent
◆ m_tex
SDL_Texture* BuildMenuButton::m_tex |
◆ m_texSize
ImSpan2i BuildMenuButton::m_texSize |
◆ m_texstr
◆ m_tiletype
◆ m_uv0
ImVec2 BuildMenuButton::m_uv0 = ImVec2{0, 0} |
◆ m_uv1
ImVec2 BuildMenuButton::m_uv1 = ImVec2{1, 1} |
The documentation for this struct was generated from the following files: