updating `PresentMode` details and adding warning to pong

0.13
Ben Hansen 2 years ago
parent a2a1d69133
commit 3e7d0a5bea

@ -158,7 +158,19 @@ The `format` defines how `SurfaceTexture`s will be stored on the gpu. Different
Make sure that the width and height of the `SurfaceTexture` are not 0, as that can cause your app to crash.
</div>
`present_mode` uses `wgpu::PresentMode` enum which determines how to sync the surface with the display. The option we picked, `FIFO`, will cap the display rate at the display's framerate. This is essentially VSync. This is also the most optimal mode on mobile. There are other options and you can see all of them [in the docs](https://docs.rs/wgpu/latest/wgpu/enum.PresentMode.html)
`present_mode` uses `wgpu::PresentMode` enum which determines how to sync the surface with the display. The option we picked, `PresentMode::Fifo`, will cap the display rate at the display's framerate. This is essentially VSync. This mode is guaranteed to be supported on all platforms. There are other options and you can see all of them [in the docs](https://docs.rs/wgpu/latest/wgpu/enum.PresentMode.html)
<div class="note">
If you want to let your users pick what `PresentMode` they use, you can use [Surface::get_supported_modes()](https://docs.rs/wgpu/latest/wgpu/struct.Surface.html#method.get_supported_modes) to get a list of all the `PresentMode`s the surface supports:
```rust
let modes = surface.get_supported_modes(&adapter);
```
Regardless, `PresentMode::Fifo` will always be supported, and `PresentMode::AutoVsync` and `PresentMode::AutoNoVsync` have fallback support and therefore will work on all platforms.
</div>
Now that we've configured our surface properly we can add these new fields at the end of the method.

@ -2,6 +2,12 @@
![](./pong.png)
<div class="warn">
This code hasn't been updated to 0.13 quite yet as wgpu_glyph [hasn't updated to 0.13 yet](https://github.com/hecrj/wgpu_glyph/pull/89). I'll update it when it has.
</div>
Practically the "Hello World!" of games. Pong has been remade thousands of times. I know Pong. You know Pong. We all know Pong. That being said, this time I wanted to put in a little more effort than most people do. This showcase has a basic menu system, sounds, and different game states.
The architecture is not the best as I prescribed to the "get things done" mentality. If I were to redo this project, I'd change a lot of things. Regardless, let's get into the postmortem.

Loading…
Cancel
Save