Basic SDL Graphics
Testing some basic windo and rendering functions with SDL library in C++.
Notes
SDL lifecycle:
Window management:
Events
- SDL_PollEvent
- returns SDL_Event - union of all event structures used in SDL
Rendering
- SDL_CreateRenderer - does the drawing
- SDL_CreateTexture -
- SDL_UpdateTexture -
Running the Example
See example.cpp for details. It links with the SDL library and uses a few informational APIs to get basic verification things are working.
A makefile compiles and runs the examples:
$ make
c++ -std=c++17 -Wall -O3 `sdl2-config --cflags --libs` example.cpp -o example
./example;
It generates an “abstract image”: