[C Entry, c Entry
The code for this series of notes is encoded and tested under Ubuntu 14.04 for no reason, because my laptop only has one Ubuntu system, the only third-party library SDL used is open-source and cross-platform. So even if you are using Windows or Mac, you can run all the code.
1. Install the SDL library and its extension
Ubuntu:
Sudo apt-get install libsdl2-devsudo apt-get install libsdl2-gfx-devsudo apt-get install libsdl2-image-devsudo apt-get install libsdl2-mixer-devsudo apt-get install libsdl2-net-devsudo apt-get install libsdl2-ttf-dev
Windows or Mac can be downloaded and installed on the SDL official website.
Note the differences between SDL versions 1 and 2. download the latest version 2.
After installing Ubuntu, all the SDL header files are under the/usr/include/SDL2/directory. Therefore, the header file format in my code is # include <SDL2/SDL. h> or <SDL2/SDL_ttf.h>. If you are not Ubuntu, set the header file location correctly.
2. Install the integrated development environment
Any text editor. I use Code: Blocks. If you are not good at writing Makefile, we recommend using it. This sentence can be ignored directly if Makefile is used.