ImGui Learn Data Day 0
IMGUI learn data
ImGui::Begin("Hello ImGui");
ImGui::Text("Is my first ImGui windows!");
static float value = 0.0f;
ImGui::SliderFloat("value", &value, 0.0f, 1.0f);
static int num = 0;
if (ImGui::Button("Click Me"))
{
num++;
// 这里写按钮被点时要做的事情
}
ImGui::Text("%d",num);
static float stafloat = 1.0;//作为滑条的值
static int staint = 1;
//一个滑条
ImGui::SliderFloat("speed1", &stafloat, 0.0f, 10.0f);
ImGui::SliderInt("speed2", &staint, 0, 10);
//注意滑条名字不能重复
//一个输入框
static char name[50];
ImGui::InputText("please input your name", name,50);
static bool pot = false;//一个确认按钮
ImGui::Checkbox("text?", &pot);
ImGui::End();
主循环的核心部件(ex)
用Begin开头,End作结尾
| 函数名称 | 使用方法 | 保留 |
|---|---|---|
| Text() | 输出的时候就像是printf一样,可以用%d这样的格式化输出 | |
| Button() | 一个按钮,文本里写的是按钮的提示信息 | |
| SliderFloat() | 一个滑块,第一次参数是名称,滑块名称不能重复,第二个是滑块当前值,然后是从多少到多少 | |
| SliderInt() | 一个int类型的滑块 | |
| InputText() | 输入栏,要用一个char数组接收 | |
| Checkbox() | 一个确认按钮 |

浙公网安备 33010602011771号