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
 
5
 
6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
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
 	[ 20140119 ]
11
 	[ 20140119 ]
9
 	* Enabled linear texture filtering for fonts, resulting in nicer
12
 	* Enabled linear texture filtering for fonts, resulting in nicer
10
 	  looking down scaling
13
 	  looking down scaling

+ 1
- 2
Makefile View File

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

+ 3
- 3
include/Texture.h View File

90
 
90
 
91
 	enum TextureFlag
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
 #include <TGA.h>
41
 #include <TGA.h>
42
 #endif
42
 #endif
43
 
43
 
44
-#ifdef HAVE_SDL_TTF
45
 #include <SDL/SDL_ttf.h>
44
 #include <SDL/SDL_ttf.h>
46
-#endif
47
 
45
 
48
 #ifdef __APPLE__
46
 #ifdef __APPLE__
49
 #include <OpenGL/gl.h>
47
 #include <OpenGL/gl.h>
299
 
297
 
300
 gl_font_t *Texture::generateFont(ttf_texture_t *texture)
298
 gl_font_t *Texture::generateFont(ttf_texture_t *texture)
301
 {
299
 {
302
-#ifdef HAVE_SDL_TTF
303
 	const float spacing = 4.0;
300
 	const float spacing = 4.0;
304
 	unsigned int i;
301
 	unsigned int i;
305
 	float u, v, u2, v2;
302
 	float u, v, u2, v2;
376
 	}
373
 	}
377
 
374
 
378
 	return font;
375
 	return font;
379
-#else
380
-	return NULL;
381
-#endif
382
 }
376
 }
383
 
377
 
384
 
378
 
389
 														  unsigned int count,
383
 														  unsigned int count,
390
 														  char verbose)
384
 														  char verbose)
391
 {
385
 {
392
-#ifdef HAVE_SDL_TTF
393
 	unsigned int i;
386
 	unsigned int i;
394
 	int xx = 0, yy = 0, hh = 0, k, h, w, offset;
387
 	int xx = 0, yy = 0, hh = 0, k, h, w, offset;
395
 	unsigned char b;
388
 	unsigned char b;
521
 	TTF_CloseFont(font);
514
 	TTF_CloseFont(font);
522
 
515
 
523
 	return texture;
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
 
537
 
549
 void Texture::initSDL_TTF()
538
 void Texture::initSDL_TTF()
550
 {
539
 {
551
-#ifdef HAVE_SDL_TTF
552
 	// Initialize the TTF library
540
 	// Initialize the TTF library
553
 	if (TTF_Init() < 0)
541
 	if (TTF_Init() < 0)
554
 	{
542
 	{
562
 		printf("Started SDL_TTF subsystem!\n");
550
 		printf("Started SDL_TTF subsystem!\n");
563
 		atexit(TTF_Quit);
551
 		atexit(TTF_Quit);
564
 	}
552
 	}
565
-#endif
566
 }
553
 }
567
 
554
 
568
 
555
 

+ 3
- 17
test/GLString.cpp View File

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

Loading…
Cancel
Save