slint/examples/slide_puzzle
Olivier Goffart 0359071b1e
Winit initial size adjustments and wasm size fixes
Following the winit 0.29 merge, a few adjustments are in order:

 - Make slint::Window.set_size() before show keep the size
 - on wasm, attempt to keep the size of the canvas from CSS
 - on wasm, one must set the width and height explicitly on the canvas
   otherwise there is wierd scaling
 - on wasm, we can't set None as maximum or minimum size otherwise winit
   panics
 - It seems that the hack we had to keep the size in range is no longer
   necessary
 - The hack in the slide puzzle can be removed. (but unfortunately it
   doesn't follow resizes

Unfortunatelly we always call set_inner_size to avoid infinite loop when
the css properties are not specificed, so this will override layouts

Also we don't default anymore to the preferred size

* Update internal/backends/winit/winitwindowadapter.rs
2023-10-24 15:28:18 +02:00
..
plaster-font Document some licenses in a REUSE compliant way 2022-01-19 11:25:21 +01:00
berlin.jpg Slide Puzzle: add an image 2020-11-13 14:13:51 +01:00
berlin.jpg.license Document some licenses in a REUSE compliant way 2022-01-19 11:25:21 +01:00
build.rs Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Cargo.toml Bump version number to 1.3.0 2023-09-05 15:46:36 +02:00
index.html Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
main.rs Winit initial size adjustments and wasm size fixes 2023-10-24 15:28:18 +02:00
README.md xtask: Fix up license headers 2023-08-17 08:55:28 +02:00
slide_puzzle.slint Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00

Slide Puzzle

Example based on the flutter slide_puzzle example: https://flutter.github.io/samples/slide_puzzle

This will allow to compare Slint and Flutter.

Remaining feature to implement to have parity:

  • "Spring" animation instead of a bezier curve.
  • Hover/Pressed effect on the auto-play checkbox.
  • When clicking on the auto-play checkbox, the gray hover circle bounces in the direction of the mouse cursor
  • The different styles are well separated in different files.
  • Shadow on the tiles
  • Some layout adjustment
  • startup animation

Comparison

Comparison with the flutter demo (as of commit ecd7f7d of this repository, and commit a23d035 of the flutter repository)

. Slint Flutter
UI files slide_puzzle.slint src/puzzle_controls.dart src/puzzle_flow_delegate.dart src/puzzle_home_state.dart src/shared_theme.dart src/theme_plaster.dart src/themes.dart src/theme_seattle.dart src/theme_simple.dart src/widgets/decoration_image_plus.dart src/widgets/material_interior_alt.dart
Line of codes for the UI 444 1140
Lines of code for the UI without empty lines and comments 386 831
Logic files main.rs main.dart src/flutter.dart src/app_state.dart src/core/body.dart src/core/point_int.dart src/core/puzzle_animator.dart src/core/puzzle.dart src/core/puzzle_proxy.dart src/core/puzzle_simple.dart src/core/puzzle_smart.dart src/core/util.dart
Lines of code of logic 238 962
Lines of code of logic without empty lines and comments 197 702
RAM use TBD TBD
binary size TBD TBD