adding texture rendering to example

This commit is contained in:
Noel Berry 2020-12-29 17:38:21 -08:00 committed by GitHub
parent 5503198eff
commit deafcb4f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,12 @@ this will likely see breaking changes.
using namespace Blah; using namespace Blah;
Batch batch; Batch batch;
TextureRef tex;
void startup()
{
tex = Texture::create("player.png");
}
void render() void render()
{ {
@ -37,6 +43,7 @@ void render()
batch.push_matrix(transform); batch.push_matrix(transform);
batch.rect(Rect(-32, -32, 64, 64), Color::red); batch.rect(Rect(-32, -32, 64, 64), Color::red);
batch.tex(tex, Vec2(64, 0), Color::white);
batch.pop_matrix(); batch.pop_matrix();
batch.render(); batch.render();
@ -49,6 +56,7 @@ int main()
config.name = "blah app"; config.name = "blah app";
config.width = 1280; config.width = 1280;
config.height = 720; config.height = 720;
config.on_startup = startup;
config.on_render = render; config.on_render = render;
App::run(&config); App::run(&config);