A 2d game engine in under 1000 lines of C

栏目: IT技术 · 发布时间: 5年前

内容简介:Basque is a top down 2d game engine.

Basque

Basque is a top down 2d game engine.

A 2d game engine in under 1000 lines of C A 2d game engine in under 1000 lines of C

Global keyboard shortcuts:

: Move player North

: Move player East

: Move player South

: Move player West

q : Quit

e : Toggle edit mode

Edit mode shortcuts:

l : Toggle map library

Mouse button 1 (left click): Place tile

Mouse button 2 (right click): Select tile

Why do this?

Why not just use Godot/Unity/et cetera? Basque has a very different priority list than these engines. It is not a generic engine. There isn't much here, but it is a good starting point if you are looking to roll your own engine, here is what it does do:

  • Map editing (with an easy to understand plain text format).
  • Spritesheet animation.
  • Background music.
  • Collision detection.
  • Some frame rate limiting (this should be improved).

At this point the engine will start becoming more specific to the game I am building, which is why I see this as the best time to open source it. Since it could be useful to others, either as a starting point, or just as a guide of how to do some things with SDL2. Note that all of the code is not necessarily the best solution to these problems, but it is a solution.

Basque currently requires:

  • SDL2
  • SDL2_image
  • SDL2_mixer
  • SDL2_ttf

Getting SDL2 installed:

Linux:

apt:

sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev

dnf:

sudo dnf install SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel

Or whatever the equivalent package is for your distro.

Mac:

brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf

Windows:

  1. Download the latest VC development files from: https://libsdl.org

  2. Place the entire contents of include and lib under C:\INCLUDE\SDL2 .

  3. Copy all DLLs under lib to C:\Windows\System32 and C:\Windows\SysWOW64 .

  4. Repeat for SDL2_image , SDL2_mixer , and SDL2_ttf .

  5. Profit.


以上所述就是小编给大家介绍的《A 2d game engine in under 1000 lines of C》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

超级连接者:破解新互联时代的成功密码

超级连接者:破解新互联时代的成功密码

伊桑•祖克曼(ETHAN ZUCKERMAN) / 林玮、张晨 / 浙江人民出版社 / 2018-8-1 / CNY 72.90

● 我们生活在一个互联互通的世界,我们需要辩证地看待某些事件,发现隐藏在背后的真相。着眼当下,看清彼此之间的联系,而非凭空幻想未来世界联系之紧密。数字世界主义要求我们承担起责任,让隐藏的联系变成现实。 ● 我们对世界的看法是局限的、不完整的、带有偏见的。如果我们想要改变从这个广阔的世界所获取的信息,我们需要做出结构性的改变。 ● 建立联系是一种新的力量。无论是在国家层面、企业层面还是个......一起来看看 《超级连接者:破解新互联时代的成功密码》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具