## How to Load and Render Tiled Maps in Your SDL2 Game
![Tiled Map Example](screenshot/example.png?raw=true)
**This repository contains sample code for [my article on loading and rendering Tiled maps in SDL2](https://codeofconnor.wordpress.com/2017/08/18/how-to-load-and-render-tiled-maps-in-your-sdl2-game/).**
This repository's *only* focus is on demonstrating how to load and render Tiled maps in SDL2. The rest of the code is a quick and dirty set-up for the Tiled level loading functionality to stand on and should not be used or regarded as good game design with SDL2.
## Credit
The tileset I used in the example Tiled map was the result of Hyptosis's hard work at [opengameart.org](https://opengameart.org/). Check out their [website](http://www.lorestrome.com/) or their [opengameart profile](https://opengameart.org/users/hyptosis).
## Pre-requisites
* A C++ compiler
* cmake
* SDL2, SDL2 Image, and TMXLite libraries installed
## Building
Whatever you do, make sure that you run your built binary from the project root (where the `res/` folder is), so that the executable can find the images and map.
```
$ git clone https://github.com/connorkuehl/sdl2-tiled-example.git
$ cd sdl2-tiled-example
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd ..
$ ./build/sdl2_example
```
没有合适的资源?快使用搜索试试~ 我知道了~
一个小示例,展示了如何在 SDL2游戏项目中加载和渲染平铺地图_C++_代码_下载
共16个文件
cpp:3个
hpp:3个
cmake:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 8 浏览量
2022-06-23
23:02:13
上传
评论
收藏 184KB ZIP 举报
温馨提示
如何在 SDL2 游戏中加载和渲染平铺地图 此存储库的唯一重点是演示如何在 SDL2 中加载和呈现平铺地图。其余的代码是一个快速而肮脏的设置,用于支持 Tiled 关卡加载功能,不应使用或视为 SDL2 的良好游戏设计。 效果展示: https://github.com/connorkuehl/sdl2-tiled-example/blob/master/screenshot/example.png?raw=true
资源推荐
资源详情
资源评论
收起资源包目录
sdl2-tiled-example-master (1).zip (16个子文件)
sdl2-tiled-example-master
CMakeLists.txt 693B
.gitignore 29B
README.md 1KB
.gitattributes 25B
src
main.cpp 2KB
assets.cpp 1KB
level.cpp 5KB
level.hpp 1KB
game.hpp 57B
assets.hpp 323B
cmake
FindSDL2_image.cmake 4KB
FindTMXLITE.cmake 366B
FindSDL2.cmake 6KB
screenshot
example.png 119KB
res
tileset
city.png 62KB
map
example.tmx 2KB
共 16 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功