oden/game/main.ts
2023-07-02 10:55:03 -07:00

27 lines
660 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);
spr(10, 10, 32, 32, 0, 0);
}
// print("FRAME TIME:", since_last_frame());
}