Code Monkey home page Code Monkey logo

rlimgui's People

Contributors

benchislett avatar bennywwg avatar gulrak avatar jeffm2501 avatar jeffmblizzard avatar julianiolo avatar lucrecious avatar myusernamee avatar omar-elhamedy avatar sduman avatar splattab avatar ypujante avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rlimgui's Issues

Something wrong with scissor or viewport on MacOS

Creating a basic example on MacOS has incorrect scissor or viewport. Everything outside of the lower left quadrant does not get rendered. The issue is recursive, as you can see in the screenshot, sub-elements also have the same issue.
Screenshot 2023-12-24 at 9 23 23 AM

rendering issue on MacOS with minimal setup

Description:
When switching the rlImGui backend, I've encountered a rendering issue where ImGui elements are not rendered beyond an invisible boundary or region which located bottom left of the screen as can be seen in below screenshoots. I've used minimal example that I took from simple.cpp also this issue persist across different setups such as editor.cpp or my own implementation, while still doesn't sure about root of the problem I suspect from underlying OpenGL implementation.

Reproductable Code:

#include "raylib.h"
#include "raymath.h"

#include "imgui.h"
#include "rlImGui.h"

int main(int argc, char* argv[])
{
	// Initialization
	//--------------------------------------------------------------------------------------
	int screenWidth = 1280;
	int screenHeight = 800;

	SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT);
	InitWindow(screenWidth, screenHeight, "raylib-Extras [ImGui] example - simple ImGui Demo");
	SetTargetFPS(144);
	rlImGuiSetup(true);

	// Main game loop
	while (!WindowShouldClose())    // Detect window close button or ESC key
	{
		BeginDrawing();
		ClearBackground(DARKGRAY);

		// start ImGui Conent
		rlImGuiBegin();

		// show ImGui Content
		bool open = true;
		ImGui::ShowDemoWindow(&open);

		// end ImGui Content
		rlImGuiEnd();

		EndDrawing();
		//----------------------------------------------------------------------------------
	}
	rlImGuiShutdown();

	// De-Initialization
	//--------------------------------------------------------------------------------------   
	CloseWindow();        // Close window and OpenGL context
	//--------------------------------------------------------------------------------------

	return 0;
}

Screenshots:

as the position changes rendered area/elements of the imgui window changes as well

image image image

Context:
OS: MacOS Ventura 13.5.2
Hardware: M1 Mac
Compiler: Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin22.6.0

Standard cursor shape unavailable

Whenever I move the mouse over the resize grip of a window, I get the following warning:

WARNING: GLFW: Error: 65547 Description: X11: Standard cursor shape unavailable

Note that I am using ImGui v1.90.1 WIP (docking branch). Is there an easy fix for this?

rlImGuiShutdown() causes SEGMENTATION FAULT

System

  • Pop! Os 22.04 LTS
  • CLion 2023.3.2
  • CMake 3.27.8
  • C++ 17
  • Raylib 5.0 with internal GLFW and OpenGL 3.3 (compiled as a static library)
  • Latest rlImGui version

Issue

When closing the application the terminal reads:

INFO: Window closed successfully

Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)

The app runs just fine apart from this.

More information

Debugging I discovered that the error is thrown at line 475 of rlImGui.cpp: ImGui::DestroyContext();, so ImGui_ImplRaylib_Shutdown(); executes without problems

Fonts for ImGui

Hi authors,

can you please help what is the supposed way to load any other .ttf font to ImGui so that it works with rlImgui ?

In standalone ImGui fonts just loaded during init, and then album is built during init,

isn't it hidden somehow under rlImGuiSetup(true); ?

Is it possible to share the same font albums with void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); ?

Scissor or viewport issue with ImGui on Windows

See screenshots. Running the provided editor and simple examples exhibit a bug that looks scissor or viewport related, where part of the imgui render is cropped off. This cropping is related to where the imgui boxes are in the application window - if I move the box all the way to the top left corner, nothing is cropped.
This appears related to the fix for this issue:
#50
If I checkout 5c49511, the issue does not occur and both the editor and simple examples display correctly.
The screenshots show the correct rendering with hash 5c49511 and the bug in the latest version.

Screenshot 2024-01-10 100244
Screenshot 2024-01-10 100619

How to build?

Running premake-mingw.bat generates .make files, but it's not possible to import them. Running make shows an error: unable to find raudio.c. Including raw rlImGui.h shows a lot of errors when compiling. How to build static library and include file (like include/raylib.h, lib/raylib.a)?

How to add flags and title to window?

To add flags and title to window in ImGui, you can use: ImGui::Begin("Window", 0, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);, but there is no any arguments to do it in rlImGui.

ImGuiIO MousePos is nan when accessing from C but not in C++

I'm not sure really were to post an issue about this but maybe someone here can point me in the right direction?

Basically, when I try to get the MousePos from the ImGuiIO object, I get nan after building and static linking everything with a C compiler. However, if I get the MousePos inside rlImGui, compile that with C++ before statically linking, I get the right float value from MousePos.

i.e.

  • returning float from inside C++ function into the C layer works
  • getting float from ImGuiIO pointer directly from C layer does not work, but it does in C++ layer

This issue seems to only effect these mouse properties too (like MousePos, MouseClickedPos, etc)

#include <stdio.h>
#include "raylib.h"

#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "cimgui.h"

#include "rlImGui.h"

#define GAME_WIDTH 320
#define GAME_HEIGHT 180


int main(int argc, char **argv) {
    (void)argc;
    (void)argv;

    InitWindow(800, 600, "Bug");
    SetTargetFPS(60);

    rlImGuiSetup(true);

    while (true) {
        if (WindowShouldClose()) break;

        BeginDrawing(); {
            ClearBackground(GetColor(0x181818FF));

            rlImGuiBegin(); {
                igShowDemoWindow(NULL);
                ImGuiIO* io = igGetIO();
                TraceLog(LOG_INFO, "MousePos: %f, %f\n", io->MousePos.x, io->MousePos.y);

            } rlImGuiEnd();
        } EndDrawing();
    }

    rlImGuiShutdown();
    CloseWindow();
	return 0;
}

It's pretty weird because if I write a simple layer like this in rlImGui.h and rlImGui.cpp:

void rlGetMousePos(float* x, float* y) { *x = ImGui::GetIO().MousePos.x; *y = ImGui::GetIO().MousePos.y; }

And then use this instead of getting the MousePos from the struct, then this returns the right mouse positions!

It's really weird.

Again, this only happens with these mouse related float values, all other float values in the struct seem fine?

Any ideas? And if this is not the right place to post this, where is?

Crashes on hotreload enviroment.

Hi! While trying to use rlImGui on a hotreloadable enviroment, where the game code is loaded dynamically, the following line triggers an assert in glfw on call to glGetFramebufferSize.

glfwGetFramebufferSize(glfwGetCurrentContext(), &width, &height);

Assertion failed: window != NULL, file ${LOCAL_PATH}/glfw/src/window.c, line 694

The solution was replacing the call to glfwGetFramebufferSize with:

width = rlGetFramebufferWidth();
height = rlGetFramebufferHeight();

Currently is working fine on my specific project, so I don't know if this is an actual issue or not.

Keep the good work. ❤️

Window rendering artifacts when using FLAG_RESIZABLE

In testing out the example projects on my machine, if the FLAG_RESIZABLE raylib config flag is set, ImGui windows have a split about a third of the way from the top, and only seem to render within the bounds of a smaller size that the actual window size, starting from the bottom left of the screen.

This is the compiled from the "imgui_style_example.cpp", using the master branch of ImGui.
Maximized window
Screenshot 2023-12-10 145454
Window at starting resolution.
Screenshot 2023-12-10 145616

I'm compiling with MingW on Windows 11.

rlImGui doesn't respect WantCaptureMouse/WantCaptureKeyboard

When you click inside an ImGui window, that click should be "consumed" by ImGUI and not delivered to the app (ie: IsMouseButtonPressed() should return false after that).

ImGUI uses the flag WantCaptureMouse to signal it wants to capture mouse movement and clicks, but rlImGui doesn't currently read this flag. This is explained in ImGUI's FAQ.

Same goes for keystrokes and the flag WantCaptureKeyboard.

Note: This doesn't seem possible to implement on top of the current Raylib API, new API methods might be needed.

Platform DRM

Hello. I encountered a nasty problem. When I run on a DRM platform, the console is flooded with the message:

WARNING: SetMouseCursor() not implemented on target platform
WARNING: SetMouseCursor() not implemented on target platform
WARNING: SetMouseCursor() not implemented on target platform
WARNING: SetMouseCursor() not implemented on target platform
WARNING: SetMouseCursor() not implemented on target platform
WARNING: SetMouseCursor() not implemented on target platform
WARNING: SetMouseCursor() not implemented on target platform

It happens because of this line

int monitor = GetCurrentMonitor();
where the screen ID is asked for every new frame.

I solved it for myself like this:

I removed the line

int monitor = GetCurrentMonitor();

Next, I declared a variable at the beginning of the file

static int monitor = 0;

and finally I added this line to the function

void SetupBackend(void)

monitor = GetCurrentMonitor();

After this modification, the notification is printed only when the program is started. I don't see how it will behave in the case of multiple monitors. I only have one monitor so I can't test it and that's why there is no RP either.

rlImGui can render a GuiListViewEx but not a GuiButton from raygui.

Hi. I was experimenting docking made possible by Dear ImGui using RayGui widgets. I think I may have found a problem when rendering 2 windows. One with a GuiListViewEx in it and the other rendering a GuiButton. For some reason I can't make the second window (with the GuiButton) render the widgets I want.

Here is the minimal reproducible example:

#include "raylib.h"

#define RAYGUI_IMPLEMENTATION
#include "raygui.h"

#include "imgui/imgui.h"
#include "rlImGui.h"

#include <string>
#include <vector>



// Variables
int listViewExScrollIndex = 0;
int listViewExActive = 0;
int listViewExFocus = 0;
std::vector<char*> listViewExList;
bool canAddEntity = false;


std::vector<std::string> entityNames;


// Widgets
void EntitiesList()
{
    ImGui::BeginChild("listViewExChild", ImVec2(140, 700), true);

    // Translate the rectangles coordinates to ImGui coordinates
    ImVec2 pos = ImGui::GetCursorScreenPos();
    ImVec2 size = ImGui::GetContentRegionAvail();
    Rectangle rec = { pos.x, pos.y, size.x, size.y };

    listViewExActive = GuiListViewEx(rec, listViewExList.data(), entityNames.size(), &listViewExFocus, &listViewExScrollIndex, listViewExActive);
    ImGui::EndChild();
}


int main(int argc, char* argv[])
{
    int screenWidth1 = 1900;
    int screenHeight1 = 900;

    SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE);
    InitWindow(screenWidth1, screenHeight1, "raylib [ImGui] example - ImGui Demo");
    SetTargetFPS(144);
    rlImGuiSetup(true);


    // Init Docking
    ImGui::CreateContext();
    ImGuiIO& io = ImGui::GetIO(); (void)io;

    io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;      // Enable Docking

    // Main game loop
    while (!WindowShouldClose())
    {

        BeginDrawing();
        ClearBackground(DARKGRAY);

        // start the GUI
        rlImGuiBegin();



        ImGuiIO& io = ImGui::GetIO();
        if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
        {
            ImGui::DockSpaceOverViewport(ImGui::GetMainViewport());
            
            ImGui::Begin("My Window");
            // Render other ImGui elements here
            ImVec2 pos = ImGui::GetCursorScreenPos();

            if (GuiButton(Rectangle{ pos.x, pos.y, 120, 30 }, "My Button"))
            {
                // Do something when the button is clicked
            }
            ImGui::End();

            ImGui::Begin("Entities List Window", NULL);
            EntitiesList();
            ImGui::End();

        }

        // end ImGui
        rlImGuiEnd();

        // Finish drawing
        EndDrawing();
    }



    rlImGuiShutdown();
    CloseWindow(); 

    return 0;
}

GetMouseRay() does not work properly

I was trying to make some point-picking example code using GetMouseRay but it acted weirdly.

I just ported the following raylib example to the editor example to see if I can use a mouse click to pick a cube.
https://github.com/raysan5/raylib/blob/master/examples/core/core_3d_picking.c

It works somehow but there is some sort of mismatch between the clicked point that causes the trigger and the cube location on the screen. Probably, GetMousePosition() is not working properly.

It looks simple to fix though.

Just wondering if anyone already solved this problem.

vcpkg package request

Hey, any consideration on making this library available on vcpkg?
Prefer to keep my libraries easily accessible and simple to update than have to manually include and deal with downloads and files, especially when its unknown when there is a new release.

Weird interactions with rlImgui and SUPPORT_CUSTOM_FRAME_CONTROL=1

While following
Using both PollInputEvents() and SwapScreenBuffer()
And using rlImgui's simple.cpp example

  • I witnessned that fps counting was not working ( frozen at 0.0 fps)
  • Animated widgets do not work anymore(e.g the plotting section)

I believe both issues are due to io.DeltaTime being 0 since GetFrameTime() is invalidated and cannot be used anymore when SUPPORT_CUSTOM_FRAME_CONTROL is on.
Using raylib's GetTime() and checking how other imgui's backends do it should be enough to fix it, I will experiment later.

Here is the full code:

#include "raylib.h"
#include "raymath.h"

#include "imgui.h"
#include "rlImGui.h"

int main(int argc, char* argv[])
{
	// Initialization
	//--------------------------------------------------------------------------------------
	int screenWidth = 1280;
	int screenHeight = 800;

	SetConfigFlags(FLAG_MSAA_4X_HINT | FLAG_VSYNC_HINT);
	InitWindow(screenWidth, screenHeight, "raylib-Extras [ImGui] example - simple ImGui Demo");
	rlImGuiSetup(true);

	// Main game loop
	while (!WindowShouldClose())    // Detect window close button or ESC key
	{
		PollInputEvents(); // SUPPORT_CUSTOM_FRAME_CONTROL
	
		BeginDrawing();
		ClearBackground(DARKGRAY);

		// start ImGui Conent
		rlImGuiBegin();

		// show ImGui Content
		bool open = true;
		ImGui::ShowDemoWindow(&open);

		// end ImGui Content
		rlImGuiEnd();

		EndDrawing();
		
		SwapScreenBuffer(); // SUPPORT_CUSTOM_FRAME_CONTROL
		//----------------------------------------------------------------------------------
	}
	rlImGuiShutdown();

	// De-Initialization
	//--------------------------------------------------------------------------------------   
	CloseWindow();        // Close window and OpenGL context
	//--------------------------------------------------------------------------------------

	return 0;
}

Examples fail to build on osx

The asset browser and editor examples fail to compile on osx.

The editor example is due to deprecated functions on dear imgui 1.9.1

The asset browser fails due to stricmp not being available on osx (and possibly other posix systems)

I have created PR #71 to fix these issues.

DrawText draw text on the main view port

When I tried to draw some text on the 3D View window using DrawText, it did not draw the text on the 3D View window but on the main window.
e.g.
At the end of the update() in the editor example, I added a text like the following.

EndTextureMode();
DrawText("x", (int)x_label_pos.x, (int)x_label_pos.y, 20, WHITE);

It should have appeared on the 3D View window but wasn't.

Does anyone have a similar problem?

Memory leak in ReloadFonts()

Hello.
I use rlImGui in my C project(also with raylib and cimgui). I use commit 16db43e
AddressSanitizer showing a direct memory leak:

Direct leak of 20 byte(s) in 1 object(s) allocated from:
    #0 0x7f969b8e0cc1 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x556aded52c34 in MemAlloc /home/nagolove/caustic/3rd_party/raylib/src/utils.c:165
    #2 0x556adee88261 in ReloadFonts() (/home/nagolove/proekt80/t80+0x724261) (BuildId: 08d4b93d2575458a72636d1b4d463d8c1b0a88f8)
    #3 0x556adee88b1f in rlImGuiEndInitImGui (/home/nagolove/proekt80/t80+0x724b1f) (BuildId: 08d4b93d2575458a72636d1b4d463d8c1b0a88f8)
    #4 0x556adee89b9f in rlImGuiSetup (/home/nagolove/proekt80/t80+0x725b9f) (BuildId: 08d4b93d2575458a72636d1b4d463d8c1b0a88f8)
    #5 0x556adea6df17 in main /home/nagolove/proekt80/src/t80_main.c:480
    #6 0x7f969b245ccf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

There is no MemFree() call for io.Fonts->TexID
I suggest next patch for shutdown function:

void rlImGuiShutdown()
{
    ImGui::SetCurrentContext(GlobalContext);

    ImGuiIO& io = ImGui::GetIO();
    if (io.Fonts->TexID) {
        MemFree(io.Fonts->TexID);
        io.Fonts->TexID = NULL;
    }

    ImGui_ImplRaylib_Shutdown();

    ImGui::DestroyContext();
}

Ideas for full ImGui `docking` branch support

Since 2018 ImGui has had support for viewports and docking.

Currently rlImGui, supports docking if you enable it like so:

ImGuiIO& io = ImGui::GetIO();
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;

However multiple viewports would be a challenge to implement:

  • You need to detect if multi-viewport support is wanted, maybe with a #define ENABLE_VIEWPORTS?
  • Using some surgry you can get raylib to use multiple windows!
  • Using the FLAG_WINDOW_UNDECORATED flag for SetConfigFlags we can remove the title bar of the new windows (for the full effect).

Finally, we will have full support of the docking branch. It won't be as simple as it looks, but it would be useful for many rlImGui users.

Maybe rlImGui can have its own docking branch which is used to experiment with viewports?

Render outside the window?

I am creating a tool using Raylib + rlImGui, but I would like to be able to draw a ImGui window outside the main window of Raylib so the users can use multiple monitors, is it possible to do that? I thought about creating a new window on another thread using OpenGL + ImGui just to draw one window and interfacing with it somehow from the Raylib main window for communication but I wonder if there is a better way.

ImGui::IsMouseReleased not working

Hi!

ImGui::IsMouseReleased(ImGuiMouseButton_Middle) is not working. I think in static void ImGuiNewFrame(float deltaTime) missing code:

    io.MouseReleased[0] = IsMouseButtonReleased(MOUSE_LEFT_BUTTON);
    io.MouseReleased[1] = IsMouseButtonReleased(MOUSE_RIGHT_BUTTON);
    io.MouseReleased[2] = IsMouseButtonReleased(MOUSE_MIDDLE_BUTTON);

While this patch seems not fixing for me.

Touchscreen input doesn't dispatch correctly on the web.

Hello,

I am using rlImGui in a web app which is compiled using emscripten. I noticed that on mobile devices (my iphone and ipad), touch events are sent to the main raylib app and not Dear ImGui. On desktop devices with a real mouse I don't see any problems. I am not very familiar with the ImGui internals so any advice would be appreciated.

Thank you.

Unable to use custom fonts

I may be missing something, but I get this error when using AddFontFromFileTFF();
Assertion failed: g.IO.Fonts->IsBuilt() && "Font Atlas not built! Make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()", file C:\Users\Electro\Documents\Visual Studio Projects\RelicEngine\includes\imgui\imgui.cpp, line 9645

Here is my code:

int main(void)
{
    windowState = MainWin;
    SetConfigFlags(FLAG_WINDOW_HIGHDPI);
    InitWindow(windowSize.x, windowSize.y, "RelicEngine - v0.1-ALPHA");

    // Setup Dear ImGui context
    ImGui::CreateContext();
    ImGuiIO& io = ImGui::GetIO(); (void)io;
    io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;     // Enable Keyboard Controls
    io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;      // Enable Gamepad Controls

    // Setup Dear ImGui style
    ImGui::StyleColorsDark();
    InitStyle();

    // Setup Platform/Renderer backends
    ImGui_ImplRaylib_Init();

    markerBoldFont = io.Fonts->AddFontFromFileTTF("resources/fonts/BoldMarker.ttf", 30);

    while (!WindowShouldClose())
    {
        // Poll and handle events (inputs, window resize, etc.)
        ImGui_ImplRaylib_ProcessEvents();

        // Start the Dear ImGui frame
        ImGui_ImplRaylib_NewFrame();
        ImGui::NewFrame();

        switch (windowState)
        {
        case MainWin:
            RenderMainWin();
            break;
        case ProjectCreationWin:
            RenderCreationWin();
            break;
        }

        // Rendering
        ImGui::Render();
        BeginDrawing();
        ImGui_ImplRaylib_RenderDrawData(ImGui::GetDrawData());
        EndDrawing();
    }

Unable to specify FontAwesome font size

It is currently not possible to specify at which size the FontAwesome font is loaded.

In general, the way in which font loading is currently handled is somewhat unflexible, as the default font is always loaded (at the end of rlImGuiBeginInitImGui), and the fontawesome font is also always loaded (at the start of rlImGuiEndInitImGui). Maybe there should be flags which disable this default loading, so the user can load everything themself if they want to?

Trying to load custom font by default

In commit: c71a025

This got commited:
io.Fonts->AddFontFromFileTTF("resources/fa-solid-900.ttf", FONT_AWESOME_ICON_SIZE, &icons_config, nullptr);
//io.Fonts->AddFontFromMemoryCompressedTTF((void*)fa_solid_900_compressed_data, fa_solid_900_compressed_size, FONT_AWESOME_ICON_SIZE, &icons_config, icons_ranges);

it should probably be just the commented row and delete the other one:
io.Fonts->AddFontFromMemoryCompressedTTF((void*)fa_solid_900_compressed_data, fa_solid_900_compressed_size, FONT_AWESOME_ICON_SIZE, &icons_config, icons_ranges);

rlimGui.h missing function

Your example "editor.cpp" uses rlImGuiImageRenderTextureFit although this function seems to be missing from rlImGui.h.

copy/paste issue in code with key event

The code here:

io.AddKeyEvent(ImGuiMod_Shift, ctrlDown);

and here:

io.AddKeyEvent(ImGuiMod_Super, ctrlDown);

clearly contains a copy/paste issue:

// line 163
	bool shiftDown = rlImGuiIsShiftDown();
	if (shiftDown != LastShiftPressed)
		io.AddKeyEvent(ImGuiMod_Shift, ctrlDown); // COPY/PASTE ISSUE
	LastShiftPressed = shiftDown;

// line 173
	bool superDown = rlImGuiIsSuperDown();
	if (superDown != LastSuperPressed)
		io.AddKeyEvent(ImGuiMod_Super, ctrlDown); // COPY/PASTE ISSUE
	LastSuperPressed = superDown;

io.WantCaptureMouse possible bug because of the way rllmGui is implemented

I have a simulator for point charges and I have implemented a function that allows charges to be dragged while holding mouse left button. I want to block dragging charges function under the ImGui windows.
I have succeeded to block all other functions under ImGui windows like (Add Charge, Remove Charge, Select Charge), but all these functions have in common IsMouseButtonPressed function.
For the dragging charges function I used IsMouseButtonDown and I observed that the dragging is still working under the ImGui windows, and after a bit of debugging I found out that the io.WantCaptureMouse variable is not changed If I hold the left button, and I think that these lines are the reason, because they are taking into consideration only the Pressed function, but the Down function has a different behavior.

auto setMouseEvent = [&io](int rayMouse, int imGuiMouse) { if (IsMouseButtonPressed(rayMouse)) io.AddMouseButtonEvent(imGuiMouse, true); else if (IsMouseButtonReleased(rayMouse)) io.AddMouseButtonEvent(imGuiMouse, false); };

How could I fix the problem?
Changing the approach maybe, or is there an alternative for the rllImGui Process Event function that would fix the problem?
Maybe I am missing something.
Thank you.

EXC_BAD_ACCESS on rlImGuiSetup

Here is the call stack:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
    frame #1: 0x0000000100036bdc MyRaylibProject`rlLoadTexture(data=0x00000001483a0000, width=512, height=1024, format=7, mipmapCount=1) at rlgl.h:3015:5
    frame #2: 0x000000010009164c MyRaylibProject`LoadTextureFromImage(image=(data = 0x00000001483a0000, width = 512, height = 1024, mipmaps = 1, format = 7)) at rtextures.c:3782:22
    frame #3: 0x00000001000230dc MyRaylibProject`ReloadFonts() at rlImGui.cpp:83:17
    frame #4: 0x0000000100023330 MyRaylibProject`::rlImGuiEndInitImGui() at rlImGui.cpp:295:5
    frame #5: 0x00000001000241d8 MyRaylibProject`rlImGuiSetup(dark=true) at rlImGui.cpp:440:5
  * frame #6: 0x0000000100007e80 MyRaylibProject`main at main.cpp:859:5
    frame #7: 0x000000018850d0e0 dyld`start + 2360

Images show as Black

Sprite& sprite = registry.get(editor.selected);

      Texture texture = sprite.texture;

      ImGuiIO& io = ImGui::GetIO();
      ImTextureID my_tex_id = (void*)&texture;
      float my_tex_w = texture.width;
      float my_tex_h = texture.height;
      {
        ImGui::Text("%.0fx%.0f", my_tex_w, my_tex_h);
        ImVec2 uv_min = ImVec2(0.0f, 0.0f);                 // Top-left
        ImVec2 uv_max = ImVec2(1.0f, 1.0f);                 // Lower-right
        ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);   // No tint
        ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); // 50% opaque white
        ImGui::Image(my_tex_id, ImVec2(my_tex_w, my_tex_h), uv_min, uv_max, tint_col, border_col);
        rlImGuiImageSize(&texture, 400, 400);
      }

image

Imguis font atlas will work and render in the demo just fine. Why won't this work??

Regression: Missing text in main menu and menu is truncated

Hi, tested on Mac Os X (probably same issue for Linux). This is used to work (I do not remember which old SHA1 but > 6 months)

    if (ImGui::BeginMainMenuBar()) {
        if (ImGui::BeginMenu("File")) {
            if (ImGui::MenuItem("New", nullptr, false)) {

Here screenshots:

  • Under "Petri net" tab, no menu is displayed (shall be "File Actions Help")
Capture d’écran 2024-04-14 à 5 49 29 PM
  • When clicking on the menu, not all menu is shown
Capture d’écran 2024-04-14 à 5 51 19 PM
  • Here is the expected behavior (done with GLFW3)
Capture d’écran 2024-04-14 à 7 08 45 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.