Skip to content

Instantly share code, notes, and snippets.

@ali1234
Last active January 31, 2020 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ali1234/31361f8654c4f12dc9506bbfd5fa72ec to your computer and use it in GitHub Desktop.
Save ali1234/31361f8654c4f12dc9506bbfd5fa72ec to your computer and use it in GitHub Desktop.
// Tearing test
#include "32blit.hpp"
uint16_t width = 160;
uint16_t height = 120;
uint32_t prev_buttons = blit::buttons;
void init(void) {
blit::set_screen_mode(blit::lores);
}
void update(uint32_t time) {
}
void render(uint32_t time) {
static uint32_t renders = 0;
if ((blit::buttons ^ prev_buttons) & blit::button::A) {
blit::set_screen_mode(blit::lores);
width = 160;
height = 120;
}
else if ((blit::buttons ^ prev_buttons) & blit::button::B) {
blit::set_screen_mode(blit::hires);
width = 320;
height = 240;
}
prev_buttons = blit::buttons;
blit::fb.pen(blit::rgba(0, 0, 0));
blit::fb.clear();
blit::fb.pen(blit::rgba(255, 255, 255));
for (int n = 0; n < width; n += 20) {
blit::fb.rectangle(blit::rect((renders + n) % width, 0, 1, height));
}
renders++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment