#define WIDTH 800
#define HEIGHT 600
+#define HBORDER 32
+#define VBORDER 8
#include <stdio.h>
#include <stdlib.h>
#include <cairo.h>
#include <SDL.h>
#include <SDL_image.h>
+#include <SDL_ttf.h>
#define SWAP(x, y) do { \
x ^= y; y ^= x; x ^= y; \
#define IS_CENTER(cx, cy, x, y) \
((x + WIDTH/2 == cx) && (y + HEIGHT/2 == cy))
+TTF_Font *font;
+
SDL_Rect *points;
int psize;
SDL_Surface *slice;
SDL_Rect center;
SDL_Surface *scale;
+ SDL_Surface *text;
+ SDL_Rect box;
+ SDL_Color Yellow = { 255, 255, 0, 0};
center = GetNextPoint (), GetNextPoint (), GetNextPoint ();
slice = SDL_CreateRGBSurface (SDL_SWSURFACE, WIDTH/2, HEIGHT/2,
32,
SDL_UpdateRect (slice, 0, 0, 0, 0);
scale = CairoTarget (slice);
SDL_FreeSurface (slice);
+ text = TTF_RenderUTF8_Solid (font, "GNU", Yellow);
+ box.w = text->w + HBORDER;
+ box.h = text->h + VBORDER;
+ box.x = (WIDTH - text->w - HBORDER) / 2;
+ box.y = HEIGHT - (text->h + 32 + VBORDER/2);
+ SDL_FillRect (scale, &box, SDL_MapRGB (scale->format, 0, 0, 0));
+ box.x += HBORDER/2;
+ box.y += VBORDER/2;
+ box.w -= HBORDER;
+ box.h -= VBORDER;
+ SDL_BlitSurface (text, NULL, scale, &box);
+ SDL_UpdateRect (scale, 0, 0, 0, 0);
+ SDL_FreeSurface (text);
return scale;
}
SDL_Event event;
ReadPoints ("pro-gnu");
SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER);
+ TTF_Init ();
+ font = TTF_OpenFont ("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", 48);
screen = SDL_SetVideoMode (800, 600, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
image = IMG_Load ("/home/cascardo/fotos/debconf.jpg");
SDL_AddTimer (0, ShowNext, NULL);
}
}
SDL_FreeSurface (image);
+ TTF_CloseFont (font);
+ TTF_Quit ();
SDL_Quit ();
free (points);
return 0;