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

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
主站蜘蛛池模板: 江阴市| 正安县| 湘潭市| 襄汾县| 紫云| 锦屏县| 泰安市| 苗栗市| 石渠县| 娄烦县| 唐河县| 张家口市| 和田市| 沁水县| 东兴市| 南开区| 河池市| 古蔺县| 拉孜县| 仁化县| 天津市| 东乌| 盐城市| 神农架林区| 新密市| 大悟县| 灌阳县| 鄢陵县| 盖州市| 通化市| 满城县| 固原市| 通州区| 阳朔县| 盐山县| 秀山| 贵阳市| 南岸区| 海宁市| 哈巴河县| 安宁市|