slint/examples
Simon Hausmann 43e7407669 Use the same default font sizes as C++
On my screen with a dpr of 2 this aligns QSkinny/Qt with GL and Qt backend
2021-06-03 16:31:57 +02:00
..
7gui Window: make hight and width fixed size, preferred-* property set the initial size 2021-05-18 10:23:06 +02:00
gallery Window: make hight and width fixed size, preferred-* property set the initial size 2021-05-18 10:23:06 +02:00
iot-dashboard Use the same default font sizes as C++ 2021-06-03 16:31:57 +02:00
memory Modernize the memory game 2021-04-27 15:13:50 +02:00
printerdemo Cleanup: Use a unique name for the C++ CMake projects 2021-05-17 10:52:01 +02:00
printerdemo_old Build the old printer C++ demo 2021-04-27 12:20:06 +02:00
qt_viewer Only compile the qt_viewer example if Qt >= 5.15 2021-05-21 07:54:31 +02:00
slide_puzzle Restore source compatibility for drop-shadow-blur 2021-05-20 12:14:05 +02:00
todo Window: make hight and width fixed size, preferred-* property set the initial size 2021-05-18 10:23:06 +02:00
README.md Few adaptations of the renamed viewer 2021-05-22 09:30:57 +02:00

Examples

These examples demonstrate the main features of SixtyFPS and how to use them in different language environments.

printerdemo

A fictional user interface for the touch screen of a printer

.60 Design Rust Source C++ Source Node Source Online wasm Preview Open in code editor
ui.60 main.rs main.cpp main.js Online simulation Preview in Online Code Editor

Screenshot of the Printer Demo

A simple application showing the different widgets

.60 Design Rust Source C++ Source Online wasm Preview Open in code editor
gallery.60 main.rs main.cpp Online simulation Preview in Online Code Editor

Screenshot of the Gallery on Windows

todo

A simple todo mvc application

.60 Design Rust Source C++ Source Node Source Online wasm Preview Open in code editor
todo.60 main.rs main.cpp main.js Online simulation Preview in Online Code Editor

Screenshot of the Todo Demo

slide_puzzle

Puzzle game based on a Flutter example. See Readme

.60 Design Rust Source C++ Source Node Source Online wasm Preview Open in code editor
slide_puzzle.60 main.rs Online simulation Preview in Online Code Editor

Screenshot of the Slide Puzzle

memory

A basic memory game used as an example for the blog post tutorial. See the blog for more info:

.60 Design Rust Source C++ Source Node Source Online wasm Preview Open in code editor
memory.60 main.rs memory.cpp Online simulation Preview in Online Code Editor

Loading the example with the viewer

Simply load the .60 file with the viewer application

cargo run --release --bin sixtyfps-viewer -- examples/printerdemo/ui/printerdemo.60

Running the Rust Examples

You can run the examples either by going into the rust sub-folder and use cargo run, for example:

cd examples/printerdemo/rust
cargo run --release

or you can run them from anywhere in the Cargo workspace by name:

cargo run --release --bin printerdemo

Wasm builds

In order to make the wasm build of the example, you first need to edit the Cargo.toml files to uncomment the line starting with #wasm# (or use the sed line bellow) You can then use wasm-pack (which you may need to obtain with cargo install wasm-pack). This will generate the wasm in the ./pkg directory, which the index.html file will open. Since wasm files cannot be served from file:// URL, you need to open a wab server to serve the content

cd examples/printerdemo/rust
sed -i "s/^#wasm# //" Cargo.toml
wasm-pack build --release --target web
python3 -m http.server

Running the C++ Examples

  • When compiling SixtyFPS from sources: If you follow the C++ build instructions, this will build the C++ examples as well by default

  • From installed binary packages: Simply run cmake in one of the example directory containing a CMakeLists.txt

mkdir build && cd build
cmake -GNinja -DCMAKE_PREFIX_PATH="<path to installed>" ..
cmake --build .

Running the Node Examples

You can run the examples by going into the node sub-folder and use npm, for example:

cd examples/printerdemo/node
npm install
npm start