mirror of https://github.com/axmolengine/axmol.git
c37af4c38e
1. Rename uniformId to batchId, refine batch draw check logic, not use xxhash to compute uniforms id 2. Material works, not check all cpp-tests, but some 2d/3d material works fine 3. Shader load/cache API improvements. 4. BREAK compatibliity: Node::setProgramState change parameter needsRetain to ownPS and value inverted. 5. custom vertexLayout setup: add new API ProgramState::getMutableVertexLayout, mark ProgramState::setVertexAttrib deprecated. 6. ProgramManager registerCustomProgram change to gen progId by vsName, fsName with xxhash64, if register succed, user can load it by progId with `loadProgram` 7. Add API ProgramManager::loadProgram for loading builtin by progType or loding a custom program by id 8. Add API ProgramManager::loadProgram to load program by vsName, fsName immediately without register as CUSTOM_PROGRAM 9. Add API Node::setProgramStateByProgramId(progTypeOrId); for set programState with programType or programId explicit. 10. Migrate material load logic |
||
---|---|---|
.. | ||
imgui | ||
shaders | ||
CMakeLists.txt | ||
ImGuiPresenter.cpp | ||
ImGuiPresenter.h | ||
LICENSE | ||
README.md | ||
imgui_impl_ax.cpp | ||
imgui_impl_ax.h | ||
imgui_impl_ax_android.cpp | ||
imgui_impl_ax_android.h |
README.md
The ImGui extension for axmol
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 whencc.Director
paused - Refine
Init/Shutdown
, Restore all callbacks for glfw to solve recreateImGuiPresenter
instance support - Use
FOURCC
for key of ImGui render loop - Add dpi scale support, use
ImGuiPresenter::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 "ImGui/ImGuiPresenter.h"
USING_NS_AX;
USING_NS_AX_EXT;
class GameScene : public Scene {
public:
void onEnter() override
{
Scene::onEnter();
ImGuiPresenter::getInstance()->addFont(R"(C:\Windows\Fonts\msyh.ttc)");
/* For Simplified Chinese support, please use:
ImGuiPresenter::getInstance()->addFont(R"(C:\Windows\Fonts\msyh.ttc)", ImGuiPresenter::DEFAULT_FONT_SIZE,
ImGuiPresenter::CHS_GLYPH_RANGE::GENERAL);
*/
ImGuiPresenter::getInstance()->addRenderLoop("#im01", AX_CALLBACK_0(GameScene::onImGuiDraw, this), this);
}
void onExit() override
{
Scene::onExit();
ImGuiPresenter::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.