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("video mode set\n");
47 res = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
55 SDL_TimerID timer = SDL_AddTimer(10, tick, NULL);
56 assert(timer != NULL);
58 actor = HAA_CreateActor(SDL_SWSURFACE, 200, 200, 16);
61 SDL_FillRect(actor->surface, NULL,
62 SDL_MapRGB(actor->surface->format, 255, 255, 0));
64 HAA_SetPosition(actor, 400, 120);
68 while (SDL_WaitEvent(&event)) {
69 if (HAA_FilterEvent(&event) == 0) continue;
74 //HAA_SetRotation(actor, HAA_Y_AXIS, degrees, 0, 0, 0);
75 res = HAA_Flip(actor);
78 case SDL_MOUSEBUTTONUP:
79 printf("Switching fullscreen\n");
80 fullscreen = !fullscreen;