Skip to content

Commit b76cf9c

Browse files
authored
Merge pull request #1594 from gerryhernandez/fix-apple-example
Examples: Apple: Fix iOS code; fixes entire XCode build for Apple example
2 parents 7b005bd + 4786321 commit b76cf9c

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.o

examples/apple_example/imguiex-ios/debug_hud.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ void DebugHUD_InitDefaults( DebugHUD *hud )
2222
hud->cubeColor2[1] = 0.4f;
2323
hud->cubeColor2[2] = 0.4f;
2424
hud->cubeColor2[3] = 1.0f;
25+
26+
hud->clearColor[0] = 0.45f;
27+
hud->clearColor[1] = 0.55f;
28+
hud->clearColor[2] = 0.60f;
29+
hud->clearColor[3] = 1.00f;
2530
}
2631

2732
void DebugHUD_DoInterface(DebugHUD *hud)
@@ -33,7 +38,7 @@ void DebugHUD_DoInterface(DebugHUD *hud)
3338
static int counter = 0;
3439
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
3540
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
36-
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
41+
ImGui::ColorEdit3("clear color", hud->clearColor); // Edit 3 floats representing a color
3742

3843
ImGui::Checkbox("Demo Window", &hud->show_demo_window); // Edit bools storing our windows open/close state
3944
ImGui::Checkbox("Another Window", &hud->show_another_window);
@@ -49,7 +54,7 @@ void DebugHUD_DoInterface(DebugHUD *hud)
4954
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
5055
if (hud->show_another_window)
5156
{
52-
ImGui::Begin("Another Window", &hud-?show_another_window);
57+
ImGui::Begin("Another Window", &hud->show_another_window);
5358
ImGui::Text("Hello from another window!");
5459
ImGui::ColorEdit3("Cube 1 Color", hud->cubeColor1);
5560
ImGui::ColorEdit3("Cube 2 Color", hud->cubeColor2);

examples/apple_example/imguiex-ios/debug_hud.h

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ typedef struct DebugHUD
1111
float rotation_speed;
1212
float cubeColor1[4];
1313
float cubeColor2[4];
14+
float clearColor[4];
1415
} DebugHUD;
1516

1617
#if __cplusplus

0 commit comments

Comments
 (0)