Change default menu logo

This commit is contained in:
Kae 2023-06-30 11:45:26 +10:00
parent 6be169679b
commit 33b980dacb
3 changed files with 9 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

View File

@ -0,0 +1,4 @@
{
"skyBackdropDarken" : [0, 0, 0, 64],
"backdropImages" : [ [ [0, 0], "/interface/title/starbound.png", 0.5, [0.5, 0.5] ] ]
}

View File

@ -79,17 +79,16 @@ void TitleScreen::render() {
m_renderer->flush(); m_renderer->flush();
for (auto backdropImage : assets->json("/interface/windowconfig/title.config:backdropImages").toArray()) { for (auto& backdropImage : assets->json("/interface/windowconfig/title.config:backdropImages").toArray()) {
Vec2F offset = jsonToVec2F(backdropImage.get(0)) * interfaceScale(); Vec2F offset = jsonToVec2F(backdropImage.get(0)) * interfaceScale();
String image = backdropImage.getString(1); String image = backdropImage.getString(1);
float scale = backdropImage.getFloat(2); float scale = backdropImage.getFloat(2);
Vec2F origin = jsonToVec2F(backdropImage.getArray(3, { 0.5f, 1.0f }));
Vec2F imageSize = Vec2F(m_guiContext->textureSize(image)) * interfaceScale() * scale; Vec2F imageSize = Vec2F(m_guiContext->textureSize(image)) * interfaceScale() * scale;
Vec2F lowerLeft = Vec2F(windowWidth() / 2.0f, windowHeight()); Vec2F position = Vec2F(m_guiContext->windowSize()).piecewiseMultiply(origin);
lowerLeft[0] -= imageSize[0] / 2; position += offset - imageSize.piecewiseMultiply(origin);
lowerLeft[1] -= imageSize[1]; RectF screenCoords(position, position + imageSize);
lowerLeft += offset;
RectF screenCoords(lowerLeft, lowerLeft + imageSize);
m_guiContext->drawQuad(image, screenCoords); m_guiContext->drawQuad(image, screenCoords);
} }