Skip to content

Commit b9929bb

Browse files
committed
Update README.md
1 parent efc06bf commit b9929bb

1 file changed

Lines changed: 5 additions & 92 deletions

File tree

README.md

Lines changed: 5 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -17,98 +17,11 @@ See [Releases](https://github.com/jvcleave/ofxImGui/releases/) for previous vers
1717

1818
![Screenshot](images/Screenshot.png)
1919

20-
Example
21-
-------
20+
### Examples
2221

23-
In `ofApp.h`:
22+
#### example-demo
23+
Works on Desktop, uses imgui demo windows
2424

25-
```cpp
26-
#pragma once
25+
#### example-ios
26+
iOS specific with Keyboard input helper
2727

28-
#include "ofMain.h"
29-
30-
#include "ofxImGui.h"
31-
32-
class ofApp : public ofBaseApp
33-
{
34-
public:
35-
36-
...
37-
38-
ofxImGui gui;
39-
}
40-
```
41-
42-
In `ofApp.cpp`:
43-
44-
```cpp
45-
void ofApp::setup()
46-
{
47-
gui.setup();
48-
}
49-
50-
void ofApp::draw()
51-
{
52-
gui.begin();
53-
54-
static bool show_another_window = true;
55-
static bool show_test_window = true;
56-
57-
if(show_another_window)
58-
{
59-
ImGui::SetNextWindowSize(ImVec2(200, 100), ImGuiSetCond_FirstUseEver);
60-
ImGui::Begin("Another Window", &show_another_window);
61-
ImGui::Text("Hello");
62-
ImGui::End();
63-
}
64-
65-
if(show_test_window)
66-
{
67-
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver);
68-
ImGui::ShowTestWindow(&show_test_window);
69-
}
70-
71-
gui.end();
72-
}
73-
```
74-
75-
Loading Images and Image Buttons
76-
--------------------------------
77-
78-
![ImageButton](images/ImageButton.gif)
79-
80-
```cpp
81-
GLuint tex_button;
82-
83-
void ofApp::setup()
84-
{
85-
gui.setup();
86-
87-
tex_button = gui.loadImage("youtube.png");
88-
}
89-
90-
void ofApp::draw()
91-
{
92-
gui.begin();
93-
94-
bool pressed = ImGui::ImageButton((ImTextureID)(uintptr_t)tex_button, ImVec2(200, 141));
95-
96-
gui.end();
97-
}
98-
```
99-
100-
Loading Custom Fonts
101-
--------------------
102-
103-
Assuming `NotoSans.ttf` placed in application's `data` folder:
104-
105-
```cpp
106-
void ofApp::setup()
107-
{
108-
109-
ImGuiIO * io = &ImGui::GetIO();
110-
io->Fonts->AddFontFromFileTTF(&ofToDataPath("NotoSans.ttf")[0], 24.f);
111-
112-
gui.setup();
113-
}
114-
```

0 commit comments

Comments
 (0)