| Summary: | After calling the SDL_Delay(), the window bar is hidden and a white bar is shown instead. | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Feng <santo.chan123> |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus |
| Version: | 2.0.4 | ||
| Hardware: | x86 | ||
| OS: | Mac OS X 10.11 | ||
By any chance, does sticking a call to SDL_PumpEvents() in there before the SDL_Delay() call fix this? We likely have to handle a Window redraw event or something to fix this up and the five-second delay prevents SDL from pumping the event queue to get that event. --ryan. Yes. Adding SDL_PumpEvents() before the SDL_Delay() did fix this. Thank you very much! --feng, Ok, closing this, since it appears to be resolved. --ryan. |
After calling the SDL_Delay(), the window bar is hidden and a white bar is shown instead. I'm not sure if this is a feature or bug. Or I missed something? Thank you! Here is my code: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <SDL2/SDL.h> const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main(int argc, const char *argv[]) { if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); } bool quit = false; SDL_Event event; SDL_Window* window = NULL; window = SDL_CreateWindow("Test SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); SDL_SetRenderDrawColor(renderer, 255, 254, 255, 255 ); SDL_RenderClear(renderer); SDL_RenderPresent(renderer); SDL_Delay(5000); // window bar is hidden, a white blank bar is shown instead. while (!quit) // window bar is shown right now. { SDL_WaitEvent(&event); switch (event.type) { case SDL_QUIT: quit = true; break; } } SDL_DestroyRenderer(renderer); SDL_DestroyWindow(window); SDL_Quit(); return 0; }