Browse Source

Fixed FontImGui, now readable.

Thomas Buck 10 years ago
parent
commit
7e3389dcf0
3 changed files with 9 additions and 10 deletions
  1. 3
    0
      ChangeLog.md
  2. 4
    4
      src/system/FontImGui.cpp
  3. 2
    6
      src/utils/binary.cpp

+ 3
- 0
ChangeLog.md View File

@@ -2,6 +2,9 @@
2 2
 
3 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 8
     [ 20150103 ]
6 9
     * Fixed bug in WindowSDL where resizing only worked after calling it two times.
7 10
     * Fixed bug in Console that caused its window to get bigger after each launch.

+ 4
- 4
src/system/FontImGui.cpp View File

@@ -11,14 +11,14 @@
11 11
 #include "UI.h"
12 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 17
 unsigned int FontImGui::widthText(float scale, std::string s) {
18 18
     ImGuiIO& io = ImGui::GetIO();
19 19
     ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, FLT_MAX, io.DisplaySize.y, s.c_str(),
20 20
                                          s.c_str() + s.length());
21
-    return size.y;
21
+    return size.x;
22 22
 }
23 23
 
24 24
 void FontImGui::drawText(unsigned int x, unsigned int y, float scale,
@@ -39,7 +39,7 @@ unsigned int FontImGui::heightText(float scale, unsigned int maxWidth, std::stri
39 39
     ImGuiIO& io = ImGui::GetIO();
40 40
     ImVec2 size = io.Font->CalcTextSizeA(scale * SCALE_CALC, FLT_MAX, maxWidth, s.c_str(),
41 41
                                          s.c_str() + s.length());
42
-    return size.x;
42
+    return size.y;
43 43
 }
44 44
 
45 45
 void FontImGui::drawTextWrapped(unsigned int x, unsigned int y, float scale,

+ 2
- 6
src/utils/binary.cpp View File

@@ -105,9 +105,7 @@ int64_t BinaryReader::read64() {
105 105
 // ----------------------------------------------------------------------------
106 106
 
107 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 111
 BinaryFile::~BinaryFile() {
@@ -150,9 +148,7 @@ void BinaryFile::read(char* d, int c) {
150 148
 // ----------------------------------------------------------------------------
151 149
 
152 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 154
 BinaryMemory::~BinaryMemory() {

Loading…
Cancel
Save