A simple game made by SDL(simple directmedia layer)
But here achieve it by three ways: c
, c++
, and golang
The Full game see the codes under cpp
c and go just made the main functions such as moving the snake and eating the food to grow length
But cpp version made extra achievements like counting the score and showing the state
make sure you have install SDL on your computer and you can use it with pkg-config
Also, all the version need SDL_ttf, make sure it's installed, too.
Then, use make
to compile c
and cpp
versions.
Notice: The default compiler is gcc, you can download mingw to compile this
This is special to build
for some reason, it still use make
.
make four new directory (pkg, bin, include and lib) under go folder.
get to the path you install the sdl and copy the .so
(on Linux/Unix) or .dll
(Windows) or even .dylib
(MacOS) files under lib folder to the lib
folder you have made.
Rename SDL2 to SDLg (all c-share library)
copy all files under include folder to include
folder you have made.
Remember to rename SDL.h to SDLg.h
Make sure you can use go
compiler.
Download go on GoLang or Org Site
use makefile to build everything (Do not mind command echo
not found!)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。