From d9a54f1319cc9dcc2861cecc9edfde14cf039c5b Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sat, 6 Jun 2026 20:59:12 +0200 Subject: Add examples catalog with subcommand dispatch - Extract game engine from package main to engine/ library package - Create examples/ package with registry, Entry type, and BuilderDeps - Register default world as an example (moved from main()) - Add combat example: two teams of units facing each other - Rewrite main.go as thin dispatch: go run . example [name] - Update README with examples catalog one-liner --- input.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 input.go (limited to 'input.go') diff --git a/input.go b/input.go deleted file mode 100644 index 5b9be32..0000000 --- a/input.go +++ /dev/null @@ -1,36 +0,0 @@ -package main - -import ( - "age_of_empires/physics" - - "github.com/hajimehoshi/ebiten/v2" - "github.com/hajimehoshi/ebiten/v2/inpututil" -) - -type Input struct { - Cursor physics.Point - ScreenCursor physics.Point - - EscapePressed bool - PatrolPressed bool - - LeftMouseDown bool - LeftMouseUp bool - RightMouseUp bool - - SpawnPressed bool -} - -func CollectInput(camera *Camera) Input { - sx, sy := ebiten.CursorPosition() - return Input{ - Cursor: camera.ScreenToWorld(sx, sy), - ScreenCursor: physics.Point{X: sx, Y: sy}, - EscapePressed: inpututil.IsKeyJustReleased(ebiten.KeyEscape), - PatrolPressed: inpututil.IsKeyJustReleased(KeyPatrolRequest), - LeftMouseDown: inpututil.IsMouseButtonJustPressed(ebiten.MouseButtonLeft), - LeftMouseUp: inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonLeft), - RightMouseUp: inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonRight), - SpawnPressed: inpututil.IsKeyJustReleased(KeySpawnRequest), - } -} -- cgit v1.3