Compare commits

..

2 commits

Author SHA1 Message Date
Fabien Freling 4bbe47d158 scale to 2x graphics 2025-03-11 13:41:30 +01:00
Fabien Freling 2d9c206552 setup luacats 2025-03-11 13:34:10 +01:00
11 changed files with 60 additions and 5 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
src/img/*.png
.luarc.json

View file

@ -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"
}

View file

@ -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
];
};

View file

@ -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

View file

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -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

8
tools/gen-luarc.nu Executable file
View file

@ -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)
}

19
tools/luarc_sample.json Executable file
View file

@ -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": []
}