X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=16%2Fdos_gfx.cpp;h=cbfa2d61702ef04eaa5aeb1dee463d8cdd7a205a;hb=ea28213f8d38c309e28cd61b2cc9f53a6758f4e2;hp=e14c5c4930e5c436bf1c2d402f2ad5cda22d8cd0;hpb=0fd6f3d210d87e6b1eb1924bb16f945f1d1bf42e;p=16.git diff --git a/16/dos_gfx.cpp b/16/dos_gfx.cpp index e14c5c49..cbfa2d61 100644 --- a/16/dos_gfx.cpp +++ b/16/dos_gfx.cpp @@ -1,17 +1,17 @@ -//DOS Graphics thingy by sparky4 licence GPL v2 -//a special thanks to everyone to release source code for mode X +//DOS Graphics thingy by sparky4 licence GPL v2 +//a special thanks to everyone to release source code for mode X /*src\lib\*/ #include "dos_gfx.h" int old_mode; //color ‚Ä‚·‚Æ -int gq = LGQ; +short gq = LGQ; + //‚Ä‚·‚Æ -int q = 0; -int bakax = 0, bakay = 0; -cord xx = rand()&0%320, yy = rand()&0%240, sx = 0, sy = 0; -byte coor; - +short bakax = 0, bakay = 0; +syte xx = rand()&0%SW, yy = rand()&0%SH, sx = 0, sy = 0; +byte coor; + byte *vga = (byte *) MK_FP(0xA000, 0); /* @@ -19,13 +19,14 @@ byte *vga = (byte *) MK_FP(0xA000, 0); * to be included. */ #define TESTING +#define TILE ///////////////////////////////////////////////////////////////////////////// // // // setvideo() - This function Manages the video modes // // // ///////////////////////////////////////////////////////////////////////////// -void setvideo(/*byte mode, */int vq){ +void setvideo(/*byte mode, */short vq){ union REGS in, out; if(!vq){ // deinit the video @@ -36,7 +37,7 @@ void setvideo(/*byte mode, */int vq){ in.h.al = old_mode; int86(0x10, &in, &out); - }else if(vq == 1){ // init the video + }else if(vq==1){ // init the video // get old video mode in.h.ah = 0xf; int86(0x10, &in, &out); @@ -47,10 +48,12 @@ void setvideo(/*byte mode, */int vq){ mxSetMode( MX_320x240 ); // mxSetVirtualScreen(SW+(SW/4), SH+(SH/4)); // mxSetVirtualScreen(SW*2, SH*2); - mxSetVirtualScreen(VW,VH); + mxSetVirtualScreen(VW,BH); // mxSetVirtualScreen((640-(TILEWH*4)),(480-(TILEWH*4))); - mxSetClip(0); - //mxSetClipRegion(0, 0, SW, SH); + mxSetClip(true); + mxSetClipRegion(0, 0, VW, BH); + mxPan(TILEWH*2,TILEWH*2); + //mxSetClipRegion(0, VH+1, VW, (TILEWH*BUFFMX)); } } @@ -61,11 +64,11 @@ void setvideo(/*byte mode, */int vq){ // // ///////////////////////////////////////////////////////////////////////////// void cls(byte color, byte *Where){ - _fmemset(Where, color, VW*(VH)); + _fmemset(Where, color, VW*(VH*2)); } //color ‚Ä‚·‚Æ -int colortest(){ +short colortest(){ if(gq < NUM_COLORS){ cls(gq, vga); gq++; @@ -74,7 +77,7 @@ int colortest(){ } //color ‚Ä‚·‚Æ -int colorz(){ +short colorz(){ if(gq < HGQ){ //---- cls(gq, vaddr); cls(gq, vga); @@ -84,7 +87,7 @@ int colorz(){ } //slow spectrum down -void ssd(int svq){ +void ssd(short svq){ if(sy < SH+1){ if(sx < SW+1){ //plotpixel(xx, yy, coor, vga); @@ -102,9 +105,9 @@ void ssd(int svq){ } /*-----------ding-------------*/ -int ding(int q){ +short ding(int q){ - int d3y; + short d3y; //++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ; if((q == 2 @@ -112,14 +115,14 @@ int ding(int q){ ||q==16 ) && gq == BONK){ if(coor < HGQ && coor < LGQ) coor = LGQ; - if(coor < HGQ){ + if(coor < HGQ-1){ coor++; }else{ coor = LGQ; bakax = rand()%3; bakay = rand()%3; } } - if(q==8){ colorz(); return gq; }else + if(q==8){ colorz(); return gq; mxOutText(SW/2, SH/2, "bakapi"); }else if(q==10){ ssd(q); /*printf("%d\n", coor);*/ }else if(q==5){ colortest(); return gq; }else if(q==11){ colorz(); delay(100); return gq; } @@ -138,17 +141,17 @@ int ding(int q){ } if((q<5 && gq1){ -// xx+=TILEWH; + #ifdef TILE + xx+=TILEWH; + #else xx++; + #endif } if(!bakay){ -// yy-=TILEWH; + #ifdef TILE + yy-=TILEWH; + #else yy--; + #endif }else if(bakay>1){ -// yy+=TILEWH; + #ifdef TILE + yy+=TILEWH; + #else yy++; + #endif } } } // fixer if(q!=16){ - if(xx<0) xx=(VW/*-TILEWH*/); - if(yy<0) yy=(VH/*-TILEWH*/); - if(xx>(VW/*-TILEWH*/)) xx=0; - if(yy>(VH/*-TILEWH*/)) yy=0; + #ifdef TILE + if(xx<0) xx=(VW-TILEWH); + if(yy<0) yy=(VH-TILEWH); + if(xx>(VW-TILEWH)) xx=0; + if(yy>(VH-TILEWH)/*+(TILEWH*BUFFMX)*/) yy=0; + #else + if(xx<0) xx=VW; + if(yy<0) yy=VH; + if(xx>VW) xx=0; + if(yy>VH) yy=0; + #endif } //interesting effects if(q==16) { - int tx=0,ty=0; + short tx=0,ty=0; tx+=xx+16; ty+=yy+16; mxPutPixel(tx, ty, coor); @@ -216,17 +238,24 @@ int ding(int q){ // plot the pixel }else{ -// mxFillBox(xx, yy, TILEWH, TILEWH, coor, 0); + #ifdef TILE + mxFillBox(xx, yy, TILEWH, TILEWH, coor, OP_SET); + #else mxPutPixel(xx, yy, coor); + #endif } - if(q==2) mxPutPixel(rand()%SW, rand()%(SH*3), 0); - if(q==16) mxPutPixel(rand()%SW, rand()%(SH*3), 0); - if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; } + if(q==2) + #ifdef TILE + mxFillBox((rand()*TILEWH)%VW, (rand()*TILEWH)%(VH), TILEWH, TILEWH, 0, OP_SET); + #else + mxPutPixel(rand()%VW, rand()%(VH), 0); + #endif + if(q==16) mxPutPixel(rand()%VW, rand()%(VH), 0); + if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; } //random 3 switch gq++; //if(xx<0||xx>320||yy<0||yy>(SH*3)) -// printf("%d %d %d %d %d %d\n", xx, yy, coor, bakax, bakay, getPixel_X(xx,yy)); -// printf("%d\n", getPixel_X(xx,yy)); +// printf("%d %d %d %d %d\n", xx, yy, coor, bakax, bakay); }else gq = LGQ; return gq; } @@ -244,13 +273,13 @@ int ding(int q){ int main(void) { - int key,d,xpos,ypos,xdir,ydir; - //short int temp; + short key,d,xpos,ypos,xdir,ydir; + int ch=0x0; // main variables - d=1; // switch variable - key=4; // default screensaver number - xpos=0; - ypos=0; + d=4; // switch variable + key=2; // default screensaver number + xpos=TILEWH*2; + ypos=TILEWH*2; xdir=1; ydir=1; setvideo(1); @@ -269,12 +298,13 @@ int main(void) setvideo(1); } }*/ // else off - while(!kbhit()){ // conditions of screen saver + while(1){ // conditions of screen saver + while(!kbhit()){ ding(key); } //end of screen savers //doTest(); - for (int x = 0; x < VW; ++x) +/* for (int x = 0; x < VW; ++x) { mxPutPixel(x, 0, 15); mxPutPixel(x, SH-1, 15); @@ -283,10 +313,8 @@ int main(void) { mxPutPixel(0, y, 15); mxPutPixel(SW-1, y, 15); - } - - getch(); - for (int x = 320; x < VW; ++x) + } + for (int x = 0; x < VW; ++x) { mxPutPixel(x, 0, 15); mxPutPixel(x, VH-1, 15); @@ -295,28 +323,58 @@ int main(void) { mxPutPixel(0, y, 15); mxPutPixel(VW-1, y, 15); - } - getch(); + } + + getch();*/ + //text box + mxSetTextColor(10, OP_TRANS); //set font + mxBitBlt(xpos, ypos+(TILEWH*12), SW, TILEWH*BUFFMX, 0, BS); //copy background + mxFillBox(xpos, ypos+(TILEWH*12), SW, TILEWH*BUFFMX, 0, OP_SET); // background for text box + //+(QUADWH*6) + mxOutText(xpos+1, ypos+SH-48, "========================================"); + mxOutText(xpos+1, ypos+SH-40, "| |Chikyuu:$line1"); + mxOutText(xpos+1, ypos+SH-32, "| |$line2"); + mxOutText(xpos+1, ypos+SH-24, "| |$line3"); + mxOutText(xpos+1, ypos+SH-16, "| |$line4"); + mxOutText(xpos+1, ypos+SH-8, "========================================"); + mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~ + getch(); + mxBitBlt(0, BS, SW, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background + //mxBitBlt(0, (TILEWH*12)+1, 320, TILEWH*3, 0, 0); + getch(); while(!kbhit()){ // hScroll(1); // scrolly(1); // vScroll(1); // delay(100); //for(int i=0;i(VW-SW-1)) || (xpos<1))delay(500); + //mxWaitRetrace(); + mxPan(TILEWH*2,TILEWH*2); + mxBitBlt(0, SH, SW, SH, xpos, ypos); + //} if( (xpos>(VW-SW-1)) || (xpos<1)){xdir=-xdir;} - if( (ypos>(VH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change - // direction! } - //} + if( (ypos>(BH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change + // direction! } + + } + ch=getch(); + if(ch==0x71)break; // 'q' + if(ch==0x1b)break; // 'ESC' } setvideo(0); - printf("wwww\nResolution: %dx%d\n", SW,SH); + printf("wwww\nFull Buffer Virtual Resolution: %dx%d\n", VW,BH); + printf("Virtual Resolution: %dx%d\n", VW,VH); + printf("Resolution: %dx%d\n", SW,SH); printf("Mode X Library Version: %d\n", mxGetVersion()); - //puts("where to next? It's your move! wwww"); printf("bakapi ver. 1.04.09.04\nis made by sparky4i†ƒÖ…j feel free to use it ^^\nLicence: GPL v2\n"); return 0; }