test cartridge for lua and js
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"magic": "PMTU",
|
||||
"cartridge_version": 1,
|
||||
"app_id": 1,
|
||||
"title": "Color Square",
|
||||
"app_version": "0.1.0",
|
||||
"app_mode": "Game",
|
||||
"entrypoint": "0",
|
||||
"asset_table": [
|
||||
{
|
||||
"asset_id": 0,
|
||||
"asset_name": "bgm_music",
|
||||
"bank_type": "SOUNDS",
|
||||
"offset": 0,
|
||||
"size": 88200,
|
||||
"decoded_size": 88200,
|
||||
"codec": "RAW",
|
||||
"metadata": {
|
||||
"sample_rate": 44100
|
||||
}
|
||||
},
|
||||
{
|
||||
"asset_id": 1,
|
||||
"asset_name": "mouse_cursor",
|
||||
"bank_type": "TILES",
|
||||
"offset": 88200,
|
||||
"size": 2304,
|
||||
"decoded_size": 2304,
|
||||
"codec": "RAW",
|
||||
"metadata": {
|
||||
"tile_size": 16,
|
||||
"width": 16,
|
||||
"height": 16
|
||||
}
|
||||
}
|
||||
],
|
||||
"preload": [
|
||||
{ "asset_name": "bgm_music", "slot": 0 },
|
||||
{ "asset_name": "mouse_cursor", "slot": 1 }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
../../dist-staging/stable/prometeu-aarch64-apple-darwin/
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
prometeu build . --lang lua
|
||||
prometeu run cartridge
|
||||
|
||||
echo "Lua project scaffold ok. (Build step depends on Lua frontend in prometeu-compiler)"
|
||||
@@ -0,0 +1,16 @@
|
||||
local my_gfx = require("my_gfx")
|
||||
local my_input = require("my_input")
|
||||
local my_fs = require("my_fs")
|
||||
|
||||
function frame()
|
||||
my_gfx.do_init_gfx()
|
||||
my_input.do_pad()
|
||||
my_input.do_touch()
|
||||
my_fs.do_fs()
|
||||
my_gfx.print_orange()
|
||||
|
||||
do
|
||||
local x = 10
|
||||
gfx.drawText(120, 100, "1. value of " .. x, color.white)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
local M = {}
|
||||
|
||||
function M.do_fs()
|
||||
local h = fs.open("test.txt")
|
||||
if h >= 0 then
|
||||
fs.write(h, "Hello Prometeu!")
|
||||
local content = fs.read(h)
|
||||
if content and content ~= "" then
|
||||
log.writeTag(2, 101, content)
|
||||
end
|
||||
fs.close(h)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,17 @@
|
||||
local M = {}
|
||||
|
||||
function M.do_init_gfx()
|
||||
gfx.clear(color.indigo)
|
||||
gfx.fillRect(10, 10, 50, 50, color.red)
|
||||
gfx.drawLine(0, 0, 128, 128, color.white)
|
||||
gfx.drawCircle(64, 64, 20, color.blue)
|
||||
gfx.drawDisc(100, 100, 10, color.green, color.yellow)
|
||||
gfx.drawSquare(20, 100, 30, 30, color.cyan, color.color_key)
|
||||
end
|
||||
|
||||
function M.print_orange()
|
||||
local c = color.rgb(255, 128, 0)
|
||||
gfx.fillRect(0, 0, 5, 5, c)
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,21 @@
|
||||
local M = {}
|
||||
|
||||
function M.do_pad()
|
||||
if pad.up.down then
|
||||
log.write(2, "Up is down")
|
||||
end
|
||||
|
||||
if pad.a.pressed then
|
||||
audio.play("bgm_music", 0, 0, 128, 127, 1.0, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function M.do_touch()
|
||||
gfx.setSprite("mouse_cursor", 0, touch.x, touch.y, 0, 0, true, false, false, 4)
|
||||
|
||||
if touch.button.down then
|
||||
gfx.drawCircle(touch.x, touch.y, 10, color.white)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user