官术网_书友最值得收藏!

Sprite Animations in WebAssembly with SDL

At the time of writing, Simple DirectMedia Layer (SDL) is the only 2D rendering library integrated into Emscripten for use in WebAssembly. But, even as more rendering libraries become available, SDL is a highly supported rendering library that has been ported to a large number of platforms and will remain both relevant and useful for WebAssembly and C++ development into the foreseeable future. Using SDL to render to WebGL saves us a tremendous amount of time, because we do not have to write the code to interface between our WebAssembly C++ code and WebGL ourselves. The large community also offers support and documentation. You can find more SDL resources online at libsdl.org.

You will need to include several images in your build to make this project work. Make sure you include the /Chapter04/sprites/ and /Chapter04/font/ folders from the project's GitHub. If you haven't yet downloaded the GitHub project, you can get it online from:  https://github.com/PacktPublishing/Hands-On-Game-Development-with-WebAssembly.

We will cover the following topics in this chapter:

  • Using SDL in WebAssembly
  • Rendering a sprite to the canvas
  • Animating a sprite
  • Moving the sprite
主站蜘蛛池模板: 翁源县| 宣武区| 专栏| 秀山| 青州市| 买车| 东乡县| 阿克陶县| 井冈山市| 白朗县| 鹿邑县| 班玛县| 濮阳市| 临夏县| 登封市| 惠水县| 高碑店市| 罗江县| 莎车县| 前郭尔| 远安县| 上杭县| 合江县| 泗水县| 甘洛县| 中西区| 安远县| 金溪县| 利辛县| 穆棱市| 宿迁市| 昆山市| 成安县| 白城市| 凤山市| 元谋县| 清镇市| 清流县| 晋中市| 宣汉县| 资溪县|