SDL_Surface *SDL_WidgetGetActiveSurface() { return SDL_GetSurfaceStack(); }
/* * Draws all widgets of the current stack onto the destiation screen */ int SDL_DrawAllWidgets(SDL_Window *Window) { T_Widget_Draw draw; /* Draw function prototype */ SDL_WidgetList *WidgetList; SDL_Surface *active_surface = NULL; SDL_Widget *Widget; #if 0 printf("SDL_DrawAllWidgets %p\n",Window); SDL_Rect dest; SDL_Rect src; if(target_surface == NULL && screen) target_surface = screen; active_surface = SDL_GetSurfaceStack(); if(active_surface == NULL) return 0; if(previous != active_surface) { last_surface=previous; fadeon=1; } dest.x=0; dest.y=0; dest.w=0; dest.h=0; if(active_surface) { src.x=0; src.y=0; src.w=active_surface->w; src.h=active_surface->h; } #endif WidgetList=Window->WidgetList; if(WidgetList == NULL) printf("Nothing to draw\n"); SDL_mutexP(MyMutex); while(WidgetList) { Widget=(SDL_Widget*)WidgetList->Widget; if(Widget->flags & WIDGET_VISIBLE) { draw=SDL_WidgetTypeGetDraw(Widget->Type); if(draw) { draw(Widget,Widget->Surface,NULL); } } WidgetList=WidgetList->Next; } SDL_mutexV(MyMutex); SDL_UpdateRect(Window->surface,0,0,0,0); if(previous!=active_surface) previous=active_surface; return 1; }
/* * Draws all widgets of the current stack onto the destiation screen */ int SDL_DrawAllWidgets(SDL_Surface *screen) { T_Widget_Draw draw; //T_Widget_Properties properties; Stack* current_widget; SDL_Surface *active_surface = NULL; SDL_Rect dest; SDL_Rect src; if(StackLock) return 0; active_surface=SDL_GetSurfaceStack(); if(active_surface == NULL) return 0; if(previous != active_surface) { last_surface=previous; fadeon=1; } dest.x=0; dest.y=0; dest.w=0; dest.h=0; if(active_surface) { src.x=0; src.y=0; src.w=active_surface->w; src.h=active_surface->h; } SDL_WidgetLOCK(); current_widget=SDL_StackGetStack(); // if(current_widget == NULL) // printf("Nothing to draw\n"); while(current_widget) { draw=WidgetTable[current_widget->type]->draw; draw(current_widget->data,active_surface); current_widget=current_widget->next; } if(forceredraw) forceredraw=0; SDL_BlitSurface(active_surface,NULL,screen,NULL); // SDL_BlitSurface(last_surface,&src,screen,&dest); SDL_UpdateRect(screen,0,0,0,0); if(previous!=active_surface) previous=active_surface; SDL_WidgetUNLOCK(); return 1; }