mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Some minor code cleanup.
This commit is contained in:
parent
039c27fa8e
commit
4ade04d760
|
@ -698,7 +698,7 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
|
||||||
|
|
||||||
void GuiMetaDataEd::onSizeChanged()
|
void GuiMetaDataEd::onSizeChanged()
|
||||||
{
|
{
|
||||||
const float titleSubtitleSpacing = mSize.y * 0.03f;
|
const float titleSubtitleSpacing {mSize.y * 0.03f};
|
||||||
|
|
||||||
mGrid.setRowHeightPerc(0, TITLE_HEIGHT / mSize.y / 2.0f);
|
mGrid.setRowHeightPerc(0, TITLE_HEIGHT / mSize.y / 2.0f);
|
||||||
mGrid.setRowHeightPerc(1, TITLE_HEIGHT / mSize.y / 2.0f);
|
mGrid.setRowHeightPerc(1, TITLE_HEIGHT / mSize.y / 2.0f);
|
||||||
|
@ -715,7 +715,7 @@ void GuiMetaDataEd::onSizeChanged()
|
||||||
(Renderer::getScreenHeight() - mSize.y) / 2.0f);
|
(Renderer::getScreenHeight() - mSize.y) / 2.0f);
|
||||||
|
|
||||||
// Add some extra margins to the file/folder name.
|
// Add some extra margins to the file/folder name.
|
||||||
const float newSizeX = mSize.x * 0.96f;
|
const float newSizeX {mSize.x * 0.96f};
|
||||||
mSubtitle->setSize(newSizeX, mSubtitle->getSize().y);
|
mSubtitle->setSize(newSizeX, mSubtitle->getSize().y);
|
||||||
mSubtitle->setPosition((mSize.x - newSizeX) / 2.0f, mSubtitle->getPosition().y);
|
mSubtitle->setPosition((mSize.x - newSizeX) / 2.0f, mSubtitle->getPosition().y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char* da
|
||||||
|
|
||||||
if (fiMemory != nullptr) {
|
if (fiMemory != nullptr) {
|
||||||
// Detect the filetype from data.
|
// Detect the filetype from data.
|
||||||
FREE_IMAGE_FORMAT format = FreeImage_GetFileTypeFromMemory(fiMemory);
|
FREE_IMAGE_FORMAT format {FreeImage_GetFileTypeFromMemory(fiMemory)};
|
||||||
if (format != FIF_UNKNOWN && FreeImage_FIFSupportsReading(format)) {
|
if (format != FIF_UNKNOWN && FreeImage_FIFSupportsReading(format)) {
|
||||||
// File type is supported, load image.
|
// File type is supported, load image.
|
||||||
FIBITMAP* fiBitmap = FreeImage_LoadFromMemory(format, fiMemory);
|
FIBITMAP* fiBitmap {FreeImage_LoadFromMemory(format, fiMemory)};
|
||||||
if (fiBitmap != nullptr) {
|
if (fiBitmap != nullptr) {
|
||||||
// Loaded. convert to 32-bit if necessary.
|
// Loaded. convert to 32-bit if necessary.
|
||||||
if (FreeImage_GetBPP(fiBitmap) != 32) {
|
if (FreeImage_GetBPP(fiBitmap) != 32) {
|
||||||
FIBITMAP* fiConverted = FreeImage_ConvertTo32Bits(fiBitmap);
|
FIBITMAP* fiConverted {FreeImage_ConvertTo32Bits(fiBitmap)};
|
||||||
if (fiConverted != nullptr) {
|
if (fiConverted != nullptr) {
|
||||||
// Free original bitmap data.
|
// Free original bitmap data.
|
||||||
FreeImage_Unload(fiBitmap);
|
FreeImage_Unload(fiBitmap);
|
||||||
|
@ -44,14 +44,14 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char* da
|
||||||
height = FreeImage_GetHeight(fiBitmap);
|
height = FreeImage_GetHeight(fiBitmap);
|
||||||
// Loop through scanlines and add all pixel data to the return vector.
|
// Loop through scanlines and add all pixel data to the return vector.
|
||||||
// This is necessary, because width*height*bpp might not be == pitch.
|
// This is necessary, because width*height*bpp might not be == pitch.
|
||||||
unsigned char* tempData = new unsigned char[width * height * 4];
|
unsigned char* tempData {new unsigned char[width * height * 4]};
|
||||||
for (size_t i = 0; i < height; ++i) {
|
for (size_t i = 0; i < height; ++i) {
|
||||||
const BYTE* scanLine = FreeImage_GetScanLine(fiBitmap, static_cast<int>(i));
|
const BYTE* scanLine {FreeImage_GetScanLine(fiBitmap, static_cast<int>(i))};
|
||||||
memcpy(tempData + (i * width * 4), scanLine, width * 4);
|
memcpy(tempData + (i * width * 4), scanLine, width * 4);
|
||||||
}
|
}
|
||||||
// Convert from BGRA to RGBA.
|
// Convert from BGRA to RGBA.
|
||||||
for (size_t i = 0; i < width * height; ++i) {
|
for (size_t i = 0; i < width * height; ++i) {
|
||||||
RGBQUAD bgra = reinterpret_cast<RGBQUAD*>(tempData)[i];
|
RGBQUAD bgra {reinterpret_cast<RGBQUAD*>(tempData)[i]};
|
||||||
RGBQUAD rgba;
|
RGBQUAD rgba;
|
||||||
rgba.rgbBlue = bgra.rgbRed;
|
rgba.rgbBlue = bgra.rgbRed;
|
||||||
rgba.rgbGreen = bgra.rgbGreen;
|
rgba.rgbGreen = bgra.rgbGreen;
|
||||||
|
@ -59,7 +59,7 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char* da
|
||||||
rgba.rgbReserved = bgra.rgbReserved;
|
rgba.rgbReserved = bgra.rgbReserved;
|
||||||
reinterpret_cast<RGBQUAD*>(tempData)[i] = rgba;
|
reinterpret_cast<RGBQUAD*>(tempData)[i] = rgba;
|
||||||
}
|
}
|
||||||
rawData = std::vector<unsigned char>(tempData, tempData + width * height * 4);
|
rawData = std::vector<unsigned char> {tempData, tempData + width * height * 4};
|
||||||
// Free bitmap data.
|
// Free bitmap data.
|
||||||
FreeImage_Unload(fiBitmap);
|
FreeImage_Unload(fiBitmap);
|
||||||
delete[] tempData;
|
delete[] tempData;
|
||||||
|
@ -82,7 +82,7 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char* da
|
||||||
void ImageIO::flipPixelsVert(unsigned char* imagePx, const size_t& width, const size_t& height)
|
void ImageIO::flipPixelsVert(unsigned char* imagePx, const size_t& width, const size_t& height)
|
||||||
{
|
{
|
||||||
unsigned int temp;
|
unsigned int temp;
|
||||||
unsigned int* arr = reinterpret_cast<unsigned int*>(imagePx);
|
unsigned int* arr {reinterpret_cast<unsigned int*>(imagePx)};
|
||||||
for (size_t y = 0; y < height / 2; ++y) {
|
for (size_t y = 0; y < height / 2; ++y) {
|
||||||
for (size_t x = 0; x < width; ++x) {
|
for (size_t x = 0; x < width; ++x) {
|
||||||
temp = arr[x + (y * width)];
|
temp = arr[x + (y * width)];
|
||||||
|
|
|
@ -63,8 +63,8 @@ float ComponentGrid::getRowHeight(int row)
|
||||||
return mRowHeights[row] * mSize.y;
|
return mRowHeights[row] * mSize.y;
|
||||||
|
|
||||||
// Calculate automatic height.
|
// Calculate automatic height.
|
||||||
float freeHeightPerc = 1;
|
float freeHeightPerc {1.0f};
|
||||||
int between = 0;
|
int between {0};
|
||||||
for (int y = 0; y < mGridSize.y; ++y) {
|
for (int y = 0; y < mGridSize.y; ++y) {
|
||||||
freeHeightPerc -= mRowHeights[y]; // If it's 0 it won't do anything.
|
freeHeightPerc -= mRowHeights[y]; // If it's 0 it won't do anything.
|
||||||
if (mRowHeights[y] == 0)
|
if (mRowHeights[y] == 0)
|
||||||
|
@ -105,7 +105,7 @@ void ComponentGrid::setEntry(const std::shared_ptr<GuiComponent>& comp,
|
||||||
assert(comp != nullptr);
|
assert(comp != nullptr);
|
||||||
assert(comp->getParent() == nullptr);
|
assert(comp->getParent() == nullptr);
|
||||||
|
|
||||||
GridEntry entry(pos, size, comp, canFocus, resize, updateType, border);
|
GridEntry entry {pos, size, comp, canFocus, resize, updateType, border};
|
||||||
mCells.push_back(entry);
|
mCells.push_back(entry);
|
||||||
|
|
||||||
addChild(comp.get());
|
addChild(comp.get());
|
||||||
|
@ -163,7 +163,7 @@ void ComponentGrid::updateSeparators()
|
||||||
{
|
{
|
||||||
mSeparators.clear();
|
mSeparators.clear();
|
||||||
|
|
||||||
bool drawAll = Settings::getInstance()->getBool("DebugGrid");
|
bool drawAll {Settings::getInstance()->getBool("DebugGrid")};
|
||||||
|
|
||||||
glm::vec2 pos;
|
glm::vec2 pos;
|
||||||
glm::vec2 size;
|
glm::vec2 size;
|
||||||
|
@ -173,8 +173,8 @@ void ComponentGrid::updateSeparators()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Find component position + size.
|
// Find component position + size.
|
||||||
pos = glm::vec2 {};
|
pos = glm::vec2 {0.0f, 0.0f};
|
||||||
size = glm::vec2 {};
|
size = glm::vec2 {0.0f, 0.0f};
|
||||||
for (int x = 0; x < it->pos.x; ++x)
|
for (int x = 0; x < it->pos.x; ++x)
|
||||||
pos[0] += getColWidth(x);
|
pos[0] += getColWidth(x);
|
||||||
for (int y = 0; y < it->pos.y; ++y)
|
for (int y = 0; y < it->pos.y; ++y)
|
||||||
|
@ -184,7 +184,7 @@ void ComponentGrid::updateSeparators()
|
||||||
for (int y = it->pos.y; y < it->pos.y + it->dim.y; ++y)
|
for (int y = it->pos.y; y < it->pos.y + it->dim.y; ++y)
|
||||||
size[1] += getRowHeight(y);
|
size[1] += getRowHeight(y);
|
||||||
|
|
||||||
if (size == glm::vec2 {})
|
if (size == glm::vec2 {0.0f, 0.0f})
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (it->border & BORDER_TOP || drawAll) {
|
if (it->border & BORDER_TOP || drawAll) {
|
||||||
|
@ -235,10 +235,10 @@ const ComponentGrid::GridEntry* ComponentGrid::getCellAt(int x, int y) const
|
||||||
assert(x >= 0 && x < mGridSize.x && y >= 0 && y < mGridSize.y);
|
assert(x >= 0 && x < mGridSize.x && y >= 0 && y < mGridSize.y);
|
||||||
|
|
||||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||||
int xmin = it->pos.x;
|
int xmin {it->pos.x};
|
||||||
int xmax = xmin + it->dim.x;
|
int xmax {xmin + it->dim.x};
|
||||||
int ymin = it->pos.y;
|
int ymin {it->pos.y};
|
||||||
int ymax = ymin + it->dim.y;
|
int ymax {ymin + it->dim.y};
|
||||||
|
|
||||||
if (x >= xmin && y >= ymin && x < xmax && y < ymax)
|
if (x >= xmin && y >= ymin && x < xmax && y < ymax)
|
||||||
return &(*it);
|
return &(*it);
|
||||||
|
@ -249,14 +249,14 @@ const ComponentGrid::GridEntry* ComponentGrid::getCellAt(int x, int y) const
|
||||||
|
|
||||||
bool ComponentGrid::input(InputConfig* config, Input input)
|
bool ComponentGrid::input(InputConfig* config, Input input)
|
||||||
{
|
{
|
||||||
const GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry {getCellAt(mCursor)};
|
||||||
if (cursorEntry && cursorEntry->component->input(config, input))
|
if (cursorEntry && cursorEntry->component->input(config, input))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!input.value)
|
if (!input.value)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool withinBoundary = false;
|
bool withinBoundary {false};
|
||||||
|
|
||||||
if (config->isMappedLike("down", input))
|
if (config->isMappedLike("down", input))
|
||||||
withinBoundary = moveCursor(glm::ivec2 {0, 1});
|
withinBoundary = moveCursor(glm::ivec2 {0, 1});
|
||||||
|
@ -283,7 +283,7 @@ void ComponentGrid::resetCursor()
|
||||||
|
|
||||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||||
if (it->canFocus) {
|
if (it->canFocus) {
|
||||||
glm::ivec2 origCursor = mCursor;
|
glm::ivec2 origCursor {mCursor};
|
||||||
mCursor = it->pos;
|
mCursor = it->pos;
|
||||||
onCursorMoved(origCursor, mCursor);
|
onCursorMoved(origCursor, mCursor);
|
||||||
break;
|
break;
|
||||||
|
@ -296,8 +296,8 @@ bool ComponentGrid::moveCursor(glm::ivec2 dir)
|
||||||
assert(dir.x || dir.y);
|
assert(dir.x || dir.y);
|
||||||
|
|
||||||
const glm::ivec2 origCursor {mCursor};
|
const glm::ivec2 origCursor {mCursor};
|
||||||
const GridEntry* currentCursorEntry = getCellAt(mCursor);
|
const GridEntry* currentCursorEntry {getCellAt(mCursor)};
|
||||||
glm::ivec2 searchAxis(dir.x == 0, dir.y == 0);
|
glm::ivec2 searchAxis {dir.x == 0, dir.y == 0};
|
||||||
|
|
||||||
// Logic to handle entries that span several cells.
|
// Logic to handle entries that span several cells.
|
||||||
if (currentCursorEntry->dim.x > 1) {
|
if (currentCursorEntry->dim.x > 1) {
|
||||||
|
@ -392,28 +392,28 @@ void ComponentGrid::moveCursorTo(int xPos, int yPos, bool selectLeftCell)
|
||||||
|
|
||||||
void ComponentGrid::onFocusLost()
|
void ComponentGrid::onFocusLost()
|
||||||
{
|
{
|
||||||
const GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry {getCellAt(mCursor)};
|
||||||
if (cursorEntry)
|
if (cursorEntry)
|
||||||
cursorEntry->component->onFocusLost();
|
cursorEntry->component->onFocusLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentGrid::onFocusGained()
|
void ComponentGrid::onFocusGained()
|
||||||
{
|
{
|
||||||
const GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry {getCellAt(mCursor)};
|
||||||
if (cursorEntry)
|
if (cursorEntry)
|
||||||
cursorEntry->component->onFocusGained();
|
cursorEntry->component->onFocusGained();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ComponentGrid::cursorValid()
|
bool ComponentGrid::cursorValid()
|
||||||
{
|
{
|
||||||
const GridEntry* e = getCellAt(mCursor);
|
const GridEntry* e {getCellAt(mCursor)};
|
||||||
return (e != nullptr && e->canFocus);
|
return (e != nullptr && e->canFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentGrid::update(int deltaTime)
|
void ComponentGrid::update(int deltaTime)
|
||||||
{
|
{
|
||||||
// Update everything.
|
// Update everything.
|
||||||
const GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry {getCellAt(mCursor)};
|
||||||
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
for (auto it = mCells.cbegin(); it != mCells.cend(); ++it) {
|
||||||
if (it->updateType == UPDATE_ALWAYS ||
|
if (it->updateType == UPDATE_ALWAYS ||
|
||||||
(it->updateType == UPDATE_WHEN_SELECTED && cursorEntry == &(*it))) {
|
(it->updateType == UPDATE_WHEN_SELECTED && cursorEntry == &(*it))) {
|
||||||
|
@ -438,14 +438,14 @@ void ComponentGrid::render(const glm::mat4& parentTrans)
|
||||||
|
|
||||||
void ComponentGrid::textInput(const std::string& text)
|
void ComponentGrid::textInput(const std::string& text)
|
||||||
{
|
{
|
||||||
const GridEntry* selectedEntry = getCellAt(mCursor);
|
const GridEntry* selectedEntry {getCellAt(mCursor)};
|
||||||
if (selectedEntry != nullptr && selectedEntry->canFocus)
|
if (selectedEntry != nullptr && selectedEntry->canFocus)
|
||||||
selectedEntry->component->textInput(text);
|
selectedEntry->component->textInput(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentGrid::onCursorMoved(glm::ivec2 from, glm::ivec2 to)
|
void ComponentGrid::onCursorMoved(glm::ivec2 from, glm::ivec2 to)
|
||||||
{
|
{
|
||||||
const GridEntry* cell = getCellAt(from);
|
const GridEntry* cell {getCellAt(from)};
|
||||||
if (cell)
|
if (cell)
|
||||||
cell->component->onFocusLost();
|
cell->component->onFocusLost();
|
||||||
|
|
||||||
|
@ -474,22 +474,22 @@ void ComponentGrid::setCursorTo(const std::shared_ptr<GuiComponent>& comp)
|
||||||
std::vector<HelpPrompt> ComponentGrid::getHelpPrompts()
|
std::vector<HelpPrompt> ComponentGrid::getHelpPrompts()
|
||||||
{
|
{
|
||||||
std::vector<HelpPrompt> prompts;
|
std::vector<HelpPrompt> prompts;
|
||||||
const GridEntry* e = getCellAt(mCursor);
|
const GridEntry* e {getCellAt(mCursor)};
|
||||||
if (e)
|
if (e)
|
||||||
prompts = e->component->getHelpPrompts();
|
prompts = e->component->getHelpPrompts();
|
||||||
|
|
||||||
bool canScrollVert = false;
|
bool canScrollVert {false};
|
||||||
|
|
||||||
// If the currently selected cell does not fill the entire Y axis, then check if the cells
|
// If the currently selected cell does not fill the entire Y axis, then check if the cells
|
||||||
// above or below are actually focusable as otherwise they should not affect the help prompts.
|
// above or below are actually focusable as otherwise they should not affect the help prompts.
|
||||||
if (mGridSize.y > 1 && e->dim.y < mGridSize.y) {
|
if (mGridSize.y > 1 && e->dim.y < mGridSize.y) {
|
||||||
if (e->pos.y - e->dim.y >= 0) {
|
if (e->pos.y - e->dim.y >= 0) {
|
||||||
const GridEntry* cell = getCellAt(glm::ivec2 {e->pos.x, e->pos.y - e->dim.y});
|
const GridEntry* cell {getCellAt(glm::ivec2 {e->pos.x, e->pos.y - e->dim.y})};
|
||||||
if (cell != nullptr && cell->canFocus)
|
if (cell != nullptr && cell->canFocus)
|
||||||
canScrollVert = true;
|
canScrollVert = true;
|
||||||
}
|
}
|
||||||
if (e->pos.y + e->dim.y < mGridSize.y) {
|
if (e->pos.y + e->dim.y < mGridSize.y) {
|
||||||
const GridEntry* cell = getCellAt(glm::ivec2 {e->pos.x, e->pos.y + e->dim.y});
|
const GridEntry* cell {getCellAt(glm::ivec2 {e->pos.x, e->pos.y + e->dim.y})};
|
||||||
if (cell != nullptr && cell->canFocus)
|
if (cell != nullptr && cell->canFocus)
|
||||||
canScrollVert = true;
|
canScrollVert = true;
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ std::vector<HelpPrompt> ComponentGrid::getHelpPrompts()
|
||||||
// There is currently no situation in the application where unfocusable cells are located
|
// There is currently no situation in the application where unfocusable cells are located
|
||||||
// next to each other horizontally, so this code is good enough. If this changes in the
|
// next to each other horizontally, so this code is good enough. If this changes in the
|
||||||
// future, code similar to the the vertical cell handling above needs to be added.
|
// future, code similar to the the vertical cell handling above needs to be added.
|
||||||
bool canScrollHoriz = (mGridSize.x > 1 && e->dim.x < mGridSize.x);
|
bool canScrollHoriz {mGridSize.x > 1 && e->dim.x < mGridSize.x};
|
||||||
|
|
||||||
// Check existing capabilities as indicated by the help prompts, and if the prompts should
|
// Check existing capabilities as indicated by the help prompts, and if the prompts should
|
||||||
// be combined into "up/down/left/right" then also remove the single-axis prompts.
|
// be combined into "up/down/left/right" then also remove the single-axis prompts.
|
||||||
|
|
|
@ -91,15 +91,15 @@ float MenuComponent::getButtonGridHeight() const
|
||||||
|
|
||||||
void MenuComponent::updateSize()
|
void MenuComponent::updateSize()
|
||||||
{
|
{
|
||||||
const float maxHeight = Renderer::getScreenHeight() * 0.80f;
|
const float maxHeight {Renderer::getScreenHeight() * 0.80f};
|
||||||
float height = TITLE_HEIGHT + mList->getTotalRowHeight() + getButtonGridHeight() +
|
float height {TITLE_HEIGHT + mList->getTotalRowHeight() + getButtonGridHeight() +
|
||||||
(2.0f * Renderer::getScreenHeightModifier());
|
(2.0f * Renderer::getScreenHeightModifier())};
|
||||||
if (height > maxHeight) {
|
if (height > maxHeight) {
|
||||||
height = TITLE_HEIGHT + getButtonGridHeight();
|
height = TITLE_HEIGHT + getButtonGridHeight();
|
||||||
int i = 0;
|
int i {0};
|
||||||
while (i < mList->size()) {
|
while (i < mList->size()) {
|
||||||
// Add the separator height to the row height so that it also gets properly rendered.
|
// Add the separator height to the row height so that it also gets properly rendered.
|
||||||
float rowHeight = mList->getRowHeight(i) + (1.0f * Renderer::getScreenHeightModifier());
|
float rowHeight {mList->getRowHeight(i) + (1.0f * Renderer::getScreenHeightModifier())};
|
||||||
if (height + rowHeight < maxHeight)
|
if (height + rowHeight < maxHeight)
|
||||||
height += rowHeight;
|
height += rowHeight;
|
||||||
else
|
else
|
||||||
|
@ -161,11 +161,11 @@ void MenuComponent::updateGrid()
|
||||||
std::shared_ptr<ComponentGrid> makeButtonGrid(
|
std::shared_ptr<ComponentGrid> makeButtonGrid(
|
||||||
const std::vector<std::shared_ptr<ButtonComponent>>& buttons)
|
const std::vector<std::shared_ptr<ButtonComponent>>& buttons)
|
||||||
{
|
{
|
||||||
std::shared_ptr<ComponentGrid> buttonGrid =
|
std::shared_ptr<ComponentGrid> buttonGrid {
|
||||||
std::make_shared<ComponentGrid>(glm::ivec2 {static_cast<int>(buttons.size()), 2});
|
std::make_shared<ComponentGrid>(glm::ivec2 {static_cast<int>(buttons.size()), 2})};
|
||||||
|
|
||||||
// Initialize to padding.
|
// Initialize to padding.
|
||||||
float buttonGridWidth = BUTTON_GRID_HORIZ_PADDING * buttons.size();
|
float buttonGridWidth {BUTTON_GRID_HORIZ_PADDING * buttons.size()};
|
||||||
|
|
||||||
for (int i = 0; i < static_cast<int>(buttons.size()); ++i) {
|
for (int i = 0; i < static_cast<int>(buttons.size()); ++i) {
|
||||||
buttonGrid->setEntry(buttons.at(i), glm::ivec2 {i, 0}, true, false);
|
buttonGrid->setEntry(buttons.at(i), glm::ivec2 {i, 0}, true, false);
|
||||||
|
|
Loading…
Reference in a new issue