-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom logo on the custom titlebar #75
Comments
Hello @AdamAlNajar , Firstly, it is important that you fork the repository, even if you are using it as a submodule for any application you might build upon Walnut. I wasn't able to expose the GUI settings to the application itself, so changing the code from the Walnut submodule was a more practical solution to me. The GUI is controlled by the // Logo
{
const int logoWidth = 30;// m_LogoTex->GetWidth();
const int logoHeight = 30;// m_LogoTex->GetHeight();
const ImVec2 logoOffset(16.0f + windowPadding.x, 12.0f + windowPadding.y + titlebarVerticalOffset);
const ImVec2 logoRectStart = { ImGui::GetItemRectMin().x + logoOffset.x, ImGui::GetItemRectMin().y + logoOffset.y };
const ImVec2 logoRectMax = { logoRectStart.x + logoWidth, logoRectStart.y + logoHeight };
fgDrawList->AddImage(m_AppHeaderIcon->GetDescriptorSet(), logoRectStart, logoRectMax);
} As you can see, this part of the code will stablish the The // Load images
{
uint32_t w, h;
void* data = Image::Decode(g_WalnutIcon, sizeof(g_WalnutIcon), w, h);
m_AppHeaderIcon = std::make_shared<Walnut::Image>(w, h, ImageFormat::RGBA, data);
free(data);
} This means the My application logo to the converted HEX array in the Walnut-Icon.embed file looks like this (I just left it named const uint8_t g_WalnutIcon[] =
{
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x0a, 0x08, 0x06, 0x00, 0x00, 0x00, 0x5b, 0x97, 0x15,
0xd8, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b,
0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x01,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, 0xf8, 0x9b, 0xb8, 0xc7, 0x81, 0x8e, 0x0f, 0xe5, 0x1b, 0xee, 0xfe, 0x50,
0x98, 0x28, 0x90, 0x8e, 0x44, 0xc7, 0x2f, 0x95, 0xff, 0x70, 0x43, 0xbb, 0xea, 0xd5, 0xcf, 0x9f,
0x35, 0xee, 0x17, 0x54, 0x7d, 0xe2, 0xb2, 0xed, 0x76, 0xab, 0x73, 0x00, 0x00, 0x00, 0x00, 0x49,
0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
}; After some tweaking in the TL;DR/In-a-Hurry: Basically you just have to convert your PNG binary to a hexadecimal array, place it into the Hope this helps! |
Hi, i want to put a custom logo of mine on the custom titlebar, if you didnt understand :
i want to change the Walnut logo on the custom titlebar for my logo :
i also have a few questions :
how do i need to format my image?
do i need to make custom images for each size?
what do i need to change in my code?
what else do i need?
The text was updated successfully, but these errors were encountered: