Skip to content
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

Transparent issue #7608

Closed
UniqueNotDB opened this issue May 20, 2024 · 3 comments
Closed

Transparent issue #7608

UniqueNotDB opened this issue May 20, 2024 · 3 comments

Comments

@UniqueNotDB
Copy link

Version/Branch of Dear ImGui:

Version 1.XX, Branch: XXX (master/docking/etc.)

Back-ends:

imgui_impl_XXX.cpp + imgui_impl_XXX.cpp

Compiler, OS:

Windows 11, Visual Studio

Full config/build information:

No response

Details:

ok so in my imgui im setting the alpha to 1.f but its still a little transparent

Screenshots/Video:

Screenshot 2024-05-19 230555

Minimal, Complete and Verifiable Example code:

#include "../Header Files/menu.hh" 
using namespace ImGui;
#include "../Header Files/globals.hh"
#include "../imgui/imgui_internal.h"
#include "../imgui/imgui.h"
#include "../font/icons.h"
#include "../font/Effects.h"
//#include "../font/fade.h"

char key[256];
bool binit = false;
bool open = true;
static void HelpMarker(const char* desc);
void CenterText(const char* text);

void ui::renderMenu() {
    if (!globals.active) return;

    //ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Once);
    ImGui::SetNextWindowSize(ImVec2(650, 400));
    ImGui::Begin("2nd atempt at this shit cause old src got fucked", &open, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar);
    if (!binit) {
        DrawMainParticles();
    }
    ImGui::SetCursorPosX(0);
    ImGui::SetCursorPosY(0);
    ImGui::BeginChild("##sidebar", ImVec2(100, 400));
    ImGui::EndChild();
    float windowWidth = ImGui::GetWindowWidth();
    ImGui::SetCursorPosX((ImGui::GetWindowWidth() - 170) * 0.5f);
    ImGui::SetCursorPosY((ImGui::GetWindowWidth() - 170) * 0.5f);
    if (ImGui::Button("Login", ImVec2(170, 30))) {
        //std::thread(fadein_thenout_thread, 10).detach();
    }
    ImGui::End();
}

void ui::RunStyle()
{
    ImGuiStyle* style = &ImGui::GetStyle();
    style->Colors[ImGuiCol_WindowBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.0f); // Fully opaque
    style->Colors[ImGuiCol_FrameBg] = ImVec4(0.f, 0.f, 0.f, 1.0f); // Fully opaque
    style->Colors[ImGuiCol_ChildBg] = ImVec4(0.078f, 0.078f, 0.078f, 1.0f); // Fully opaque
    style->Colors[ImGuiCol_Button] = ImVec4(48.0f / 255.0f, 110.0f / 255.0f, 191.0f / 255.0f, 1.0f); // Fully opaque
    style->Colors[ImGuiCol_ButtonHovered] = ImVec4(48.0f / 255.0f, 110.0f / 255.0f, 191.0f / 255.0f, 1.0f); // Fully opaque
    style->Colors[ImGuiCol_ButtonActive] = ImVec4(48.0f / 255.0f, 110.0f / 255.0f, 191.0f / 255.0f, 1.0f); // Fully opaque

    style->WindowRounding = 1.f;
    style->WindowBorderSize = 0.f;
    style->FrameRounding = 1.f;
    style->ChildRounding = 1.f;
}



static void HelpMarker(const char* desc)
{
    ImGui::TextDisabled("(?)");
    if (ImGui::IsItemHovered())
    {
        ImGui::BeginTooltip();
        ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
        ImGui::TextUnformatted(desc);
        ImGui::PopTextWrapPos();
        ImGui::EndTooltip();
    }
}

void CenterText(const char* text)
{
    if (text == nullptr)
        return;

    ImGui::Spacing();
    ImGui::SameLine((ImGui::GetContentRegionAvail().x / 2) - (ImGui::CalcTextSize(text).x / 2));
    ImGui::Text(text);
    ImGui::Spacing();
}
@ruby3141
Copy link

I don't think your button and/or window background is translucent, because each elements are in exact color you've set.

Window background color is RGB(10, 10, 10)(lightness 0.0390625 ~= 0.4),
Child background color is RGB(20, 20, 20) (lightness 0.078125 ~= 0.078),
Button color is RGB(48, 110, 191).

If anything is translucent, it's color should've mixed with other background elements.
(Especially for button. It would appear darker if not opaque.)

I doubt that constellation "background" is actually drawn over everything.

@ruby3141
Copy link

By the way your issue seems incomplete because you didn't include your constellation-drawing logic, possibly inside DrawMainParticles().

@ocornut
Copy link
Owner

ocornut commented May 21, 2024

Sorry but #1586

@ocornut ocornut closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants