diff --git a/.gitignore b/.gitignore index ac7cff2..eeb6598 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ src/img/*.png +.luarc.json diff --git a/flake.lock b/flake.lock index 3af5933..d24df7d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "luacats": { + "flake": false, + "locked": { + "lastModified": 1740447442, + "narHash": "sha256-naorkTPkgJiEevBfpdRQtbCikN5YGiqWeIAWzCsEW4Q=", + "owner": "notpeter", + "repo": "playdate-luacats", + "rev": "7e56adacbbaceef923f24d898706aa3dec2225c1", + "type": "github" + }, + "original": { + "owner": "notpeter", + "repo": "playdate-luacats", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1740367490, @@ -38,6 +54,7 @@ }, "root": { "inputs": { + "luacats": "luacats", "nixpkgs": "nixpkgs", "playdate-sdk": "playdate-sdk" } diff --git a/flake.nix b/flake.nix index e3cc328..263a0d0 100644 --- a/flake.nix +++ b/flake.nix @@ -7,9 +7,13 @@ url = "github:RegularTetragon/playdate-sdk-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; + luacats = { + url = "github:notpeter/playdate-luacats"; + flake = false; + }; }; - outputs = { self, nixpkgs, playdate-sdk }: + outputs = { self, nixpkgs, playdate-sdk, luacats }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; playdate-sdk-pkg = playdate-sdk.packages.${system}.default; @@ -18,12 +22,14 @@ mkShell { env = { PLAYDATE_SDK_PATH = playdate-sdk-pkg; + LUACATS_PATH = luacats.outPath; }; nativeBuildInputs = [ just lua-language-server playdate-sdk-pkg + nushell tup ]; }; diff --git a/justfile b/justfile index f71d7ed..cde05dd 100644 --- a/justfile +++ b/justfile @@ -10,4 +10,7 @@ simu: build cook-assets: @(which aseprite > /dev/null) || (echo "Missing aseprite program"; exit 1) - tup + -tup + +setup: + tools/gen-luarc.nu diff --git a/src/img/Tupfile b/src/img/Tupfile index 04c14dc..766965e 100644 --- a/src/img/Tupfile +++ b/src/img/Tupfile @@ -1,2 +1,2 @@ -: level_01.ase |> aseprite --batch --export-tileset %f --sheet %o |> %B-table-32-32.png +: level_01.ase |> aseprite --batch --export-tileset %f --sheet %o |> %B-table-16-16.png : player.ase |> aseprite --batch %f --save-as %o |> %B.png diff --git a/src/img/level_01.ase b/src/img/level_01.ase index ca8a6dd..b62a629 100644 Binary files a/src/img/level_01.ase and b/src/img/level_01.ase differ diff --git a/src/img/player.ase b/src/img/player.ase index 6454979..b1263b8 100644 Binary files a/src/img/player.ase and b/src/img/player.ase differ diff --git a/src/img/player.png b/src/img/player.png deleted file mode 100644 index 3d5b500..0000000 Binary files a/src/img/player.png and /dev/null differ diff --git a/src/main.lua b/src/main.lua index fa5c03e..792cb77 100644 --- a/src/main.lua +++ b/src/main.lua @@ -9,11 +9,12 @@ local playerSprite = nil local atlas = nil function gameInit() + playdate.display.setScale(2) local playerImage = gfx.image.new("img/player") assert(playerImage) playerSprite = gfx.sprite.new(playerImage) - playerSprite:moveTo(200, 120) -- (200,120) is the center of the Playdate screen + playerSprite:moveTo(100, 60) -- (200,120) is the center of the Playdate screen playerSprite:add() atlas = gfx.imagetable.new("img/level_01") @@ -47,5 +48,5 @@ function playdate.update() gfx.sprite.update() playdate.timer.updateTimers() - atlas:drawImage(2, 32, 32) + atlas:drawImage(2, 16, 16) end diff --git a/tools/gen-luarc.nu b/tools/gen-luarc.nu new file mode 100755 index 0000000..d2d1b47 --- /dev/null +++ b/tools/gen-luarc.nu @@ -0,0 +1,8 @@ +#!/usr/bin/env nu + +def main [] { + const here = path self . + let sample = open ($here | path join luarc_sample.json) + mut updated = $sample | update "workspace.library" { $env.LUACATS_PATH} + $updated | save --force ($here | path join .. .luarc.json) +} diff --git a/tools/luarc_sample.json b/tools/luarc_sample.json new file mode 100755 index 0000000..0cf1799 --- /dev/null +++ b/tools/luarc_sample.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "diagnostics.globals": ["import"], + "diagnostics.severity": { + "duplicate-set-field": "Hint" + }, + "format.defaultConfig": { + "indent_style": "space", + "indent_size": "4" + }, + "runtime.builtin": { + "io": "disable", + "os": "disable", + "package": "disable" + }, + "runtime.nonstandardSymbol": ["+=", "-=", "*=", "/=", "//=", "%=", "<<=", ">>=", "&=", "|=", "^="], + "runtime.version": "Lua 5.4", + "workspace.library": [] +}