Ошибка: Assertion failed: g.WithinFrameScope

Рейтинг: 0Ответов: 0Опубликовано: 20.07.2025

Столкнулся с такой ошибкой

Assertion failed: g.WithinFrameScope, file 
C:\Users\CHRON\vcpkg\buildtrees\imgui\src\v1.91.9-afb09617a6.clean\imgui.cpp, line 7025 

И без понятия, что делать. Пишу на VS

Вот код:

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>

#include "imgui.h"
#include <imgui-SFML.h>

int main()
{
    sf::RenderWindow window(sf::VideoMode({ 800, 600 }), "My window");
    window.setFramerateLimit(60);

    ImGui::CreateContext();

    bool imgui_init_success = ImGui::SFML::Init(window);
    if (!imgui_init_success) {
        return -1;
    }

    sf::CircleShape shape(100.0f);
    shape.setFillColor(sf::Color::Green);

    sf::Clock deltaClock;

    while (window.isOpen())
    {
        while (const std::optional event = window.pollEvent())
        {
            ImGui::SFML::ProcessEvent(window, *event);
            if (event->is<sf::Event::Closed>())
                window.close();
        }

        ImGui::SFML::Update(window, deltaClock.restart());

        ImGui::ShowDemoWindow();

        ImGui::Begin("Hello world!");
        ImGui::Button("Look at this pretty button");
        ImGui::End();

        window.clear();
        window.draw(shape);
        ImGui::SFML::Render(window);
        window.display();
    }

    ImGui::SFML::Shutdown();

    return 0;
}

Такое ощущение, что перерыл всё, что возможно и решение не нашёл.

Ответы

Ответов пока нет.