mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 17:45:38 +00:00
Properly fill in display_width and display_height for 0 now.
This commit is contained in:
parent
bed9c1fbb5
commit
bde5b6888f
|
@ -40,6 +40,13 @@ namespace Renderer
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
//SDL_GL_SetSwapInterval(1); //0 for immediate updates, 1 for updates synchronized with the vertical retrace, -1 for late swap tearing
|
//SDL_GL_SetSwapInterval(1); //0 for immediate updates, 1 for updates synchronized with the vertical retrace, -1 for late swap tearing
|
||||||
|
|
||||||
|
SDL_DisplayMode dispMode;
|
||||||
|
SDL_GetDisplayMode(0, 0, &dispMode);
|
||||||
|
if(display_width == 0)
|
||||||
|
display_width = dispMode.w;
|
||||||
|
if(display_height == 0)
|
||||||
|
display_height = dispMode.h;
|
||||||
|
|
||||||
sdlWindow = SDL_CreateWindow("EmulationStation",
|
sdlWindow = SDL_CreateWindow("EmulationStation",
|
||||||
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
||||||
display_width, display_height,
|
display_width, display_height,
|
||||||
|
|
|
@ -84,6 +84,8 @@ void ComponentListComponent::setEntry(Eigen::Vector2i pos, Eigen::Vector2i size,
|
||||||
updateCellSize(&mEntries.back(), autoFit.x(), autoFit.y());
|
updateCellSize(&mEntries.back(), autoFit.x(), autoFit.y());
|
||||||
|
|
||||||
component->setPosition(getCellOffset(pos));
|
component->setPosition(getCellOffset(pos));
|
||||||
|
|
||||||
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentListComponent::forceRowHeight(int row, unsigned int size)
|
void ComponentListComponent::forceRowHeight(int row, unsigned int size)
|
||||||
|
@ -91,6 +93,7 @@ void ComponentListComponent::forceRowHeight(int row, unsigned int size)
|
||||||
mRowHeights[row] = size;
|
mRowHeights[row] = size;
|
||||||
mRowHeightForced[row] = true;
|
mRowHeightForced[row] = true;
|
||||||
updateSize();
|
updateSize();
|
||||||
|
updateComponentOffsets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentListComponent::forceColumnWidth(int col, unsigned int size)
|
void ComponentListComponent::forceColumnWidth(int col, unsigned int size)
|
||||||
|
@ -98,6 +101,7 @@ void ComponentListComponent::forceColumnWidth(int col, unsigned int size)
|
||||||
mColumnWidths[col] = size;
|
mColumnWidths[col] = size;
|
||||||
mRowHeightForced[col] = true;
|
mRowHeightForced[col] = true;
|
||||||
updateSize();
|
updateSize();
|
||||||
|
updateComponentOffsets();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ComponentListComponent::getRowHeight(int row) { return mRowHeights[row]; }
|
unsigned int ComponentListComponent::getRowHeight(int row) { return mRowHeights[row]; }
|
||||||
|
@ -218,6 +222,7 @@ void ComponentListComponent::updateCellSize(ComponentEntry* e, bool updWidth, bo
|
||||||
}
|
}
|
||||||
|
|
||||||
updateComponentOffsets();
|
updateComponentOffsets();
|
||||||
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentListComponent::updateComponent(GuiComponent* cmp)
|
void ComponentListComponent::updateComponent(GuiComponent* cmp)
|
||||||
|
@ -405,7 +410,7 @@ void ComponentListComponent::render(const Eigen::Affine3f& parentTrans)
|
||||||
Renderer::setMatrix(entryTrans);
|
Renderer::setMatrix(entryTrans);
|
||||||
|
|
||||||
Renderer::drawRect(0, 0, 4, 4, 0xFF0000FF);
|
Renderer::drawRect(0, 0, 4, 4, 0xFF0000FF);
|
||||||
Renderer::drawRect(0, 0, (int)entry->component->getSize().x(), (int)entry->component->getSize().y(), 0x0000AA88);
|
Renderer::drawRect(0, 0, (int)entry->component->getSize().x(), (int)entry->component->getSize().y(), 0x0000AA22);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,8 @@ GuiGameEd::GuiGameEd(Window* window, GameData* game, const std::vector<MetaDataD
|
||||||
|
|
||||||
//initialize metadata list
|
//initialize metadata list
|
||||||
addChild(&mList);
|
addChild(&mList);
|
||||||
mList.setPosition(0, mPathDisp.getSize().y() + 4);
|
|
||||||
mList.setSize(mSize.x(), mSize.y() - mList.getPosition().y());
|
|
||||||
populateList(mdd);
|
populateList(mdd);
|
||||||
|
mList.setPosition((mSize.x() - mList.getSize().x()) / 2, mPathDisp.getSize().y() + 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiGameEd::~GuiGameEd()
|
GuiGameEd::~GuiGameEd()
|
||||||
|
@ -83,7 +82,7 @@ void GuiGameEd::populateList(const std::vector<MetaDataDecl>& mdd)
|
||||||
mGeneratedComponents.push_back(label);
|
mGeneratedComponents.push_back(label);
|
||||||
|
|
||||||
GuiComponent* ed = MetaDataList::makeEditor(mWindow, iter->type);
|
GuiComponent* ed = MetaDataList::makeEditor(mWindow, iter->type);
|
||||||
ed->setSize(ed->getSize().x(), 256);
|
ed->setSize(mSize.x() / 2, ed->getSize().y());
|
||||||
ed->setValue(mGame->metadata()->get(iter->key));
|
ed->setValue(mGame->metadata()->get(iter->key));
|
||||||
mList.setEntry(Vector2i(1, y), Vector2i(1, 1), ed, true, ComponentListComponent::AlignRight);
|
mList.setEntry(Vector2i(1, y), Vector2i(1, 1), ed, true, ComponentListComponent::AlignRight);
|
||||||
mGeneratedComponents.push_back(ed);
|
mGeneratedComponents.push_back(ed);
|
||||||
|
|
|
@ -73,7 +73,7 @@ void TextEditComponent::onTextChanged()
|
||||||
{
|
{
|
||||||
float y = getFont()->sizeWrappedText(mText, mSize.x()).y();
|
float y = getFont()->sizeWrappedText(mText, mSize.x()).y();
|
||||||
if(y == 0)
|
if(y == 0)
|
||||||
y = getFont()->getHeight();
|
y = (float)getFont()->getHeight();
|
||||||
|
|
||||||
setSize(mSize.x(), y);
|
setSize(mSize.x(), y);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue