X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fbakapi.c;h=a74e7711dc3b7afd02629d749879cabc7d35c110;hb=888e2c276b5ee54772919b0590c3865bedc42dc9;hp=c6ae3ce3b9c93cf196c4ffe90a0bf1f02224ff56;hpb=6138b5229f42eec19c45fc802f22b7fd288dc9e7;p=16.git diff --git a/src/bakapi.c b/src/bakapi.c index c6ae3ce3..a74e7711 100755 --- a/src/bakapi.c +++ b/src/bakapi.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -36,6 +36,8 @@ main(int argc, char *argvar[]) { char *a; int i; + word panq=1, pand=0; + boolean panswitch=0; // allow changing default mode from command line for (i=1;i < argc;) { @@ -88,8 +90,8 @@ main(int argc, char *argvar[]) // main variables values d=4; // switch variable key=2; // default screensaver number - xpos=TILEWH*2; - ypos=TILEWH*2; + xpos=TILEWHD; + ypos=TILEWHD; xdir=1; ydir=1; @@ -109,8 +111,6 @@ main(int argc, char *argvar[]) /* setup camera and screen~ */ gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); - gvar.video.page[0].width += (TILEWH*2); - gvar.video.page[0].height += (TILEWH*2); textInit(); //modexPalUpdate(bmp.palette); //____ @@ -123,26 +123,95 @@ main(int argc, char *argvar[]) #ifdef BOINK while(d>0) // on! { + int c; /* run screensaver routine until keyboard input */ while (key > 0) { if (kbhit()) { - getch(); // eat keyboard input - break; + if(!panswitch) + { + getch(); // eat keyboard input + break; + }else c=getch(); } - ding(&gvar.video.page[0], &bakapee, key); + if(!panswitch) ding(&gvar.video.page[0], &bakapee, key); + else ding(&gvar.video.page[0], &bakapee, 2); + if(panswitch!=0) + { + //right movement + if((c==0x4d && pand == 0) || pand == 2) + { + if(pand == 0){ pand = 2; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dx++; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + //left movement + if((c==0x4b && pand == 0) || pand == 4) + { + if(pand == 0){ pand = 4; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dx--; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + //down movement + if((c==0x50 && pand == 0) || pand == 3) + { + if(pand == 0){ pand = 3; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dy++; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + //up movement + if((c==0x48 && pand == 0) || pand == 1) + { + if(pand == 0){ pand = 1; } + if(panq<=(TILEWH/(4))) + { + gvar.video.page[0].dy--; + modexShowPage(&gvar.video.page[0]); + panq++; + } else { panq = 1; pand = 0; } + } + if(c==0x71 || c==0xb1 || c=='p') + { + //getch(); // eat keyboard input + panswitch=0; + break; // 'q' or 'ESC' or 'p' + } + } } { - int c; // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in. // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C. VGAmodeX(0, 0, &gvar); // user imput switch //fprintf(stderr, "xx=%d yy=%d tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile); + //fprintf(stderr, "dx=%d dy=%d ", gvar.video.page[0].dx, gvar.video.page[0].dy); printf("Tiled mode is "); switch (bakapee.tile) + { + case 0: + printf("off. "); + break; + case 1: + printf("on. "); + break; + } + //printf("\n"); + printf("Pan mode is "); + switch (panswitch) { case 0: printf("off.\n"); @@ -152,13 +221,25 @@ main(int argc, char *argvar[]) break; } printf("Enter 1, 2, 3, 4, 5, 6, 8, or 9 to run a screensaver, or enter 0 to quit.\n"); - +pee: c = getch(); switch (c) { case 27: /* Escape key */ case '0': d=0; break; + case 'p': // test pan + switch (panswitch) + { + case 0: + panswitch=1; + break; + case 1: + panswitch=0; + break; + } + goto pee; + break; case 'b': // test tile change switch (bakapee.tile) { @@ -181,10 +262,8 @@ main(int argc, char *argvar[]) case '6': case '9': key = c - '0'; - gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); - gvar.video.page[0].width += (TILEWH*2); - gvar.video.page[0].height += (TILEWH*2); VGAmodeX(vgamodex_mode, 0, &gvar); + gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in. // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C. modexShowPage(&gvar.video.page[0]); @@ -200,78 +279,35 @@ main(int argc, char *argvar[]) // TODO: This is a testing sextion for textrendering and panning for project 16 --sparky4 while(1) { // conditions of screen saver - while(!kbhit()) - { - ding(&gvar.video.page[0], &bakapee, key); - } +// while(!kbhit()) +// { +// ding(&gvar.video.page[0], &bakapee, key); +// } //end of screen savers - /*for(int x = 0; x < gvar.video.page[0].width; ++x) - { - modexputPixel(&page, x, 0, 15); - mxPutPixel(x, gvar.video.page[0].height-1, 15); - } - for (int y = 0; y < VH; ++y) - { - mxPutPixel(0, y, 15); - mxPutPixel(gvar.video.page[0].width-1, y, 15); - } - for (int x = 0; x < VW; ++x) - { - mxPutPixel(x, 0, 15); - mxPutPixel(x, VH-1, 15); - } - for (int y = 240; y < VH; ++y) - { - mxPutPixel(0, y, 15); - mxPutPixel(VW-1, y, 15); - }*/ - pdump(&gvar.video.page[0]); - getch(); - //text box - /*++++mxBitBlt(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, BS); //copy background - mxFillBox(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, OP_SET); // background for text box - //+(QUADWH*6) - mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================"); - mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "| |Chikyuu:$line1"); - mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "| |$line2"); - mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "| |$line3"); - mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "| |$line4"); - mxOutText(xpos+1, ypos+gvar.video.page[0].height-8, "========================================"); - mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~ - getch(); - mxBitBlt(0, BS, gvar.video.page[0].width, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background - getch();++++*/ - while(!kbhit()) - { - //for(int i=0;i(VW-gvar.video.page[0].width-1)) || (xpos<1))delay(500); - //mxWaitRetrace(); -//mxBitBlt(32, (gvar.video.page[0].height+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos); -//++++mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2); -//xpos=ypos=TILEWH*2; - //????modexPanPage(&gvar.video.page[0], 32, 32); - //} - if( (xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;} - if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change - //}// direction! -//mxBitBlt(32, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos); -//mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2); - } - ch=getch(); + //pdump(&gvar.video.page[0]); + +// mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================"); +// mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "| |Chikyuu:$line1"); +// mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "| |$line2"); +// mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "| |$line3"); +// mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "| |$line4"); +// mxOutText(xpos+1, ypos+gvar.video.page[0].height-8, "========================================"); + + ding(&gvar.video.page[0], &bakapee, key); + modexPanPage(&gvar.video.page[0], xpos, ypos); + c = getch(); + +// xpos+=xdir; +// ypos+=ydir; +// if( (xpos>(gvar.video.page[0].sw-gvar.video.page[0].width-1)) || (xpos<1)){xdir=-xdir;} +// if( (ypos>(gvar.video.page[0].sh-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} +// ch=getch(); if(ch==0x71)break; // 'q' if(ch==0x1b)break; // 'ESC' } -// VGAmodeX(0, &gvar); + VGAmodeX(0, 1, &gvar); #endif // defined(BOINK) +// printf("page.width=%u ", gvar.video.page[0].width); printf("page.height=%u\n", gvar.video.page[0].height); printf("bakapi ver. 1.04.16.04\nis made by sparky4i†ƒÖ…j feel free to use it ^^\nLicence: GPL v3\n"); printf("compiled on 2016/04/04\n"); }