gsa/examples/basic.rs

24 lines
548 B
Rust
Raw Normal View History

use glam::IVec2;
use gsa::{run, Gsa};
struct Game {}
fn init(gsa: &mut Gsa) -> Game {
gsa.sprites[0].tile = 0x0300;
gsa.sprites[1].tile = 0x0200;
gsa.maps[0].tiles[0][0] = 0x0300;
gsa.maps[1].half_tile = true;
gsa.write_string(1, IVec2::ONE, "Hello world nyaa~");
Game {}
}
fn update(_game: &mut Game, gsa: &mut Gsa) {
gsa.sprites[0].pos.x = (gsa.sprites[0].pos.x + 1) % 300;
gsa.sprites[1].pos += gsa.input.dir;
if gsa.input.pressed.face_down {
gsa.sprites[1].tile += 1;
}
}
run!(init, update);