initial commit

This commit is contained in:
harper
2026-09-22 15:40:36 -07:00
commit 480501a6b6
7 changed files with 254 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
package main
import rl "vendor:raylib"
main :: proc() {
rl.InitWindow(800, 600, "grimm sprite stacking")
rl.SetTargetFPS(60)
defer rl.CloseWindow()
sprite := rl.LoadTexture("assets/Chair_strip12.png")
defer rl.UnloadTexture(sprite)
sprite_size :: 12
stack_count :: 11
camera := rl.Camera2D{}
camera.zoom = 3
camera.offset = {400, 300}
spacing: f32 = 1
rotation: f32 = 0
for !rl.WindowShouldClose() {
if rl.IsKeyPressed(rl.KeyboardKey.SPACE) {
spacing += 0.5
}
rl.BeginDrawing()
rl.ClearBackground(rl.BLUE)
rl.BeginMode2D(camera)
for i in 0 ..< stack_count {
source := rl.Rectangle {
x = f32(i * sprite_size),
y = 0,
width = sprite_size,
height = sprite_size,
}
destination := rl.Rectangle {
x = 0,
y = -spacing * f32(i),
width = sprite_size,
height = sprite_size,
}
origin := rl.Vector2{}
origin.x = sprite_size / 2
origin.y = sprite_size / 2
rl.DrawTexturePro(sprite, source, destination, origin, rotation, rl.WHITE)
}
rl.EndMode2D()
rl.EndDrawing()
rotation += 1
}
}