Files
imgui-godot/doc/examples/Module/modules/mymod/mynode.cpp
Patrick Dawson c17e72a546 GDExtension (#56)
Merge GDExtension
2024-04-29 18:40:26 -07:00

45 lines
873 B
C++

#include "mynode.h"
#include "core/config/engine.h"
#include "core/io/resource_loader.h"
#include <imgui-godot.h>
MyNode::MyNode()
{
#ifdef DEBUG_ENABLED
if (Engine::get_singleton()->is_editor_hint())
return;
#endif
set_process(true);
}
MyNode::~MyNode()
{
}
void MyNode::_bind_methods()
{
}
void MyNode::_notification(int what)
{
#ifdef DEBUG_ENABLED
if (Engine::get_singleton()->is_editor_hint())
return;
#endif
switch (what)
{
case NOTIFICATION_PROCESS:
ImGui::Begin("C++ module", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Text("hello");
ImGui::Image(_img, {_iconSize, _iconSize});
ImGui::DragFloat("size", &_iconSize, 1.f, 32.f, 512.f);
ImGui::End();
break;
case NOTIFICATION_READY:
_img = ResourceLoader::load("res://icon.svg");
break;
}
}