Share code to draw using SDL
Posted: Tue Aug 08, 2017 3:37 pm
So far, I use Windows, and the MSYS 1.0 that comes with MinGW to compile.
I can compile this SDL skeleton (with SDL 1, most surely also with SDL 2):
This video shows how to compile it:
Now I want to know how I can create a window and draw generic stuff, like pixels, to the SDL window.
Can you share some clear code so I can do that, just creating the SDL window and drawing in it?
I can compile this SDL skeleton (with SDL 1, most surely also with SDL 2):
Code: Select all
#include <SDL.h>
int main( int argc, char* args[] )
{
//Start SDL
///
SDL_Init( SDL_INIT_EVERYTHING );
//Quit SDL
///
SDL_Quit();
return 0;
}
This video shows how to compile it:
http://lazyfoo.net/SDL_tutorials/lesson ... /index.php
Download SDL 1:
https://www.libsdl.org/download-1.2.php
Commands:
SDLCFLAGS=$(sdl-config --cflags)
SDLLIBS=$(sdl-config --libs)
gcc HelloSDL.cpp -o HelloSDL.exe $SDLCFLAGS $SDLLIBS
HelloSDL.exe
Now I want to know how I can create a window and draw generic stuff, like pixels, to the SDL window.
Can you share some clear code so I can do that, just creating the SDL window and drawing in it?