Chapter 8: Adding a UI
It may appear that we've developed everything we need for a video game, and to some extent, we have, except for that annoyance where we need to hit refresh every time little Red Hat Boy (RHB) hits a rock. A real game has buttons for a "new game" or "high scores", and in this chapter, we'll be adding that UI. To do so may seem trivial, but event-driven UIs that you might be familiar with from web development are an odd fit with our game loop. To add a simple button, we'll need to make significant changes to our application and even write a little HTML.
In this chapter, you'll do the following:
- Design a new game button
- Show the button on game over
- Start a new game
At the end of the chapter, you'll have the framework in ...
Get Game Development with Rust and WebAssembly now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.