kernels,demo,donut: only clear screen before drawing

* Originally, if it need too much computation in a slow platform,
  clearing screen before computation will only show the donut during a
  short time.
This commit is contained in:
Zihao Yu 2024-02-20 14:53:20 +08:00
parent dbe346eb85
commit bb725d6f82

View file

@ -31,8 +31,6 @@ void donut(void) {
int sA = 1024, cA = 0, sB = 1024, cB = 0, _; int sA = 1024, cA = 0, sB = 1024, cB = 0, _;
while(1) { while(1) {
screen_clear();
memset(b, 32, 1760); // text buffer memset(b, 32, 1760); // text buffer
memset(z, 127, 1760); // z buffer memset(z, 127, 1760); // z buffer
int sj = 0, cj = 1024; int sj = 0, cj = 1024;
@ -63,6 +61,10 @@ void donut(void) {
} }
R(9, 7, cj, sj) // rotate j R(9, 7, cj, sj) // rotate j
} }
R(5, 7, cA, sA);
R(5, 8, cB, sB);
screen_clear();
int y = 0, x = 0; int y = 0, x = 0;
for (int k = 0; 1761 > k; k++) { for (int k = 0; 1761 > k; k++) {
if (k % 80) { if (k % 80) {
@ -73,8 +75,6 @@ void donut(void) {
x = 1; x = 1;
} }
} }
R(5, 7, cA, sA);
R(5, 8, cB, sB);
screen_refresh(); screen_refresh();
usleep(100000); usleep(100000);