1 /* fullscreen - a SDL_haa sample able to enter fullscreen mode
3 * This file is in the public domain, furnished "as is", without technical
4 * support, and with no warranty, express or implied, as to its usefulness for
16 static bool fullscreen = false;
18 static SDL_Surface *screen;
20 static HAA_Actor *actor;
22 static int degrees = 0;
24 static Uint32 tick(Uint32 interval, void* param)
27 e.type = SDL_VIDEOEXPOSE;
29 degrees = (degrees+2) % 360;
35 static void setup_video_mode()
37 unsigned flags = SDL_SWSURFACE | (fullscreen ? SDL_FULLSCREEN : 0);
38 printf("video mode ...\n");
39 screen = SDL_SetVideoMode(0, 0, 16, flags);
41 printf("updating haa ...\n");
42 int res = HAA_SetVideoMode();
44 printf("video mode set\n");
50 res = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
58 SDL_TimerID timer = SDL_AddTimer(10, tick, NULL);
59 assert(timer != NULL);
61 actor = HAA_CreateActor(SDL_SWSURFACE, 200, 200, 16);
64 SDL_FillRect(actor->surface, NULL,
65 SDL_MapRGB(actor->surface->format, 255, 255, 0));
67 HAA_SetPosition(actor, 600, 120);
71 while (SDL_WaitEvent(&event)) {
72 if (HAA_FilterEvent(&event) == 0) continue;
77 //HAA_SetRotation(actor, HAA_Y_AXIS, degrees, 0, 0, 0);
78 res = HAA_Flip(actor);
81 case SDL_MOUSEBUTTONUP:
82 printf("Switching fullscreen\n");
83 fullscreen = !fullscreen;