Browse Source

SDL TTF always required

Thomas Buck 11 years ago
parent
commit
5e71ae6199
5 changed files with 10 additions and 35 deletions
  1. 3
    0
      ChangeLog
  2. 1
    2
      Makefile
  3. 3
    3
      include/Texture.h
  4. 0
    13
      src/Texture.cpp
  5. 3
    17
      test/GLString.cpp

+ 3
- 0
ChangeLog View File

@@ -5,6 +5,9 @@
5 5
 
6 6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7 7
 
8
+	[ 20140120 ]
9
+	* Removed HAVE_SDL & HAVE_SDL_TTF flags. SDL & TTF always required!
10
+
8 11
 	[ 20140119 ]
9 12
 	* Enabled linear texture filtering for fonts, resulting in nicer
10 13
 	  looking down scaling

+ 1
- 2
Makefile View File

@@ -32,7 +32,6 @@ UNAME=$(shell uname -s)
32 32
 BASE_DEFS=$(shell sdl-config --cflags) -Iinclude -DSDL_INTERFACE \
33 33
 	-DUSING_OPENGL -DZLIB_SUPPORT -DUSING_EMITTER \
34 34
 	-DUSING_OPENAL -DUSING_TGA -DUSING_PTHREADS \
35
-	-DHAVE_SDL_TTF
36 35
 
37 36
 BASE_LIBS=$(shell sdl-config --libs) -lz -lstdc++ \
38 37
 	-lpthread -lSDL_ttf
@@ -341,7 +340,7 @@ TombRaider.test:
341 340
 
342 341
 GLString.test:
343 342
 	mkdir -p $(BUILD_TEST_DIR)
344
-	$(CC) $(FLAGS_ALL) $(WARNINGS) -Iinclude -DHAVE_SDL_TTF -DHAVE_SDL \
343
+	$(CC) $(FLAGS_ALL) $(WARNINGS) -Iinclude \
345 344
 	$(shell sdl-config --cflags) $(shell sdl-config --libs) \
346 345
 	$(GL_LIBS) $(GL_DEFS) -lSDL_ttf -lm -lstdc++ \
347 346
 	src/Texture.cpp src/GLString.cpp \

+ 3
- 3
include/Texture.h View File

@@ -90,9 +90,9 @@ class Texture
90 90
 
91 91
 	enum TextureFlag
92 92
 	{
93
-		fUseMipmaps			= 1,
94
-		fUseMultiTexture	= 2,
95
-		fUseSDL_TTF			= 4
93
+		fUseMipmaps			= (1 << 0),
94
+		fUseMultiTexture	= (1 << 1),
95
+        fUseSDL_TTF         = (1 << 2)
96 96
 	};
97 97
 
98 98
 

+ 0
- 13
src/Texture.cpp View File

@@ -41,9 +41,7 @@
41 41
 #include <TGA.h>
42 42
 #endif
43 43
 
44
-#ifdef HAVE_SDL_TTF
45 44
 #include <SDL/SDL_ttf.h>
46
-#endif
47 45
 
48 46
 #ifdef __APPLE__
49 47
 #include <OpenGL/gl.h>
@@ -299,7 +297,6 @@ int Texture::loadFontTTF(const char *filename,
299 297
 
300 298
 gl_font_t *Texture::generateFont(ttf_texture_t *texture)
301 299
 {
302
-#ifdef HAVE_SDL_TTF
303 300
 	const float spacing = 4.0;
304 301
 	unsigned int i;
305 302
 	float u, v, u2, v2;
@@ -376,9 +373,6 @@ gl_font_t *Texture::generateFont(ttf_texture_t *texture)
376 373
 	}
377 374
 
378 375
 	return font;
379
-#else
380
-	return NULL;
381
-#endif
382 376
 }
383 377
 
384 378
 
@@ -389,7 +383,6 @@ ttf_texture_t *Texture::generateFontTexture(const char *filename, int pointSize,
389 383
 														  unsigned int count,
390 384
 														  char verbose)
391 385
 {
392
-#ifdef HAVE_SDL_TTF
393 386
 	unsigned int i;
394 387
 	int xx = 0, yy = 0, hh = 0, k, h, w, offset;
395 388
 	unsigned char b;
@@ -521,10 +514,6 @@ ttf_texture_t *Texture::generateFontTexture(const char *filename, int pointSize,
521 514
 	TTF_CloseFont(font);
522 515
 
523 516
 	return texture;
524
-#else
525
-	printf("SDL_TTF not enabled in this build.\n");
526
-	return NULL;
527
-#endif
528 517
 }
529 518
 
530 519
 
@@ -548,7 +537,6 @@ int Texture::loadColorTexture(unsigned char rgba[4],
548 537
 
549 538
 void Texture::initSDL_TTF()
550 539
 {
551
-#ifdef HAVE_SDL_TTF
552 540
 	// Initialize the TTF library
553 541
 	if (TTF_Init() < 0)
554 542
 	{
@@ -562,7 +550,6 @@ void Texture::initSDL_TTF()
562 550
 		printf("Started SDL_TTF subsystem!\n");
563 551
 		atexit(TTF_Quit);
564 552
 	}
565
-#endif
566 553
 }
567 554
 
568 555
 

+ 3
- 17
test/GLString.cpp View File

@@ -6,23 +6,19 @@
6 6
  */
7 7
 
8 8
 #include <math.h>
9
-
9
+#include <SDL/SDL.h>
10 10
 #ifdef __APPLE__
11 11
 #include <OpenGL/glu.h>
12 12
 #else
13 13
 #include <GL/glu.h>
14 14
 #endif
15 15
 
16
-#ifdef HAVE_SDL_TTF
17 16
 #include <Texture.h>
18
-Texture gTexture;
19
-#else
20
-#error "Requires SDL_TTF"
21
-#endif
22
-
23 17
 #include <GLString.h>
24 18
 
25 19
 GLString *TEXT;
20
+SDL_Surface *SDL_WINDOW = NULL;
21
+Texture gTexture;
26 22
 
27 23
 void swap_buffers();
28 24
 
@@ -86,13 +82,6 @@ void event_display(int width, int height)
86 82
 }
87 83
 
88 84
 
89
-#ifdef HAVE_SDL
90
-#include <SDL/SDL.h>
91
-
92
-
93
-SDL_Surface *SDL_WINDOW = NULL;
94
-
95
-
96 85
 void swap_buffers()
97 86
 {
98 87
 	SDL_GL_SwapBuffers();
@@ -292,9 +281,6 @@ int main_gl(int argc, char *argv[])
292 281
 
293 282
   return 0;
294 283
 }
295
-#else
296
-#error "Requires SDL to create GL Context"
297
-#endif
298 284
 
299 285
 int main(int argc, char *argv[])
300 286
 {

Loading…
Cancel
Save