Jared DiCarlo
/
manworm_tv_gpu
asdf
Fork of manworm_ticker_tv by
Diff: main.cpp
- Revision:
- 5:2859a892497f
- Parent:
- 4:02e3ae7a3aea
- Child:
- 6:0a34891a82c7
diff -r 02e3ae7a3aea -r 2859a892497f main.cpp --- a/main.cpp Sun Nov 19 07:05:01 2017 +0000 +++ b/main.cpp Mon Nov 20 02:32:57 2017 +0000 @@ -185,6 +185,16 @@ 0,0,0,1,0,0,0, 0,0,0,1,0,0,0,}; +uint8_t sprite_man[] = { +0,0,0,1,0,0,0, +0,0,1,1,1,0,0, +0,0,0,1,0,0,1, +0,1,1,1,1,1,0, +1,0,1,1,1,0,0, +0,0,1,1,1,0,0, +0,1,0,0,0,1,0, +0,1,0,0,0,1,0}; + uint16_t l=0; //current line of scan uint8_t im_line_s[H_RES]; //image sync buffer @@ -727,7 +737,7 @@ { for(int x = SX_MIN + x0; x < SX_MIN + x0 + 7; x++) { - im_line_va[H_RES*y + x] = chr[bmi]; + if (chr[bmi]) im_line_va[H_RES*y + x] = chr[bmi]; bmi++; } } @@ -737,9 +747,9 @@ for (int y = SY_MIN; y < SY_MAX; y++) { int tunw = 30 * (y) / TUN_LEN; int yy = SY_MAX-(SY_MAX-y)*3/4; - for (int x = SX_MIN; x < SX_MIN + tunnel[y - SY_MIN]; x++) im_line_va[H_RES*yy+x] = 1; + for (int x = SX_MIN; x < SX_MIN + tunnel[y - SY_MIN]; x++) im_line_va[H_RES*yy+x] = (x&1)^(y&1); for (int x = SX_MIN + tunnel[y - SY_MIN]; x < SX_MIN + tunnel[y - SY_MIN] + tunw; x++) im_line_va[H_RES*yy+x] = 0; - for (int x = SX_MIN + tunnel[y - SY_MIN] + tunw; x < SX_MAX; x++) im_line_va[H_RES*yy+x] = 1; + for (int x = SX_MIN + tunnel[y - SY_MIN] + tunw; x < SX_MAX; x++) im_line_va[H_RES*yy+x] = (x&1)^(y&1); } } @@ -765,9 +775,9 @@ void update_tunnel() { for (int j = TUN_LEN-1; j > 0; j--) tunnel[j] = tunnel[j-1]; - int x = rand() % 8; + int x = rand() % 48; if (x == 0) tundir = -tundir; - tunnel[0] = tunnel[0]+tundir; + if (x > 24) tunnel[0] = tunnel[0]+tundir; if (tunnel[0] < 1) { tunnel[0] = 1; @@ -782,13 +792,13 @@ int cmd1 = p1_in.read(); int cmd2 = p2_in.read(); - if (cmd1) tunnp+=1; - if (cmd2) tunnp-=1; - if (tunnp<SX_MIN+1) tunnp = SX_MIN+1; - if (tunnp>SX_MAX-1) tunnp = SX_MAX-1; - im_line_va[H_RES*SY_MAX+(int)tunnp] = 1; + if (cmd1) tunnp+=1.0f; + if (cmd2) tunnp-=1.0f; + if (tunnp<SX_MIN+8) tunnp = SX_MIN+8; + if (tunnp>SX_MAX-8) tunnp = SX_MAX-8; + dispsprite((int)(tunnp-SX_MIN), 31, sprite_man); - wait(0.007); + wait(0.01); } int main() { potato: