2 * Acess2 GUI (AxWin3) WM
3 * - By John Hodge (thePowersGang)
6 * - SDL build video output
14 int giScreenWidth = 1280;
15 int giScreenHeight = 720;
18 void Video_Setup(void)
20 gScreen = SDL_SetVideoMode(giScreenWidth, giScreenHeight, 32, SDL_SWSURFACE);
22 fprintf(stderr, "Unable to set %ix%i video mode: %s\n",
23 giScreenWidth, giScreenHeight,
27 SDL_WM_SetCaption("Acess2 GUI v3", "AxWin3");
30 void Video_Update(void)
35 void Video_FillRect(int X, int Y, int W, int H, uint32_t Colour)
37 SDL_Rect r = {.x = X, .y = Y, .w = W, .h = H};
38 SDL_FillRect(gScreen, &r, Colour);
41 void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H)
43 printf("Blit (%p, (%i,%i) %ix%i)\n",
44 Source, DstX, DstY, W, H);
45 SDL_Rect r = {.x = DstX, .y = DstY, .w = W, .h = H};
46 SDL_Surface *tmps = SDL_CreateRGBSurfaceFrom(
47 Source, W, H, 32, W*4,
48 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000);
49 SDL_BlitSurface(tmps, NULL, gScreen, &r);
52 uint32_t Video_AlphaBlend(uint32_t _orig, uint32_t _new, uint8_t _alpha)
56 if( _alpha == 0 ) return _orig;
57 if( _alpha == 255 ) return _new;
59 ao = (_orig >> 24) & 0xFF;
60 ro = (_orig >> 16) & 0xFF;
61 go = (_orig >> 8) & 0xFF;
62 bo = (_orig >> 0) & 0xFF;
64 an = (_new >> 24) & 0xFF;
65 rn = (_new >> 16) & 0xFF;
66 gn = (_new >> 8) & 0xFF;
67 bn = (_new >> 0) & 0xFF;
69 if( _alpha == 0x80 ) {
76 ao = ao*(255-_alpha) + an*_alpha;
77 ro = ro*(255-_alpha) + rn*_alpha;
78 go = go*(255-_alpha) + gn*_alpha;
79 bo = bo*(255-_alpha) + bn*_alpha;
86 return (ao << 24) | (ro << 16) | (go << 8) | bo;