Pārlūkot izejas kodu

Fixed FontImGui, now readable.

Thomas Buck 9 gadus atpakaļ
vecāks
revīzija
7e3389dcf0
3 mainītis faili ar 9 papildinājumiem un 10 dzēšanām
  1. 3
    0
      ChangeLog.md
  2. 4
    4
      src/system/FontImGui.cpp
  3. 2
    6
      src/utils/binary.cpp

+ 3
- 0
ChangeLog.md Parādīt failu

2
 
2
 
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4
 
4
 
5
+    [ 20150104 ]
6
+    * FontImGui has started to be useful (larger text, proper size calculation).
7
+
5
     [ 20150103 ]
8
     [ 20150103 ]
6
     * Fixed bug in WindowSDL where resizing only worked after calling it two times.
9
     * Fixed bug in WindowSDL where resizing only worked after calling it two times.
7
     * Fixed bug in Console that caused its window to get bigger after each launch.
10
     * Fixed bug in Console that caused its window to get bigger after each launch.

+ 4
- 4
src/system/FontImGui.cpp Parādīt failu

11
 #include "UI.h"
11
 #include "UI.h"
12
 #include "system/FontImGui.h"
12
 #include "system/FontImGui.h"
13
 
13
 
14
-#define SCALE_CALC 1.0f
15
-#define SCALE_DRAW 20.0f
14
+#define SCALE_CALC 30.0f
15
+#define SCALE_DRAW SCALE_CALC
16
 
16
 
17
 unsigned int FontImGui::widthText(float scale, std::string s) {
17
 unsigned int FontImGui::widthText(float scale, std::string s) {
18
     ImGuiIO& io = ImGui::GetIO();
18
     ImGuiIO& io = ImGui::GetIO();
19
     ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, FLT_MAX, io.DisplaySize.y, s.c_str(),
19
     ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, FLT_MAX, io.DisplaySize.y, s.c_str(),
20
                                          s.c_str() + s.length());
20
                                          s.c_str() + s.length());
21
-    return size.y;
21
+    return size.x;
22
 }
22
 }
23
 
23
 
24
 void FontImGui::drawText(unsigned int x, unsigned int y, float scale,
24
 void FontImGui::drawText(unsigned int x, unsigned int y, float scale,
39
     ImGuiIO& io = ImGui::GetIO();
39
     ImGuiIO& io = ImGui::GetIO();
40
     ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, FLT_MAX, maxWidth, s.c_str(),
40
     ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, FLT_MAX, maxWidth, s.c_str(),
41
                                          s.c_str() + s.length());
41
                                          s.c_str() + s.length());
42
-    return size.x;
42
+    return size.y;
43
 }
43
 }
44
 
44
 
45
 void FontImGui::drawTextWrapped(unsigned int x, unsigned int y, float scale,
45
 void FontImGui::drawTextWrapped(unsigned int x, unsigned int y, float scale,

+ 2
- 6
src/utils/binary.cpp Parādīt failu

105
 // ----------------------------------------------------------------------------
105
 // ----------------------------------------------------------------------------
106
 
106
 
107
 BinaryFile::BinaryFile(std::string f) {
107
 BinaryFile::BinaryFile(std::string f) {
108
-    int r = open(f);
109
-    if (r != 0)
110
-        throw r;
108
+    assert(open(f) == 0);
111
 }
109
 }
112
 
110
 
113
 BinaryFile::~BinaryFile() {
111
 BinaryFile::~BinaryFile() {
150
 // ----------------------------------------------------------------------------
148
 // ----------------------------------------------------------------------------
151
 
149
 
152
 BinaryMemory::BinaryMemory(const char* d, long long m) : data(nullptr), offset(0), max(-1) {
150
 BinaryMemory::BinaryMemory(const char* d, long long m) : data(nullptr), offset(0), max(-1) {
153
-    int r = open(d, m);
154
-    if (r != 0)
155
-        throw r;
151
+    assert(open(d, m) == 0);
156
 }
152
 }
157
 
153
 
158
 BinaryMemory::~BinaryMemory() {
154
 BinaryMemory::~BinaryMemory() {

Notiek ielāde…
Atcelt
Saglabāt