Skip to content

Commit

Permalink
Slide Puzzle: add an image
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Nov 13, 2020
1 parent d499e86 commit b8d9373
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Binary file added examples/slide_puzzle/berlin.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion examples/slide_puzzle/slide_puzzle.60
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export MainWindow := Window {
},
{
name: "BERLIN",
window-backround-color: #5b84a8,
window-backround-color: #ffffff88,
game-background-color: #ffffffcc,
game-border: 0px,
game-radius: 2px,
Expand Down Expand Up @@ -141,6 +141,12 @@ export MainWindow := Window {

animate pieces_spacing { duration: 500ms; easing: ease-out; }

Image {
height: 100%; width: 100%;
// https://commons.wikimedia.org/wiki/File:Berlin_potsdamer_platz.jpg Belappetit, CC BY-SA 3.0
source: img!"berlin.jpg";
}

Rectangle {
height: 100%; width: 100%; color: current-theme.window-backround-color;
animate color { duration: 500ms; easing: ease-out; }
Expand Down Expand Up @@ -203,6 +209,15 @@ export MainWindow := Window {
animate px , py { duration: 200ms; easing: cubic-bezier(0.17,0.76,0.4,1.9); }
animate border-width, border-radius { duration: 500ms; easing: ease-out; }

if (current-theme-index == 1) : Rectangle {
width: 50%;
height: 50%;
x: (parent.width - width) / 2;
y: (parent.height - height) / 2;
border-radius: width;
color: #fff8;
}

Text {
text: i+1;
color: i >= 8 ? current-theme.piece-text-color-2 : current-theme.piece-text-color-1;
Expand Down
2 changes: 1 addition & 1 deletion sixtyfps_runtime/corelib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ x11 = ["winit/x11", "copypasta/x11"]
wayland = ["winit/wayland", "copypasta/wayland"]

[dependencies]
image = { version = "0.23.4", default-features = false, features = [ "png" ] }
image = { version = "0.23.4", default-features = false, features = [ "png", "jpeg" ] }
cgmath = "0.17.0"
const-field-offset = { version = "0.1", path = "../../helper_crates/const-field-offset" }
vtable = { version="0.1.1", path = "../../helper_crates/vtable" }
Expand Down

0 comments on commit b8d9373

Please sign in to comment.