Rev 5131 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5131 | clevermous | 1 | #include |
2 | #include |
||
3 | #include |
||
4 | #include "SDL.h" |
||
5 | #include "SDL_ttf.h" |
||
6 | |||
7 | int app_main(int argc, char *argv[]) |
||
8 | { |
||
9 | SDL_Surface *screen, *txt; |
||
10 | static SDL_Color kolor={0xC0,0xC0,0,0}; |
||
11 | static SDL_Color kolor1={0x00,0xC0,0xC0,0}; |
||
12 | SDL_Event event; |
||
13 | SDL_Rect xtmp={x:30,y:30}; |
||
14 | TTF_Font * fnt, * fnt1; |
||
15 | static int done=0; |
||
16 | int i; |
||
17 | if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) |
||
18 | { |
||
19 | SDL_printf("Couldn't initialize SDL: %s\n",SDL_GetError()); |
||
20 | return(255); |
||
21 | } |
||
22 | screen = SDL_SetVideoMode(512,348,24,SDL_SWSURFACE); |
||
23 | if ( screen == NULL ) |
||
24 | { |
||
25 | SDL_printf("Couldn't set %dx%dx%d video mode: %s\n", |
||
26 | 640,480,24, SDL_GetError()); |
||
27 | exit(-1); |
||
28 | } |
||
29 | if(TTF_Init()!=0) |
||
30 | { |
||
31 | SDL_printf("Couldn't initialize TTF library\n"); |
||
32 | exit(-1); |
||
33 | } |
||
9583 | vitalkrilo | 34 | fnt=TTF_OpenFont("/SYS/INDIGO.TTF",50); |
35 | fnt1=TTF_OpenFont("/SYS/HYDROGEN.TTF",35); |
||
5131 | clevermous | 36 | TTF_SetFontStyle(fnt,TTF_STYLE_ITALIC|TTF_STYLE_BOLD|TTF_STYLE_UNDERLINE); |
37 | txt=TTF_RenderText_Solid(fnt,"MenuetOS",kolor); |
||
38 | if(!txt) |
||
39 | { |
||
40 | SDL_printf("Unable to create rendering surface\n"); |
||
41 | exit(-1); |
||
42 | } |
||
43 | xtmp.w=txt->w; |
||
44 | xtmp.h=txt->h; |
||
45 | SDL_BlitSurface(txt,NULL,screen,&xtmp); |
||
46 | SDL_FreeSurface(txt); |
||
47 | txt=TTF_RenderText_Solid(fnt1,"supports TTF",kolor1); |
||
48 | xtmp.w=txt->w; |
||
49 | xtmp.h=txt->h; |
||
50 | xtmp.x=40; |
||
51 | xtmp.y=100; |
||
52 | SDL_BlitSurface(txt,NULL,screen,&xtmp); |
||
53 | SDL_FreeSurface(txt); |
||
54 | while ( ! done ) |
||
55 | { |
||
56 | if ( SDL_PollEvent(&event) ) |
||
57 | { |
||
58 | switch (event.type) |
||
59 | { |
||
60 | case SDL_QUIT: |
||
61 | argv[i+1] = NULL; |
||
62 | done = 1; |
||
63 | break; |
||
64 | default: |
||
65 | break; |
||
66 | } |
||
67 | } else { |
||
68 | SDL_Delay(3); |
||
69 | } |
||
70 | } |
||
71 | SDL_FreeSurface(txt); |
||
72 | SDL_Quit(); |
||
73 | return(0); |
||
74 | }> |