I’m porting a game from JS/HTML5 canvas to Haxe to be able to add Android and iOS targets. My game only has sprites and text, and I draw them in a main loop, unlike OpenFL’s concept of Sprite that persists through multiple frames.
Lime has everything I’d ever want, except a unified render method. OpenFL has this, but there doesn’t really seem to be a way to do the following psuedocode.
onRender(ctx) {
ctx.save()
ctx.transform(x, y)
ctx.draw(image, 0, 0, sizeX, sizeY)
ctx.restore()
}
However, I’ve gotten pretty close, but it feels like an unusual way of doing it.
private function onEnterFrame(event: Event) {
graphics.clear();
var m = new Matrix();
m.translate(-Math.random() * 100, -Math.random() * 100);
graphics.beginBitmapFill(tileset, m, true, false);
graphics.drawRect(0, 0, 100, 100);
graphics.endFill();
}
Is there a proper way to render my preferred method of “immediate mode sprites” rather than persisting sprites with OpenFL? Is there a library built on lime that basically just adds a unified rendering API, avoiding manual OpenGL/WebGL code? Thanks!