dev/prometeuc-improvements (#5)
Co-authored-by: Nilton Constantino <nilton.constantino@visma.com> Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import {do_init_gfx, print_orange} from "./my_gfx";
|
||||
import {do_pad, do_touch} from "./my_input";
|
||||
import {do_fs} from "./my_fs";
|
||||
|
||||
export function tick(): void {
|
||||
do_init_gfx();
|
||||
do_pad();
|
||||
do_touch();
|
||||
do_fs();
|
||||
print_orange();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export function do_fs(): void {
|
||||
let h = fs.open("test.txt");
|
||||
if (h >= 0) {
|
||||
fs.write(h, "Hello Prometeu!");
|
||||
let content = fs.read(h);
|
||||
if (content) log.writeTag(2, 101, content);
|
||||
fs.close(h);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export function do_init_gfx(): void {
|
||||
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);
|
||||
}
|
||||
|
||||
export function print_orange(): void {
|
||||
let c = color.rgb(255, 128, 0);
|
||||
gfx.fillRect(0, 0, 5, 5, c);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
export function do_pad(): void {
|
||||
if (pad.up.down) {
|
||||
log.write(2, "Up is down");
|
||||
}
|
||||
|
||||
if (pad.a.pressed) {
|
||||
audio.playSample(1, 0, 255, 128, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
export function do_touch(): void {
|
||||
if (touch.button.down) {
|
||||
gfx.drawCircle(touch.x, touch.y, 5, color.white);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user