Skip to content
Saule
Docs

Graphics Window

Opens a window and draws a rectangle that follows the mouse, using the Love2D-style Shine2D native package. Shows how Saule calls into a dynamically-loaded Rust library.

Browse this example on GitHub

Terminal window
git clone https://github.com/lauriszz123/saule.git
cd saule/examples/toying
saule run
name: "toying"
version: "0.1.0"
entry: "src/main.sau"
src_dirs: ["src"]
dependencies: ["lauriszz123@saule-shine:main"]
min_saule_version: "26.1"
src/main.sau
from "shine" import *
class Main
static fn main()
Window.create(800, 600, "Sau Engine")
while Window.isOpen() do
Window.pollEvents()
Graphics.clear(0.0, 0.0, 0.0)
local x, y = Mouse.getPos()
Graphics.rectangle("fill", x, y, 50.0, 50.0)
Graphics.present()
end
end
end