dependencies/third-party/imgui/src/examples/example_marmalade/main.cpp
Go to the documentation of this file.
1 // dear imgui: standalone example application for Marmalade
2 // If you are new to dear imgui, see examples/README.txt and documentation at the top of imgui.cpp.
3 
4 // Copyright (C) 2015 by Giovanni Zito
5 // This file is part of Dear ImGui
6 
7 #include "imgui.h"
8 #include "imgui_impl_marmalade.h"
9 #include <stdio.h>
10 
11 #include <s3eKeyboard.h>
12 #include <s3ePointer.h>
13 #include <IwGx.h>
14 
15 int main(int, char**)
16 {
17  IwGxInit();
18 
19  // Setup Dear ImGui context
22  ImGuiIO& io = ImGui::GetIO(); (void)io;
23  //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
24 
25  // Setup Dear ImGui style
27  //ImGui::StyleColorsClassic();
28 
29  // Setup Platform/Renderer bindings
31 
32  // Load Fonts
33  // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
34  // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
35  // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
36  // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
37  // - Read 'docs/FONTS.txt' for more instructions and details.
38  // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
39  //io.Fonts->AddFontDefault();
40  //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
41  //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
42  //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
43  //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
44  //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
45  //IM_ASSERT(font != NULL);
46 
47  // Our state
48  bool show_demo_window = true;
49  bool show_another_window = false;
50  ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
51 
52  // Main loop
53  while (true)
54  {
55  if (s3eDeviceCheckQuitRequest())
56  break;
57 
58  // Poll and handle inputs
59  // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
60  // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
61  // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
62  // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
63  s3eKeyboardUpdate();
64  s3ePointerUpdate();
65 
66  // Start the Dear ImGui frame
69 
70  // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
71  if (show_demo_window)
73 
74  // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
75  {
76  static float f = 0.0f;
77  static int counter = 0;
78 
79  ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
80 
81  ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
82  ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
83  ImGui::Checkbox("Another Window", &show_another_window);
84 
85  ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
86  ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
87 
88  if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
89  counter++;
91  ImGui::Text("counter = %d", counter);
92 
93  ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
94  ImGui::End();
95  }
96 
97  // 3. Show another simple window.
99  {
100  ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
101  ImGui::Text("Hello from another window!");
102  if (ImGui::Button("Close Me"))
103  show_another_window = false;
104  ImGui::End();
105  }
106 
107  // Rendering
108  ImGui::Render();
109  IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
110  IwGxClear();
112  IwGxSwapBuffers();
113 
114  s3eDeviceYield(0);
115  }
116 
117  // Cleanup
120  IwGxTerminate();
121 
122  return 0;
123 }
main
int main(int, char **)
Definition: dependencies/third-party/imgui/src/examples/example_marmalade/main.cpp:15
ImVec4::z
float z
Definition: imgui.h:223
ImGui::GetDrawData
IMGUI_API ImDrawData * GetDrawData()
Definition: imgui.cpp:3293
ImGui::Button
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
Definition: imgui_widgets.cpp:678
ImGui_Marmalade_NewFrame
void ImGui_Marmalade_NewFrame()
Definition: imgui_impl_marmalade.cpp:265
ImGui_Marmalade_RenderDrawData
void ImGui_Marmalade_RenderDrawData(ImDrawData *draw_data)
Definition: imgui_impl_marmalade.cpp:43
ImGui_Marmalade_Init
bool ImGui_Marmalade_Init(bool install_callbacks)
Definition: imgui_impl_marmalade.cpp:219
ImGui::Render
IMGUI_API void Render()
Definition: imgui.cpp:4222
imgui.h
ImGui::Text
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
Definition: imgui_widgets.cpp:247
ImGui::SameLine
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f)
Definition: imgui.cpp:6923
ImGui::GetIO
IMGUI_API ImGuiIO & GetIO()
Definition: imgui.cpp:3286
show_another_window
static bool show_another_window
Definition: dependencies/third-party/imgui/src/examples/example_glut_opengl2/main.cpp:23
imgui_impl_marmalade.h
ImGui::End
IMGUI_API void End()
Definition: imgui.cpp:6007
ImVec4::y
float y
Definition: imgui.h:223
ImGui::ShowDemoWindow
IMGUI_API void ShowDemoWindow(bool *p_open=NULL)
Definition: imgui_demo.cpp:208
ImGui::SliderFloat
IMGUI_API bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f)
Definition: imgui_widgets.cpp:2652
ImGui::DestroyContext
IMGUI_API void DestroyContext(ImGuiContext *ctx=NULL)
Definition: imgui.cpp:3276
clear_color
static ImVec4 clear_color
Definition: dependencies/third-party/imgui/src/examples/example_glut_opengl2/main.cpp:24
ImGui::Checkbox
IMGUI_API bool Checkbox(const char *label, bool *v)
Definition: imgui_widgets.cpp:1008
ImGui::CreateContext
IMGUI_API ImGuiContext * CreateContext(ImFontAtlas *shared_font_atlas=NULL)
Definition: imgui.cpp:3267
ImVec4::x
float x
Definition: imgui.h:223
void
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
ImGui::ColorEdit3
IMGUI_API bool ColorEdit3(const char *label, float col[3], ImGuiColorEditFlags flags=0)
Definition: imgui_widgets.cpp:4242
ImGui::NewFrame
IMGUI_API void NewFrame()
Definition: imgui.cpp:3691
ImGui::Begin
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
Definition: imgui.cpp:5397
ImVec4::w
float w
Definition: imgui.h:223
ImGui_Marmalade_Shutdown
void ImGui_Marmalade_Shutdown()
Definition: imgui_impl_marmalade.cpp:260
ImGuiIO
Definition: imgui.h:1414
ImVec4
Definition: imgui.h:221
f
GLfloat f
Definition: glcorearb.h:3964
show_demo_window
static bool show_demo_window
Definition: dependencies/third-party/imgui/src/examples/example_glut_opengl2/main.cpp:22
ImGui::StyleColorsDark
IMGUI_API void StyleColorsDark(ImGuiStyle *dst=NULL)
Definition: imgui_draw.cpp:178
IMGUI_CHECKVERSION
#define IMGUI_CHECKVERSION()
Definition: imgui.h:64


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:55