Differences From Artifact [4a2a0ee6d3]:
- File src/rendertext.m — part of check-in [12cac9666a] at 2025-03-20 22:22:40 on branch trunk — Convert remaining files to pure Objective-C (user: js, size: 6369) [annotate] [blame] [check-ins using]
- File
src/rendertext.mm
— part of check-in
[489124a92f]
at
2025-03-16 10:11:39
on branch trunk
— Use one autorelease pool per frame
This way, nowhere else autorelease pools need to be managed. (user: js, size: 6369) [annotate] [blame] [check-ins using]
To Artifact [da461b7a90]:
- File src/rendertext.m — part of check-in [932a90c261] at 2025-03-29 13:01:06 on branch trunk — Make more use of OFColor (user: js, size: 6478) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 8 9 10 | // rendertext.cpp: based on Don's gl_text.cpp #include "cube.h" short char_coords[96][4] = { { 0, 0, 25, 64 }, //! { 25, 0, 54, 64 }, //" { 54, 0, 107, 64 }, // # { 107, 0, 148, 64 }, //$ { 148, 0, 217, 64 }, //% | > > | 1 2 3 4 5 6 7 8 9 10 11 12 | // rendertext.cpp: based on Don's gl_text.cpp #include "cube.h" #import "OFColor+Cube.h" short char_coords[96][4] = { { 0, 0, 25, 64 }, //! { 25, 0, 54, 64 }, //" { 54, 0, 107, 64 }, // # { 107, 0, 148, 64 }, //$ { 148, 0, 217, 64 }, //% |
︙ | ︙ | |||
144 145 146 147 148 149 150 | } void draw_text(OFString *string, int left, int top, int gl_num) { glBlendFunc(GL_ONE, GL_ONE); glBindTexture(GL_TEXTURE_2D, gl_num); | | | > > > | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | } void draw_text(OFString *string, int left, int top, int gl_num) { glBlendFunc(GL_ONE, GL_ONE); glBindTexture(GL_TEXTURE_2D, gl_num); [OFColor.white cube_setAsGLColor]; int x = left; int y = top; int i; float in_left, in_top, in_right, in_bottom; int in_width, in_height; const char *str = string.UTF8String; size_t len = string.UTF8StringLength; for (i = 0; i < len; i++) { int c = str[i]; if (c == '\t') { x = (x - left + PIXELTAB) / PIXELTAB * PIXELTAB + left; continue; } if (c == '\f') { [[OFColor colorWithRed:0.25f green:1.0f blue:0.5f alpha:1.0f] cube_setAsGLColor]; continue; } if (c == ' ') { x += FONTH / 2; continue; } |
︙ | ︙ |