1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| static int GUIThread(void *nothing)
{
SDLayer_Display *wlayers;
SDL_Event event;
SDL_Surface *surf;
SDL_Rect rect, rect2;
int order;
int arg1, arg2;
// gfx init
int w[2] = {WIN_DEFAULT_WIDTH,WIN_DEFAULT_WIDTH};
int h[2] = {WIN_DEFAULT_HEIGHT,WIN_DEFAULT_HEIGHT};
wlayers = SDLayer_CreateRGBLayeredDisplay(SDL_ANYFORMAT, SDLAYER_RECTS, 2, w, h, WIN_DEFAULT_BPP, 0, 0, 0, 0);
// gfx loop
while(WaitEvent(&event, Threads::GUIEventWait(), Threads::GUIEventLock()))
{
if(event.type == SDL_USEREVENT)
{
order = (int)event.user.code;
arg1 = (int)event.user.data1;
arg2 = (int)event.user.data2;
if(order == T_ORDER_LOADMENU)
{
MessageBox(NULL, "load menu", "order", MB_OK);
SDL_Surface* img = load_image("bg.bmp");
if(img != (SDL_Surface *)0)
{
surf = SDL_DisplayFormat(img);
if(img == (SDL_Surface*)0)
{
MessageBox(NULL, SDL_GetError(), "error", MB_OK);
}
else
{
//SDL_FreeSurface(img);
MessageBox(NULL, "blit !", "thread", MB_OK);
rect.x = 0;
rect.y = 0;
rect2.x = 50;
rect2.y = 50;
//LAYER(wlayers, 1);
SDLayer_Blit(surf, &rect, wlayers, &rect, 1);
//MessageBox(NULL, SDL_GetError(), "error", MB_OK);
}
}
else
{
MessageBox(NULL, SDL_GetError(), "error", MB_OK);
}
}
else if(order == T_ORDER_FADE)
{
}
else if(order == T_ORDER_SCREEN)
{
}
}
else if(event.type == SDL_QUIT)
{
break;
}
if(event.type == SDL_MOUSEBUTTONDOWN)
{
MessageBox( NULL, "mousebutton down", "Warning", MB_OK );
}
}
return 0;
} |
Partager