X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=16%2Fdos_gfx.cpp;h=268b99ae5f9393febd76d0e967ba3a385450f477;hb=e26d9f2f0a5705ab73e9b531000f1fad8a1a5466;hp=4542e718ed5963a9840f5a6d2fe2c203e91ddfc9;hpb=240ba660932b53de8912026596031edcc1e3e4b9;p=16.git diff --git a/16/dos_gfx.cpp b/16/dos_gfx.cpp index 4542e718..268b99ae 100644 --- a/16/dos_gfx.cpp +++ b/16/dos_gfx.cpp @@ -1,7 +1,8 @@ //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" +#include "dos_gfx.h" +//#include "lib\modex16.h" //____ int old_mode; //color ‚Ä‚·‚Æ @@ -9,7 +10,7 @@ short gq = LGQ; //‚Ä‚·‚Æ short bakax = 0, bakay = 0; -syte xx = rand()&0%SW, yy = rand()&0%SH, sx = 0, sy = 0; +word xx = rand()&0%SW, yy = rand()&0%SH, sx = 0, sy = 0; byte coor; byte *vga = (byte *) MK_FP(0xA000, 0); @@ -18,8 +19,8 @@ byte *vga = (byte *) MK_FP(0xA000, 0); * Comment out the following #define if you don't want the testing main() * to be included. */ -#define TESTING -#define TILE +#define TESTING +//#define TILE ///////////////////////////////////////////////////////////////////////////// // // @@ -48,14 +49,27 @@ void setvideo(/*byte mode, */short vq){ mxSetMode( MX_320x240 ); // mxSetVirtualScreen(SW+(SW/4), SH+(SH/4)); // mxSetVirtualScreen(SW*2, SH*2); - mxSetVirtualScreen(VW,(VH+(TILEWH*BUFFMX))); + mxSetVirtualScreen(VW,BH); // mxSetVirtualScreen((640-(TILEWH*4)),(480-(TILEWH*4))); mxSetClip(true); - mxSetClipRegion(0, 0, VW, (VH+(TILEWH*BUFFMX))); + mxSetClipRegion(0, 0, VW, BH); + mxPan(TILEWH*2,TILEWH*2); //mxSetClipRegion(0, VH+1, VW, (TILEWH*BUFFMX)); } } +void pdump(){ + int mult=(QUADWH)/2; + int palq=(mult)*16; + int palcol=0; + for(int paly=0; paly1){ - #ifdef TILE - xx+=TILEWH; + }else if(bakax>1){ + #ifdef TILE + xx+=TILEWH; #else - xx++; + xx++; #endif } - if(!bakay){ + if(!bakay){ #ifdef TILE - yy-=TILEWH; + yy-=TILEWH; #else - yy--; + yy--; #endif - }else if(bakay>1){ + }else if(bakay>1){ #ifdef TILE - yy+=TILEWH; + yy+=TILEWH; #else - yy++; + 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*BUFFMX))) 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 @@ -229,15 +250,20 @@ short ding(int q){ //printf("%d %d %d %d %d %d\n", xx, yy, tx, ty, TILEWH); // plot the pixel - }else{ + }else{ #ifdef TILE - mxFillBox(xx, yy, TILEWH, TILEWH, coor, OP_SET); + mxFillBox(xx, yy, TILEWH, TILEWH, coor, OP_SET); #else - mxPutPixel(xx, yy, coor); + mxPutPixel(xx, yy, coor); #endif } - if(q==2) mxPutPixel(rand()%VW, rand()%(VH), 0); + 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++; @@ -259,17 +285,22 @@ short ding(int q){ */ int main(void) - { + { + //bitmap_t bmp; //____ + //bmp = modexLoadPcx("chikyuu.pcx"); //____ short key,d,xpos,ypos,xdir,ydir; int ch=0x0; // main variables d=4; // switch variable - key=4; // default screensaver number - xpos=0; - ypos=0; + key=2; // default screensaver number + xpos=TILEWH*2; + ypos=TILEWH*2; xdir=1; ydir=1; - setvideo(1); + setvideo(1); + //modexPalUpdate(bmp.palette); //____ + //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____ + //getch(); //____ // screen savers /*while(d!=0){ // on! @@ -285,13 +316,14 @@ int main(void) setvideo(1); } }*/ // else off + //mxFillBox(0, 0, VW, BH, 10, OP_SET); 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); @@ -301,7 +333,7 @@ int main(void) mxPutPixel(0, y, 15); mxPutPixel(SW-1, y, 15); } - for (int x = 320; x < VW; ++x) + for (int x = 0; x < VW; ++x) { mxPutPixel(x, 0, 15); mxPutPixel(x, VH-1, 15); @@ -311,47 +343,58 @@ int main(void) mxPutPixel(0, y, 15); mxPutPixel(VW-1, y, 15); } - - getch(); - //mxFillBox(xx, yy, QUADWH, QUADWH, 1, 16); - //mxFillBox(xx, yy, QUADWH, QUADWH, 2, 16); - //mxFillBox(xx, yy, QUADWH, QUADWH, 3, 16); - //mxFillBox(xx, yy, QUADWH, QUADWH, 4, 16); - mxSetTextColor(8, OP_TRANS); - mxOutText(56, SH-40, "CRAZY!!!!]"); - mxOutText(64, SH-32, "CRAZY!!!!]"); - mxOutText(64, SH-24, "____ CRAZY!!!!]"); - mxOutText(56, SH-16, "___ _ CRAZY!!!!]"); - getch(); + */ + pdump(); + 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 + getch(); while(!kbhit()){ -// hScroll(1); -// scrolly(1); -// vScroll(1); -// delay(100); //for(int i=0;i(VW-SW-1)) || (xpos<1))delay(500); + //mxWaitRetrace(); +//mxBitBlt(32, (SH+32), SW, SH, xpos, ypos); +mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2); +//xpos=ypos=TILEWH*2; +mxPan(32,32); + //} if( (xpos>(VW-SW-1)) || (xpos<1)){xdir=-xdir;} - if( (ypos>((VH+(TILEWH*13))-SH-1)) || (ypos<1)){ydir=-ydir; delay(1000);} // { Hit a boundry, change + if( (ypos>(BH-SH-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change // direction! } +//mxBitBlt(32, (SH+64+32), SW, SH, xpos, ypos); +//mxBitBlt(TILEWH*2, (SH+64+32), SW, SH, TILEWH*2, TILEWH*2); } ch=getch(); if(ch==0x71)break; // 'q' if(ch==0x1b)break; // 'ESC' } setvideo(0); - printf("wwww\nVirtual Resolution: %dx%d\n", VW,VH); + 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; }