Skip to content

Commit

Permalink
SpriteHandler_examples.h:
Browse files Browse the repository at this point in the history
* In example 2, we now rotate the vector sprite. Looks pretty cool!
  • Loading branch information
razterizer committed Oct 24, 2024
1 parent d705169 commit 2caadf2
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions Examples/SpriteHandler_examples.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,25 @@ namespace sprite_handler
begin_screen();

int anim_frame = 0;
return_cursor();
sh.clear();
sprh.draw(sh, anim_frame);
sh.print_screen_buffer(Color::Black);
Delay::sleep(0'200'000);

kpd = keyboard->readKey();
auto key = keyboard::get_char_key(kpd);
auto lo_key = str::to_lower(key);
if (lo_key == 'q')
goto quit;
for (int i = 0; i < 100; ++i)
{
float t = i / 99.f;
float ang = t*360.f;

sprite0->set_rotation(ang);

return_cursor();
sh.clear();
sprh.draw(sh, anim_frame);
sh.print_screen_buffer(Color::Black);
Delay::sleep(0'20'000);

kpd = keyboard->readKey();
auto key = keyboard::get_char_key(kpd);
auto lo_key = str::to_lower(key);
if (lo_key == 'q')
goto quit;
}

quit:
end_screen(sh);
Expand Down

0 comments on commit 2caadf2

Please sign in to comment.