oden/game/main.ts

29 lines
700 B
TypeScript

import { cls, print, spr, use_texture } from "./graphics";
import { load_texture } from "./assets";
import { since_start, since_last_frame } from "./time";
let bot_sprite: number | undefined = undefined;
export function init() {
print("Hello world!");
// Start this load, but then...
load_texture("./bot.png").then((n) => {
print("Bot loaded at", since_start());
bot_sprite = n;
});
}
export function update() {}
export function draw() {
cls(0.1, 0.2, 0.3);
if (bot_sprite != undefined) {
// ...it gets resolved here?
use_texture(bot_sprite);
let y = (since_start() * 10) % 240;
spr(10, y, 32, 32, 0, 0);
}
// print("FRAME TIME:", since_last_frame());
}