[ad_1]
A tutorial’s code from LazyFoo fantastic place’s 01_hello_SDL
web page does not present a white type, however a desktop’s display, like a screenshot. Something like:
The code:
//Using SDL and normal IO
#embody <SDL2/SDL.h>
#embody <stdio.h>
//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
int essential( int argc, char* args[] )
{
//The window we'll be rendering to
SDL_Window* window = NULL;
//The floor contained by the window
SDL_Surface* screenSurface = NULL;
//Initialize SDL
if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "SDL couldn't initialize! SDL_Error: %sn", SDL_GetError() );
}
else
{
//Create window
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! SDL_Error: %sn", SDL_GetError() );
}
else
{
//Get window floor
screenSurface = SDL_GetWindowFloor( window );
//Fill the floor white
SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) );
//Update the floor
SDL_UpdateWindowFloor( window );
//Wait two seconds
SDL_Delay( 2000 );
}
}
//Destroy window
SDL_DestroyWindow( window );
//Quit SDL subsystems
SDL_Quit();
return 0;
}
Putting PumpEvents();
or whereas(SDL_PollEvent(&occasion))...
did not work, sadly.
The machine’s traits:
- CPU: i7 M620
- GPU: Intel Core Processor Integrated Graphics Controller
- GPU Driver: i915
- RAM: 8GB
- OS: KDE Neon 5.15.4 64bit, 4.15.0-47 Kernel, absolutely up to date
[ad_2]