Thomas Buck 10 лет назад
Родитель
Сommit
ee9c7f5cd7
3 измененных файлов: 8 добавлений и 4 удалений
  1. 0
    3
      TODO.md
  2. 2
    0
      src/FontManager.cpp
  3. 6
    1
      src/UI.cpp

+ 0
- 3
TODO.md Просмотреть файл

13
 ## Bugs
13
 ## Bugs
14
 
14
 
15
 * Screenshots are sometimes not written, sometimes distorted?
15
 * Screenshots are sometimes not written, sometimes distorted?
16
-* imgui integration still very much unfinished
17
-    * toggling with ‘q’ means one can’t use input ‘q’ into a text field
18
-    * clicking outside of the debug window does nothing
19
 
16
 
20
 ## Cmake
17
 ## Cmake
21
 
18
 

+ 2
- 0
src/FontManager.cpp Просмотреть файл

22
     add(new FontSDL(), ".ttf");
22
     add(new FontSDL(), ".ttf");
23
 #endif
23
 #endif
24
 
24
 
25
+    mFontInit = false;
25
     font = -1;
26
     font = -1;
26
 }
27
 }
27
 
28
 
48
     if (font == -1)
49
     if (font == -1)
49
         return -1;
50
         return -1;
50
 
51
 
52
+    mFontInit = true;
51
     fonts.at(font)->setFont(mFontName);
53
     fonts.at(font)->setFont(mFontName);
52
     return fonts.at(font)->initialize();
54
     return fonts.at(font)->initialize();
53
 }
55
 }

+ 6
- 1
src/UI.cpp Просмотреть файл

84
     ImGuiIO& io = ImGui::GetIO();
84
     ImGuiIO& io = ImGui::GetIO();
85
     io.DisplaySize = ImVec2((float)getWindow().getWidth(), (float)getWindow().getHeight());
85
     io.DisplaySize = ImVec2((float)getWindow().getWidth(), (float)getWindow().getHeight());
86
 
86
 
87
-    static long lastTime = 0;
87
+    static unsigned long lastTime = 0;
88
     io.DeltaTime = ((float)(systemTimerGet() - lastTime)) / 1000.0f;
88
     io.DeltaTime = ((float)(systemTimerGet() - lastTime)) / 1000.0f;
89
     lastTime = systemTimerGet();
89
     lastTime = systemTimerGet();
90
+    if (io.DeltaTime <= 0.0f)
91
+        io.DeltaTime = 1.0f / 60.0f;
90
 
92
 
91
     ImGui::NewFrame();
93
     ImGui::NewFrame();
92
 
94
 
220
 }
222
 }
221
 
223
 
222
 void UI::handleText(char *text, bool notFinished) {
224
 void UI::handleText(char *text, bool notFinished) {
225
+    if (notFinished)
226
+        return;
227
+
223
     ImGuiIO& io = ImGui::GetIO();
228
     ImGuiIO& io = ImGui::GetIO();
224
     while (*text != '\0') {
229
     while (*text != '\0') {
225
         io.AddInputCharacter(*text);
230
         io.AddInputCharacter(*text);

Загрузка…
Отмена
Сохранить