Blog: Learn SixtyFPS - Memory Game Tutorial #132
Replies: 3 comments 3 replies
-
I really enjoyed the Rust post that you two published! I didn't deviate much from your example except reduce the amount of magic numbers used. For example, in the MainWindow := Window {
property <int> row_count: 4;
property <int> column_count: 4;
property <length> tile_size: 80px;
property <length> tile_spacing: 5px;
// Before: `width: 4 * tile_size + 5 * tile_spacing;`.
width: (column_count * tile_size) + (tile_spacing * (column_count + 1));
height: (row_count * tile_size) + (tile_spacing * (row_count + 1));
// ...
} For the right curtain, I utilized the rectangle's // Right curtain.
right_curtain := Rectangle {
border-radius: 4px;
// Before: `width: open_curtain ? 0px : parent.width / 2 + 4px;`.
width: open_curtain ? 0px : ((parent.width / 2) + border-radius);
x: open_curtain ? parent.width : ((parent.width / 2) - border-radius);
// ...
} I want to use this toolkit to develop an application for the Librem 5 (https://puri.sm/products/librem-5/) and hope that fluid layouts for mobile-sized screens will be a feature I can use. I'm excited to see this project grow and hope to see more posts and updates from you! As far as I know, your project is the only one written in Rust to support a templating(?) language to separate design from the application logic. There is Qt and GTK but they aren't written in Rust and have some baggage when trying to using them in Rust that makes them not ergonomic in my eyes. Druid and iced seem promising but as mentioned before, I like separating my design code from the logic. |
Beta Was this translation helpful? Give feedback.
-
Thank you for reading and going through the tutorial - glad you enjoyed it! Your idea of introducing Regarding layouts, do you have an idea how you would like to express the different screen sizes? |
Beta Was this translation helpful? Give feedback.
-
I know that I am probably in the minority, but, as someone who would prefer to not have to jump between a DSL and Rust, I am wondering whether it is possible to author the ui totally in Rust and not use .60? I really enjoy Rust, and find the experiencing of bouncing back and forth between two languages distracting. This seems like a perfectly decent example of the approach mind you. Just not my cup of tea. (Feel the same way about QML). |
Beta Was this translation helpful? Give feedback.
-
This is the discussion thread for the second blog post Learn SixtyFPS: Memory Game Tutorial in Rust and C++.
Beta Was this translation helpful? Give feedback.
All reactions