Skip to content

Misc gui fixes #200

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

Merged
merged 6 commits into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,9 @@ int main(int argc, char** argv) {

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD );

#if SDL_MINOR_VERSION > 22
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "0");
#endif

SDL_HideCursor();
SDL_SetHint("SDL_ALLOW_TOPMOST", "0");
SDL_HideCursor();

if (std::filesystem::exists("Base.rte/gamecontrollerdb.txt")) {
SDL_AddGamepadMappingsFromFile("Base.rte/gamecontrollerdb.txt");
Expand Down
6 changes: 4 additions & 2 deletions Source/Managers/GLResourceMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,7 @@ GLuint GLResourceMan::UpdateDynamicBitmap(BITMAP* bitmap, bool updated, const st

void GLResourceMan::DestroyBitmapInfo(BITMAP* bitmap) {
GLBitmapInfo* info = GetBitmapInfo(bitmap);
rlUnloadTexture(info->m_Texture);
}
if (info) {
rlUnloadTexture(info->m_Texture);
}
}
2 changes: 1 addition & 1 deletion Source/Managers/WindowMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void WindowMan::Initialize() {
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;

ImGui::StyleColorsDark();
ImGui_ImplSDL3_InitForOpenGL(m_PrimaryWindow.get(), m_GLContext.get());
Expand Down
17 changes: 5 additions & 12 deletions Source/Menus/LoadingScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,11 @@ void LoadingScreen::CreateLoadingSplash(int xOffset) {
m_LoadingBackground->Create(ContentFile("Base.rte/GUIs/Title/LoadingSplash.png").GetAsBitmap(COLORCONV_NONE, false), false, Vector(), true, false, Vector(1.0F, 0));
m_LoadingBackground->SetOffset(Vector(static_cast<float>(((m_LoadingBackground->GetBitmap()->w - g_WindowMan.GetResX()) / 2) + xOffset), 0));

Box loadingSplashTargetBox(Vector(0, static_cast<float>((g_WindowMan.GetResY() - m_LoadingBackground->GetBitmap()->h) / 2)), static_cast<float>(g_WindowMan.GetResX()), static_cast<float>(m_LoadingBackground->GetBitmap()->h));
RenderTarget defaultTarget{
FloatRect(0, 0, g_WindowMan.GetResX(), g_WindowMan.GetResY()),
FloatRect(0, 0, g_WindowMan.GetResX(), g_WindowMan.GetResY()),
0,
Texture2D(),
true
};
defaultTarget.Begin();
g_WindowMan.ClearBackbuffer();
Box loadingSplashTargetBox(Vector(0, static_cast<float>((g_WindowMan.GetResY() - g_LoadingScreen.m_LoadingBackground->GetBitmap()->h) / 2)), static_cast<float>(g_WindowMan.GetResX()), static_cast<float>(g_LoadingScreen.m_LoadingBackground->GetBitmap()->h));
g_WindowMan.ClearBackbuffer(false);
g_WindowMan.GetScreenBuffer()->Begin();
m_LoadingBackground->Draw(loadingSplashTargetBox, loadingSplashTargetBox);
rlDrawRenderBatchActive();
g_WindowMan.Present();
g_WindowMan.UploadFrame();
}

void LoadingScreen::CreateProgressReportListbox(GUIControlManager* parentControlManager) {
Expand Down Expand Up @@ -152,6 +144,7 @@ void LoadingScreen::LoadingSplashProgressReport(const std::string& reportString,
blit(g_LoadingScreen.m_ProgressListboxBitmap, g_FrameMan.GetBackBuffer32(), 0, 0, g_LoadingScreen.m_ProgressListboxPosX, g_LoadingScreen.m_ProgressListboxPosY, g_LoadingScreen.m_ProgressListboxBitmap->w, g_LoadingScreen.m_ProgressListboxBitmap->h);

Box loadingSplashTargetBox(Vector(0, static_cast<float>((g_WindowMan.GetResY() - g_LoadingScreen.m_LoadingBackground->GetBitmap()->h) / 2)), static_cast<float>(g_WindowMan.GetResX()), static_cast<float>(g_LoadingScreen.m_LoadingBackground->GetBitmap()->h));

g_WindowMan.ClearBackbuffer(false);
g_WindowMan.GetScreenBuffer()->Begin();
g_LoadingScreen.m_LoadingBackground->Draw(loadingSplashTargetBox, loadingSplashTargetBox);
Expand Down
4 changes: 2 additions & 2 deletions Source/Renderer/raylib/rlutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
static int logTypeLevel = LOG_INFO; // Minimum log type level
static int logTypeLevel = LOG_ERROR; // Minimum log type level

static TraceLogCallback traceLog = NULL; // TraceLog callback function pointer
static LoadFileDataCallback loadFileData = NULL; // LoadFileData callback function pointer
Expand Down Expand Up @@ -509,4 +509,4 @@ static int android_close(void *cookie)
}
#endif // PLATFORM_ANDROID

#endif
#endif
28 changes: 13 additions & 15 deletions Source/System/ContentFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,18 @@ void ContentFile::GetAsAnimation(std::vector<BITMAP*>& vectorToFill, int frameCo
}
}
SDL_Palette* ContentFile::DefaultPaletteToSDL() {
SDL_Palette* palette = SDL_CreatePalette(256);
std::array<SDL_Color, 256> paletteColor;
PALETTE currentPalette;
get_palette(currentPalette);
paletteColor[0] = {.r = 0, .g = 0, .b = 0, .a = 0};
for (size_t i = 1; i < paletteColor.size(); ++i) {
paletteColor[i].r = currentPalette[i].r;
paletteColor[i].g = currentPalette[i].g;
paletteColor[i].b = currentPalette[i].b;
paletteColor[i].a = 255;
}
SDL_SetPaletteColors(palette, paletteColor.data(), 0, 256);
return palette;
SDL_Palette* palette = SDL_CreatePalette(256);
std::array<SDL_Color, 256> paletteColor;
const PALETTE& defaultPalette = g_FrameMan.GetDefaultPalette();
paletteColor[0] = {.r = 0, .g = 0, .b = 0, .a = 0};
for (size_t i = 1; i < paletteColor.size(); ++i) {
paletteColor[i].r = defaultPalette[i].r;
paletteColor[i].g = defaultPalette[i].g;
paletteColor[i].b = defaultPalette[i].b;
paletteColor[i].a = 255;
}
SDL_SetPaletteColors(palette, paletteColor.data(), 0, 256);
return palette;
}

SDL_Surface* ContentFile::LoadImageAsSurface(int conversionMode, const std::string& dataPathToLoad) {
Expand All @@ -286,7 +285,6 @@ SDL_Surface* ContentFile::LoadImageAsSurface(int conversionMode, const std::stri
image = newImage;
bitDepth = 8;
} else if (bitDepth != 8 || convert8To32) {

SDL_Palette* palette = DefaultPaletteToSDL();
if (SDL_GetPixelFormatDetails(image->format)->bits_per_pixel == 8) {
SDL_SetSurfacePalette(image, palette);
Expand All @@ -312,7 +310,7 @@ BITMAP* ContentFile::LoadAndReleaseBitmap(int conversionMode, const std::string&
int bitDepth = SDL_GetPixelFormatDetails(image->format)->bits_per_pixel;

BITMAP* returnBitmap = create_bitmap_ex(bitDepth, image->w, image->h);

// allegro doesn't (always) align lines to 4byte, so copy line by line. SDL_Surface.pitch is the size in bytes per line + alignment padding.
for (int y = 0; y < image->h; ++y) {
memcpy(returnBitmap->line[y], static_cast<unsigned char*>(image->pixels) + image->pitch * y, image->w * SDL_GetPixelFormatDetails(image->format)->bytes_per_pixel);
Expand Down