Cube  Diff

Differences From Artifact [4a2a0ee6d3]:

To Artifact [da461b7a90]:


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
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
}

void
draw_text(OFString *string, int left, int top, int gl_num)
{
	glBlendFunc(GL_ONE, GL_ONE);
	glBindTexture(GL_TEXTURE_2D, gl_num);
	glColor3ub(255, 255, 255);

	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') {
			glColor3ub(64, 255, 128);



			continue;
		}

		if (c == ' ') {
			x += FONTH / 2;
			continue;
		}







|



















|
>
>
>







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;
		}