1 /* Here's a simple example of combining SDL and PDCurses functionality.
2 The top portion of the window is devoted to SDL, with a four-line
3 (assuming the default 8x16 font) stdscr at the bottom.
5 $Id: sdltest.c,v 1.2 2008/07/14 04:24:52 wmcbrine Exp $
13 /* You could #include pdcsdl.h, or just add the relevant declarations
16 PDCEX SDL_Surface
*pdc_screen
;
17 PDCEX
int pdc_yoffset
;
19 int main(int argc
, char **argv
)
24 seed
= time((time_t *)0);
29 if (SDL_Init(SDL_INIT_VIDEO
) < 0)
34 pdc_screen
= SDL_SetVideoMode(640, 480, 0, SDL_SWSURFACE
|SDL_ANYFORMAT
);
36 /* Initialize PDCurses */
38 pdc_yoffset
= 416; /* 480 - 4 * 16 */
42 scrollok(stdscr
, TRUE
);
44 PDC_set_title("PDCurses for SDL");
46 /* Do some SDL stuff */
48 for (i
= 640, j
= 416; j
; i
-= 2, j
-= 2)
52 dest
.x
= (640 - i
) / 2;
53 dest
.y
= (416 - j
) / 2;
57 SDL_FillRect(pdc_screen
, &dest
,
58 SDL_MapRGB(pdc_screen
->format
, rand() % 256,
59 rand() % 256, rand() % 256));
62 SDL_UpdateRect(pdc_screen
, 0, 0, 640, 416);
64 /* Do some curses stuff */
66 init_pair(1, COLOR_WHITE
+ 8, COLOR_BLUE
);
69 addstr("This is a demo of ");
71 addstr("PDCurses for SDL");
73 addstr(".\nYour comments here: ");
75 addstr("Press any key to exit.");