-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathmain.cpp
More file actions
55 lines (40 loc) · 1.42 KB
/
main.cpp
File metadata and controls
55 lines (40 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "imtui/imtui.h"
#include "imtui/imtui-impl-ncurses.h"
#include "imtui-demo.h"
int main() {
IMGUI_CHECKVERSION();
ImGui::CreateContext();
auto screen = ImTui_ImplNcurses_Init(true);
ImTui_ImplText_Init();
bool demo = true;
int nframes = 0;
float fval = 1.23f;
while (true) {
ImTui_ImplNcurses_NewFrame();
ImTui_ImplText_NewFrame();
ImGui::NewFrame();
ImGui::SetNextWindowPos(ImVec2(4, 27), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(50.0, 10.0), ImGuiCond_Once);
ImGui::Begin("Hello, world!");
ImGui::Text("NFrames = %d", nframes++);
ImGui::Text("Mouse Pos : x = %g, y = %g", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
ImGui::Text("Time per frame %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
ImGui::Text("Float:");
ImGui::SameLine();
ImGui::SliderFloat("##float", &fval, 0.0f, 10.0f);
#ifndef __EMSCRIPTEN__
ImGui::Text("%s", "");
if (ImGui::Button("Exit program", { ImGui::GetContentRegionAvail().x, 2 })) {
break;
}
#endif
ImGui::End();
ImTui::ShowDemoWindow(&demo);
ImGui::Render();
ImTui_ImplText_RenderDrawData(ImGui::GetDrawData(), screen);
ImTui_ImplNcurses_DrawScreen();
}
ImTui_ImplText_Shutdown();
ImTui_ImplNcurses_Shutdown();
return 0;
}