Commit graph

195 commits

Author SHA1 Message Date
Jay Oster 383b0d83ff
Replace vk-shader-macros with pre-compiled GLSL. Fixes #9 (#10) 2019-10-13 21:43:30 -07:00
Jay Oster 076e4e519e
Implement collision detection (#8)
* Implement collision detection

* Minor cleanups.

* Add laser/player collisions

* Add laser collision with bullets and fix fire button repeating

* Add basic shield collisions

* Refactor collision and debug

* Simplify collision and debug by not tracking laser indices

- We don't care about which laser collided, because they get destroyed immediately.

* Don't track laser indicies against bullets either

* DRY and docs

* Adjust the fleet bounding box as invaders are shot
2019-10-13 19:48:20 -07:00
Jay Oster a793787292 Update README 2019-10-13 18:35:47 -07:00
Jay Oster b6fcf803e7
Invader AI (#6)
* WIP: Invader AI

- Adds debug mode for visualizing bounding boxes
- Adds rectangle and line drawing (for debug mode)
- Invaders move as a close approximation to the original game
- TODO: Demonstrates that the blit function needs to ignore black pixels (or "transparency")
- TODO: The invader movement code is really bad

* clippy and fmt

* Refactor Invader movement

* Support "transparency" in blit function

* Scale player movement to 60 pixels per second, regardless of frame rate.

* Add assertions in blit to prevent drawing out of bounds

* Add bullets, shoot with space

* Add lasers, and improve the bullet animation a little bit

* fmt
2019-10-12 14:26:47 -07:00
Jay Oster 31bc8c7614
Refactor animations (#5)
- `SpriteRef` impls `Animation`, `Sprite` does not
- Animation duration and delta time now lives on the struct that handles the animation "state machine"
- Tweak the player animation to 100ms frame duration (was 50ms)
2019-10-08 19:54:57 -07:00
Jay Oster d0a16f9a71
Add player controls and shields (#4) 2019-10-08 00:35:53 -07:00
Jay Oster d7fc1eca3c
Refactor SpriteCache and animation (#3)
* Refactor SpriteCache and animations

- Animation frames are now enumerated
- Renamed the `Sprites` trait into the more apt `Drawable`
- Moved animation to a default impl on `Drawable`
- Added the Cthulhu invader
- Clarify that `World::step_invaders()` is only needed for handling the invader grid
- Renamed `Cannon` to `Bullet`

* Improve readability of some `SpriteCache` uses.
2019-10-07 20:22:34 -07:00
Jay Oster e4249ed766 Update README 2019-10-07 01:17:36 -07:00
Jay Oster 2767d47d67 Fix for MSRV 2019-10-07 01:11:20 -07:00
Jay Oster 348533ee9a Add delta time steps and a placeholder for control inputs 2019-10-07 01:00:33 -07:00
Jay Oster 960bfb9b3f clippy 2019-10-07 00:31:49 -07:00
Jay Oster d815bb464b Refactor simple-invaders 2019-10-06 13:53:08 -07:00
Jay Oster 1e5621c820 Refactor the stepper 2019-10-06 03:31:16 -07:00
Jay Oster 63369b8fe0 Fix CI
- `--workspace` is a nightly-only arg
2019-10-06 02:41:41 -07:00
Jay Oster aa9fdf56bf Enable clippy and tests on the entire workspace 2019-10-06 02:31:29 -07:00
Jay Oster 3b7638a012 Initial simple-invaders WIP
- Currently animates two flavors of invader in their usual formation
- Lots left to do, but this is a good start
2019-10-06 02:24:07 -07:00
Jay Oster 2847a8bd39 Update docs 2019-10-04 22:48:29 -07:00
Jay Oster b7d1623e67 Include missing module 2019-10-04 22:45:30 -07:00
Jay Oster 4d2d313faa Implement Renderer::factory() as a client would
- I had to move the texture state back to `Pixels` for now ... not satusfied with this yet
2019-10-04 22:43:45 -07:00
Jay Oster 8dc33fcf4e
Enable clippy in CI (#2)
* Enable clippy in CI

- Removed beta and nightly channels to prevent build breakage
- Fixed some lints noted by `pedantic` and `nursery` level (but not denying these levels by default)
2019-10-04 21:35:00 -07:00
Jay Oster 889d1ae44a clippy 2019-10-04 21:08:24 -07:00
Jay Oster c994b35a5c Settle on an interface for PixelsBuilder::add_render_pass()
- Accepts a closure (factory function) which itself accepts references to the `wgpu` instances needed for rendering
- This solves a need for creating `RenderPass` objects with a lot of `Option` types and trying to update them dynamically after the fact
- In other words, this is an RAII implementation
- `RenderPass` objects are created during the `PixelsBuilder` build stage
- It should prevent patterns where half-created `RenderPass` objects are necessary
2019-10-04 20:52:32 -07:00
Jay Oster 26860496a8 Consolidate Renderer state and support multiple render passes 2019-10-04 00:59:40 -07:00
Jay Oster ac400f6122 Remove redundant fields 2019-10-03 23:28:13 -07:00
Jay Oster 64cd487c37 Merge Pixels::update() with Pixels::render()
- Adds `PixelsBuilder::texture_format()` to configure the format for the pixel buffer
2019-10-03 23:16:23 -07:00
Jay Oster 7a858089bf
First pass at CI support (#1)
* First pass at CI support

* Fix MSRV (required by wgpu)

* Winit requires MSRV 1.36.0 on Linux, add rustfmt to CI, add CI badge to README

* Don't forget to install rustfmt
2019-10-03 22:59:54 -07:00
Jay Oster 300b51a342 Update README 2019-10-02 21:11:33 -07:00
Jay Oster d0391be62a Initial pass with texture rendering
- The example app generates a scaled version of pixel Ferris as a test.
- TODO:
  - Pixel aspect ratio is still unsupported
  - The `RenderPass` trait is incomplete
2019-10-02 20:22:20 -07:00
Jay Oster 38ce5c186d Rewrite all doc comments to wrap at 100 characters (was 80) 2019-10-02 01:07:11 -07:00
Jay Oster 70306c5cfd Add RenderPass trait and refactor PixelsBuilder 2019-10-02 00:53:41 -07:00
Jay Oster 2ec43fccd1 Cleanly separate the two texture dimensions
- The pixel buffer dimensions
- The surface texture dimensions
2019-10-01 22:00:37 -07:00
Jay Oster 44f5b67c9e Remove shaders from PixelsOptions
- This is the first step toward refactoring the rendering pipeline
- These will be replaced by optional render passes
2019-10-01 18:36:40 -07:00
Jay Oster 5519aafd18 Use RedrawRequested
- THis will likely change after https://github.com/rust-windowing/winit/issues/1082 lands
2019-09-29 18:42:31 -07:00
Jay Oster 2ec303812f Remove deprecated error variants 2019-09-29 17:42:40 -07:00
Jay Oster 337241c866 Switch to vk_shader_macros 2019-09-29 17:40:05 -07:00
Jay Oster 9f1afdd3b3 Update README 2019-09-29 15:11:59 -07:00
Jay Oster 17bb0cbf32 Update logo 2019-09-29 15:08:39 -07:00
Jay Oster 785ac0a5b1 Update README 2019-09-29 14:31:31 -07:00
Jay Oster 9c12f77788 Update README 2019-09-29 14:28:02 -07:00
Jay Oster 16cb9fd1a2 Transparent background 2019-09-29 14:27:45 -07:00
Jay Oster a5f091933d Better logo 2019-09-29 14:26:44 -07:00
Jay Oster 8c7c67ef69 Add README 2019-09-28 04:09:06 -07:00
Jay Oster c4d762d5f5 Rename the Error type and add docs for the variants. 2019-09-25 23:47:04 -07:00
Jay Oster f0d7c84a3f Minor code hygiene. 2019-09-25 23:11:36 -07:00
Jay Oster cc4976079b Initial commit.
- Just a copy of the wgpu `hello-triangle` example for now... more to come!
2019-09-25 23:07:30 -07:00