axmol/extensions/ImGuiEXT
halx99 0076283252 Huge changes for all string_view 2021-12-26 23:26:34 +08:00
..
imgui Committing clang-format changes 2021-12-25 02:04:45 +00:00
CCImGuiEXT.cpp Huge changes for all string_view 2021-12-26 23:26:34 +08:00
CCImGuiEXT.h Huge changes for all string_view 2021-12-26 23:26:34 +08:00
CMakeLists.txt Move ntcvt directory 2021-11-26 17:19:50 +08:00
LICENSE Refine extension ImGui, and rename director to ImGuiEXT 2020-09-05 17:10:09 +08:00
README.md Update README.md 2021-07-08 07:42:15 +02:00
imgui_impl_adxe.cpp Fix #508 warnings 2021-09-26 21:52:36 +08:00
imgui_impl_adxe.h Committing clang-format changes 2021-12-25 02:04:45 +00:00

README.md

ImGuiEXT of adxe

Sync from https://github.com/Xrysnow/cocos2d-x-imgui and do a little changes

Improvements

  • Simplify API, use add/remove renderLoop present ImGui GUI widgets
  • Optimize call pipeline flow, support add/remove Node to Scene at ImGui render loop without container iterator damage
  • Calculate deltaTime at ImGui_ImplCocos2dx_NewFrame to avoid error when cc.Director paused
  • Refine Init/Shutdown, Restore all callbacks for glfw to solve recreate ImGuiEXT instance support
  • Use FOURCC for key of ImGui render loop
  • Add dpi scale support, use ImGuiEXT::getInstance()->scaleAllByDPI(1.0);
  • Easy font manager, stable API addFont,removeFont,clearFonts to manage ImGui fonts, with ImGui API, very hard to do correctly.

How to use

#include "ImGuiEXT/CCImGuiEXT.h"
USING_NS_CC;
USING_NS_CC_EXT;

class GameScene : public Scene {
public:
    void onEnter() override
    {
        Scene::onEnter();
        ImGuiEXT::getInstance()->addRenderLoop("#im01", CC_CALLBACK_0(GameScene::onImGuiDraw, this), this);
    }
    void onExit() override
    {
        Scene::onExit();
        ImGuiEXT::getInstance()->removeRenderLoop("#im01");
    }
    void onImGuiDraw()
    {
        ImGui::Begin("window");
        ImGui::Text("FPS=%.1f", 1.f / ImGui::GetIO().DeltaTime);
        ImGui::End();
    }
}

More about use imgui widgets, please see: https://github.com/ocornut/imgui

Tested devices

  • win32
  • macOS

Known issues

  • Can't enable muti-viewports on macOS, so we disable this feature for macOS.

Other resources of ImGui