浏览代码

Merge pull request #1594 from gerryhernandez/fix-apple-example

Examples: Apple: Fix iOS code; fixes entire XCode build for Apple example
omar 7 年之前
父节点
当前提交
b76cf9cc87
共有 3 个文件被更改,包括 9 次插入2 次删除
  1. 1 0
      .gitignore
  2. 7 2
      examples/apple_example/imguiex-ios/debug_hud.cpp
  3. 1 0
      examples/apple_example/imguiex-ios/debug_hud.h

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+*.o

+ 7 - 2
examples/apple_example/imguiex-ios/debug_hud.cpp

@@ -22,6 +22,11 @@ void DebugHUD_InitDefaults( DebugHUD *hud )
     hud->cubeColor2[1] = 0.4f;
     hud->cubeColor2[2] = 0.4f;
     hud->cubeColor2[3] = 1.0f;
+    
+    hud->clearColor[0] = 0.45f;
+    hud->clearColor[1] = 0.55f;
+    hud->clearColor[2] = 0.60f;
+    hud->clearColor[3] = 1.00f;
 }
 
 void DebugHUD_DoInterface(DebugHUD *hud)
@@ -33,7 +38,7 @@ void DebugHUD_DoInterface(DebugHUD *hud)
         static int counter = 0;
         ImGui::Text("Hello, world!");                           // Display some text (you can use a format string too)
         ImGui::SliderFloat("float", &f, 0.0f, 1.0f);            // Edit 1 float using a slider from 0.0f to 1.0f    
-        ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
+        ImGui::ColorEdit3("clear color", hud->clearColor);      // Edit 3 floats representing a color
 
         ImGui::Checkbox("Demo Window", &hud->show_demo_window);      // Edit bools storing our windows open/close state
         ImGui::Checkbox("Another Window", &hud->show_another_window);
@@ -49,7 +54,7 @@ void DebugHUD_DoInterface(DebugHUD *hud)
     // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
     if (hud->show_another_window)
     {
-        ImGui::Begin("Another Window", &hud-?show_another_window);
+        ImGui::Begin("Another Window", &hud->show_another_window);
         ImGui::Text("Hello from another window!");
         ImGui::ColorEdit3("Cube 1 Color", hud->cubeColor1);
         ImGui::ColorEdit3("Cube 2 Color", hud->cubeColor2);

+ 1 - 0
examples/apple_example/imguiex-ios/debug_hud.h

@@ -11,6 +11,7 @@ typedef struct DebugHUD
     float rotation_speed;
     float cubeColor1[4];
     float cubeColor2[4];
+    float clearColor[4];
 } DebugHUD;
 
 #if __cplusplus