Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this will take yeeeaaars
- //using SDL and standard IO thing
- #include <SDL.h>
- #include <stdio.h>
- //screen (Scream) size
- const int SCREEN_WIDTH = 1024;
- const int SCREEN_HEIGHT = 768;
- int main(int argc, char* args[])
- {
- //the window
- SDL_Window* window = NULL;
- SDL_Surface* screenSurface = NULL;
- //initialize SDL
- if (SDL_Init(SDL_INIT_VIDEO) < 0)
- {
- printf("SDL could not initialize, SDL_Error %s\n", SDL_GetError() );
- }
- else
- {
- //make a window already
- window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
- if (window = NULL)
- {
- printf("Window couldn't be created, dummy. SDL_Error: %s\n", SDL_GetError());
- }
- else
- {
- //Get window surface
- screenSurface = SDL_GetWindowSurface(window);
- //Fill the surface white
- SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));
- // update the serface
- SDL_UpdateWindowSurface(window);
- //Wait four seconds
- SDL_Delay(4000);
- }
- }
- //break the window
- SDL_DestroyWindow(window);
- //stop SDL
- SDL_Quit();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement