Skip to content

Commit

Permalink
Preparation for publication
Browse files Browse the repository at this point in the history
- Included license in Cargo.toml
- Created README
  • Loading branch information
Tastaturtaste committed Jun 25, 2023
1 parent 4aa1f14 commit e63bbf2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Tastaturtaste <[email protected]>"]
edition = "2021"
build = "build.rs"
license = "Apache-2.0" # Has to be compatible with slint's GPLv3

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
64 changes: 29 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
# Slint Rust Template

A template for a Rust application that's using [Slint](https://slint-ui.com) for the user interface.
# Lights Out Game and Solver

An implementation of the [Lights Out](https://en.wikipedia.org/wiki/Lights_Out_(game)) game and solver.

## Game Rules
The Game consists of a square grid of lights. Each light can be pressed. Doing so toggles it and the 4 adjacent lights individually. The goal is to switch on all lights.

## Controls
Besides clicking on the lights there are four controls on the right of the screen.
1. ### Reset
Resets all lights and switches to their off position.
2. ### Field size entry
Allows specifying the size of the game.
3. ### Solve
Shows the lights to press to activate all lights.
4. ### Toggle click action
### Switch activations on click:
Toggles the clicked light and the ones surrounding it according to the games rules.
### Switch lights on click:
Toggles the individual clicked light without the surrounding ones. This mode allows recreating game states to play or solve them.

## Build from source
The game is written entirely in [Rust](https://www.rust-lang.org/), which makes it :rocket:blazingly fast:rocket:. Building it is incredibly easy if Rust is already available:
1. Open terminal in the root of the project directory
2. Run `cargo build --release`
3. The executable can be found at `./target/release/lights-out.<exectuable file extention>`

If Rust is not available it can be installed with very little effort by [following the official instruction here](https://www.rust-lang.org/tools/install).

## About

This template helps you get started developing a Rust application with Slint as toolkit
for the user interface. It demonstrates the integration between the `.slint` UI markup and
Rust code, how to trigger react to callbacks, get and set properties and use basic widgets.

## Usage

1. Install Rust by following the [Rust Getting Started Guide](https://www.rust-lang.org/learn/get-started).
Once this is done, you should have the ```rustc``` compiler and the ```cargo``` build system installed in your path.
2. Install [`cargo-generate`](https://github.com/cargo-generate/cargo-generate)
```
cargo install cargo-generate
```
3. Set up a sample project with this template
```
cargo generate --git https://github.com/slint-ui/slint-rust-template --name my-project
cd my-project
```
3. Build with cargo
```
cargo build
```
4. Run the application binary
```
cargo run
```
We recommend using an IDE for development, along with our [LSP-based IDE integration for `.slint` files](https://github.com/slint-ui/slint/blob/master/tools/lsp/README.md). You can also load this project directly in [Visual Studio Code](https://code.visualstudio.com) and install our [Slint extension](https://marketplace.visualstudio.com/items?itemName=Slint.slint).
## Next Steps
We hope that this template helps you get started and you enjoy exploring making user interfaces with Slint. To learn more
about the Slint APIs and the `.slint` markup language check out our [online documentation](https://slint-ui.com/docs/rust/slint/).
This project was created to solve puzzles in the game [Heroes of Hammerwatch](https://store.steampowered.com/app/677120/Heroes_of_Hammerwatch/) and gain experience with [Slint](https://slint.dev/) UI development.

0 comments on commit e63bbf2

Please sign in to comment.