Commit graph

32 commits

Author SHA1 Message Date
Nurzhan Sakén 5461133a63
Replace line_drawing with clipline (#381)
* Replaced `line_drawing` with `clipline`

* Update `clipline` to 0.1.1
2023-10-30 19:36:32 -05:00
Jay Oster 3891192796
Update dependencies (#337)
Breaking changes:

- Updates `wgpu` to 0.16
2023-06-11 21:25:25 -07:00
imizao e99c5eaa24
[Optimization] Improve readability (#345) 2023-03-21 23:57:48 -07:00
Jay Oster 5a96eea6ba
Handle all wgpu::SurfaceError variants (#348)
This fixes error handling for all `wgpu::SurfaceError` variants. It also adds more context to error messages printed by the examples.

Closes #346
2023-03-21 07:16:51 -07:00
Jay Oster 899e27bafa
Remove get_ and set_ prefixes from public APIs (#341)
This renames:

- `get_frame` to `frame`
- `get_frame_mut` to `frame_mut`
- `set_clear_color` to `clear_color`

Which more closely follows convention set by the standard library et al.
2023-03-09 19:42:57 -08:00
Jay Oster 6f4fa6c967
Fix invalid texture sizes (#250)
- Makes methods fallible when they create textures.
- Correctly handle window resize in fltk example.
- TODO: tests
- Closes #240
2022-12-17 20:21:28 -08:00
Jay Oster 5c2985f1b6
Update all dependencies in the workspace (#323) 2022-12-17 17:35:02 -08:00
David Cristofaro e8d5cf3ebc
Bump wgpu from 0.13 to 0.14 (#320)
* feat(wgpu): upgrade wgpu from 13 to 14

* Address feedback

* Bump tao in `minimal-tao` example

* Bump fltk in `minimal-fltk` example

* Bump egui in `minimal-egui` example

* Bump MSRV to `1.65`

* Bump crates in `imgui-winit` example

* Delete `minimal-sdl2` example

* Fix clippy lints

* Update examples/minimal-egui/src/gui.rs

Co-authored-by: Zageron <hello@zageron.ca>
Co-authored-by: Jay Oster <jay@kodewerx.org>
2022-12-17 13:50:11 -08:00
Jay Oster a2c639823f
Update winit 0.27 (#302)
* Update winit 0.27

Closes #292

This _does not_ update `winit` in the `imgui-winit` example. See https://github.com/parasyte/pixels/pull/302#issuecomment-1264483040 for discussion.
2022-10-01 14:27:21 -07:00
Jay Oster 051a523ee6
Update wgpu to 0.13 (#300)
* Intial work towards wgpu 0.13

* Increase MSRV for egui

* Add missing texture formats

* Update fermium

- Replaces beryllium with our own hand-rolled high-level abstraction
  layer for SDL2.

* Update dependencies

Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
2022-08-17 17:30:04 -07:00
Alex 0b380b637d
Allow accessing frame on immutable buffer (#288)
* Allow accessing frame on immutable buffer

* Rename `get_frame` to `get_frame_mut`

* Use `get_frame_mut` in examples
2022-08-14 15:44:23 -07:00
Jay Oster 5c1600926e
Update dependencies (#272)
* Update dependencies

- Closes #270

* Unify controls in Invaders example

The fire button on gamepads was allowing trapid fire when holding the
button. Keyboard controls required the fire key to be released between
each shot fired. This commit fixes the difference by making the gamepad
fire button act like the keyboard fire key.
2022-04-25 05:04:51 -07:00
Jay Oster afd15436d6
Fix crash on Wayland (#251)
- Rather than setting the position and window size based on available
  screen space, this PR just creates a window with a default size and
  doesn't attempt to set the position.
- Closes #29
2022-01-08 04:57:23 -08:00
Jay Oster c1962ae35c
Update dependencies (#230)
* Move to Edition 2021
* Update `wgpu`, `raw-window-handle`, and all dependencies for the examples
* Update MSRV
* Closes #244
2021-12-31 14:57:57 -08:00
Jay Oster 0e6c5286ff
Update line_drawing (#211) 2021-10-08 13:06:48 -07:00
Jay Oster 210b373882
Add resolver = "2" to all examples (#192)
- These are ignored, but it should prevent copy-pasta errors from users
2021-09-01 21:48:51 -07:00
Jay Oster 303f1d90f5
Prepare 0.5.0 (#183)
* Prepare 0.5.0

* Update dependencies
2021-07-17 08:57:25 -07:00
Jay Oster c4df23f65d
Update to wgpu 0.9 (#179)
* Update to wgpu 0.9

* Fix validation error in WGSL shader

- This moves the hardcoded vertex positions and texture coordinates to
  the vertex buffer.
- Replaces the two-triangle quad to 1 full-screen triangle (fixes #180)
- Rewrites the custom shader example to fix a bug with large surface
  textures;
  - The input texture size was used for the output texture, causing the
    purple rectangle to appear very jumpy on large displays in full screen.
- The `ScalingRenderer` now exposes its clipping rectangle. The custom
  shader example uses this for its own clipping rectangle, but it can
  also be used for interacting with the border in general.

* Switch to `wgpu::include_wgsl!()`

- This is a nice little simplification.
- Thanks to @JMS55 for the suggestion!
2021-06-27 11:09:29 -07:00
Jay Oster b76ae1f7bc
Update winit to 0.25 (#168)
- Update winit
- Update egui_winit_platform
- Update imgui_winit_support
- Fix hyperlink and resize in `egui-winit` example
2021-05-29 02:18:48 -07:00
Jay Oster 8071f34a1f
Rename resize to resize_surface (#149)
- Also cleanup documentation.
- Workaround FLTK window resize issues by disabling resizability.
2021-03-09 04:15:24 -08:00
Jay Oster 0a893d6eff
Update all dependencies (#130) 2021-01-05 18:20:36 -08:00
Jay Oster 265ba2e5b3
Render API v2 (#112)
* WIP: Render API v2

* Fix doctests

* Expose all of PixelsContext (#110)

* Fix ScalingRenderer::new() taking &mut Device

* Replace getters with direct access to &mut PixelsContext

* Fix wrong reference type

* Fix unneeded mut

* Remove unnecessary mutable borrow, resurrect the shorter getter methods

* Initial port to wgpu master (0.6)
Surface creation is broken (see examples)
Does not support compressed textures

* Fix SurfaceTexture and examples

* Add support for compressed texture formats

* resize doesn't need mutability

* Update documentation

* Update wgpu

* Prepare release

* Goodbye Travis! Thanks for all the fish

Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com>
2020-08-20 16:49:19 -07:00
Jay Oster b5b55c43f7
Add feature flag to enable all log levels in examples (#98)
- Adds extra troubleshooting documentation to the README
2020-07-18 23:00:26 -07:00
Jay Oster b397eb4e48
Change Vsync setting to use Fifo present mode (#93)
And add a method to set `Mailbox` or other explicit modes.

Closes #88
2020-07-17 16:34:54 -07:00
Aeledfyr c96e46d3d4
Add a method to convert cursor coords to pixel coords (#77)
* Add a method to convert cursor coords to pixel coords

* Add method `window_pos_to_pixel` to Pixels struct
   * Converts cursor / window physical coordinates to pixel coords

* Fix formatting

* Return result rather than clamping pixel coordinates

* Use transformation matrices to convert from cursor coord to pixel

* Adds a struct ScalingMatrix that manages the creation and usage
  of the transformation matrix used in the renderer.
* Added an inverse function on ScalingMatrix - 4x4 matrix inverse
  (This should probably use a library, but it doesn't seem worth
  adding a dependancy for one function)

* Optimize matrix multiplication for cursor position calculation

* Use ultraviolet for matrix and vector math

* Add suggested changes

This keeps the split between usize and isize
This also changes the input cursor position to f32, because it was
immediately cast to an f32 for the transformations.
2020-05-20 21:37:29 -07:00
Jay Oster 91db963490
Fix panic in winit examples when pixels.render() returns Error (#70) 2020-04-13 20:38:51 -07:00
Jay Oster 9de2383712
Fix dependency bloat (#67)
* Move all examples to individual crates

* CI: Add libsdl2

* Use Ubuntu bionic for updated libsdl; 2.0.8

* Clippy

* libudev-dev is a dependency of libsdl2-dev

* Clippy

* Remove unnecessary dev-dependency

* `winit` is actually used in unit tests

* Fix a typo

* Move `simple-invaders` crate
2020-04-13 10:12:18 -07:00
Bernardo Meurer 246375f0e9
treewide: bump dependencies (#60) 2020-04-12 23:13:40 -07:00
Jay Oster 8061ce0ea4
Reorganize dependencies (#46)
* Reorganize dependencies

* Enable logging in the minimal-winit example

* Fix a very minor bug in the minimal-winit example
2019-11-19 19:37:36 -08:00
Jay Oster d56625577d
Update READMEs (#42) 2019-11-06 22:37:16 -08:00
Jay Oster a92adf1b12
Add explicit clippy deny all, and forbid unsafe code (where possible) (#38) 2019-11-06 21:16:25 -08:00
Thom Chiovoloni e0225c145d Add a conways game of life example (#37)
* Add a conways game of life example

* Rustfmt conway example

* Respond to review feedback (p_width/p_height)

* Use line_drawing instead of manual bresenham

* Optimize count_neibs

* Remove inline(never) leftover from when profiling

* Bring back wrapping behavior (without regressing perf)

* Fix missing bounds check
2019-11-05 23:15:58 -08:00