Skip to content

The library is unable to find monitors on 1.91.8-docking #8401

@lejulien-42

Description

@lejulien-42

Version/Branch of Dear ImGui:

Version 1.91.8, Branch: docking

Back-ends:

imgui_impl_opengl3.cpp used with raylib and rlimgui

Compiler, OS:

tested on linux & windows with gcc & clang compilers

Full config/build information:

build/_deps/imgui-src/imgui.cpp:16539: int ImGui::FindPlatformMonitorForRect(const ImRect&): Assertion `monitor_count > 0' failed.
[1]    1646101 IOT instruction (core dumped)  

Details:

My Issue/Question:

XXX (please provide as much context as possible)
Since the latest version as the date of this issue, the library asserts in monitor_cout > 0.
I had to switch to the previous version in order to make it work.
Is this a possible regression ?

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

cmake_minimum_required(VERSION 3.18)
set(NAME "imgui_bug")
project(${NAME} CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(WIN32)
	set(IMGUI_BACKEND "imgui_impl_dx11.cpp")  # DirectX 11 for Windows
elseif(APPLE)
	set(IMGUI_BACKEND "imgui_impl_metal.mm")  # Metal for macOS
elseif(UNIX)
	set(IMGUI_BACKEND "imgui_impl_opengl3.cpp")  # OpenGL for Linux
endif()

# includes
include_directories(./includes)

# raylib
include(FetchContent)
FetchContent_Declare(
	raylib
	GIT_REPOSITORY https://github.com/raysan5/raylib.git
	GIT_TAG 5.5
	GIT_SHALLOW 1
)
FetchContent_GetProperties(raylib)
if (NOT raylib_POPULATED)
	set(FETCHCONTENT_QUIET NO)
	FetchContent_Populate(raylib)
	set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
	set(BUILD_GAMES    OFF CACHE BOOL "" FORCE)
	add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
endif()

# imgui
FetchContent_Declare(
	imgui
	GIT_REPOSITORY https://github.com/ocornut/imgui.git
	GIT_TAG docking
)

FetchContent_MakeAvailable(imgui)

set(imgui_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/imgui-src)

# rlimgui
FetchContent_Declare(
	rlImGui
	GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
	GIT_TAG main
)
FetchContent_MakeAvailable(rlImGui)
set(rlImGui_SOURCE_DIR ${CMAKE_BINARY_DIR}/_deps/rlimgui-src)


include_directories(${imgui_SOURCE_DIR} ${rlImGui_SOURCE_DIR})

set(SRC_CXX_FILES	"./src/main.cpp"
									"${rlImGui_SOURCE_DIR}/rlImGui.cpp"
									"${imgui_SOURCE_DIR}/imgui.cpp"
									"${imgui_SOURCE_DIR}/imgui_draw.cpp"
									"${imgui_SOURCE_DIR}/imgui_widgets.cpp"
									"${imgui_SOURCE_DIR}/imgui_tables.cpp"
									"${imgui_SOURCE_DIR}/backends/${IMGUI_BACKEND}"
)

# Setup the example
add_executable(${NAME} ${SRC_CXX_FILES})

# Link raylib and raylib-cpp
target_link_libraries(${NAME} PUBLIC raylib)
#include "imgui.h"
#include "raylib.h"
#include "rlImGui.h"
#include <cstdlib>
#include <iostream>

int main(int ac, char **av) {
  InitWindow(screen_width, screen_height, "gol_raylib");

  SetTargetFPS(60);

  rlImGuiSetup(true);

  // Imgui control menu
  int updates_per_seconds = 9;
  // Diplay generations
  while (!WindowShouldClose()) {
    BeginDrawing();
    ClearBackground(BLACK);
    // Start ImGui frame
    rlImGuiBegin();
    ImGui::Begin("Control Panel");
    ImGui::SliderInt("Adjust speed", &updates_per_seconds, 0, 30);
    ImGui::End();
    // End ImGui frame
    rlImGuiEnd();
    EndDrawing();
  }
  CloseWindow();
  return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions