]> 4ch.mooo.com Git - 16.git/blob - 16/lib/intro/lib.c
modified: 16/DOS_GFX.EXE
[16.git] / 16 / lib / intro / lib.c
1 /*\r
2  * The library testing routines follows below.\r
3  */\r
4 \r
5 \r
6 #ifdef TESTING\r
7 \r
8 #include <stdio.h>\r
9 #include <conio.h>\r
10 \r
11 void doTest(void)\r
12                 {\r
13                 int p, x, y, pages;\r
14 \r
15                 /* This is the way to calculate the number of pages available. */\r
16                 pages = 65536L/(widthBytes*height); // apparently this takes the A000 address\r
17 //              if(height==240) pages++;\r
18 \r
19 //              printf("%d¥n", pages);\r
20 \r
21                 for (p = 0; p <= pages; ++p)\r
22                                 {\r
23                                 setActivePage(p);\r
24 \r
25                                 /* On each page draw a single colored border, and dump the palette\r
26                                    onto a small square about the middle of the page. */\r
27 \r
28                                    //{\r
29                                                 for (x = 0; x <= width; ++x)\r
30                                                                 {\r
31 //                                                              putPixel_X(x, 0, p+1);\r
32                                                                 mxPutPixel(x, 0, p+1);\r
33                                                                 if(p!=pages) mxPutPixel(x, height-1, p+1);\r
34                                                                                 else if(height==240) mxPutPixel(x, 99-1, p+1);\r
35                                                                 }\r
36 \r
37                                                 for (y = 0; y <= height; ++y)\r
38                                                                 {\r
39                                                                 mxPutPixel(0, y, p+1);\r
40                                                                 if(p!=pages) mxPutPixel(width-1, y, p+1);\r
41                                                                                 else if(height==240) mxPutPixel(width-1, y, p+1);\r
42                                                                 }\r
43 \r
44                                                 for (x = 0; x < TILEWH; ++x)\r
45                                                                 for (y = 0; y < TILEWH; ++y)\r
46                                                                                 mxPutPixel(x+(p+2)*16, y+(p+2)*TILEWH, x + y*TILEWH);\r
47                                                 //}\r
48 \r
49                                 }\r
50 \r
51                 /* Each pages will now contain a different image.  Let the user cycle\r
52                    through all the pages by pressing a key. */\r
53                 for (p = 0; p < pages; ++p)\r
54                                 {\r
55                                 setVisiblePage(p);\r
56                                 getch();\r
57                                 }\r
58 \r
59                 }\r
60 \r
61 /*\r
62  * Library test (program) entry point.\r
63  */\r
64 \r
65 int main(void)\r
66                 {\r
67                 int key,d,xpos,ypos,xdir,ydir;\r
68                 //short int temp;\r
69                 // main variables\r
70                 d=1; // switch variable\r
71                 key=4; // default screensaver number\r
72                 xpos=0;\r
73                 ypos=0;
74                 xdir=1;\r
75                 ydir=1;\r
76 //        puts("First, have a look at the 320x200 mode.  I will draw some rubbish");\r
77 //        puts("on all of the four pages, then let you cycle through them by");\r
78 //        puts("hitting a key on each page.");\r
79 //        puts("Press a key when ready...");\r
80 //        getch();\r
81 \r
82 //        doTest();\r
83 \r
84 //        puts("Then, check out Mode X, 320x240 with 3 (and a half) pages.");\r
85 //        puts("Press a key when ready...");\r
86 //        getch();\r
87 \r
88 //++++0000\r
89                 setvideo(1);\r
90 // screen savers\r
91 \r
92 /*while(d!=0){ // on!\r
93                                 if(!kbhit()){ // conditions of screen saver\r
94                                                 ding(key);\r
95                                 }else{\r
96                                                 setvideo(0);\r
97                                                 // user imput switch\r
98                                                 printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 5 to quit.¥n", getch());  // prompt the user\r
99                                                 scanf("%d", &key);\r
100                                                 //if(key==3){xx=yy=0;} // crazy screen saver wwww\r
101                                                 if(key==5) d=0;\r
102                                                 setvideo(1);\r
103                                 }\r
104                 }*/ // else off\r
105                 while(!kbhit()){ // conditions of screen saver\r
106                         ding(key);\r
107                 }\r
108                 //end of screen savers\r
109                 //doTest();\r
110                 for (int x = 0; x < width; ++x)\r
111                         {\r
112                                 mxPutPixel(x, 0, 15);\r
113                                 mxPutPixel(x, height-1, 15);\r
114                         }\r
115                 for (int y = 0; y < height; ++y)\r
116                         {\r
117                                 mxPutPixel(0, y, 15);\r
118                                 mxPutPixel(width-1, y, 15);\r
119                         }\r
120                 getch();\r
121                 while(!kbhit()){\r
122 //                      hScroll(1);\r
123 //                      scrolly(1);\r
124 //                      vScroll(1);\r
125 //                      delay(100);\r
126                         //for(int i=0;i<TILEWH;i++){\r
127                                 ding(key);\r
128                                 mxPan(xpos,ypos);\r
129                                 mxWaitRetrace();\r
130                                 xpos=xpos+xdir;\r
131                                 ypos=ypos+ydir;\r
132                                 if( (xpos>239)  || (xpos<1))xdir=-xdir;\r
133                                 if( (ypos>179) || (ypos<1))ydir=-ydir; // { Hit a boundry, change\r
134                         //    direction! }\r
135                         //}\r
136                 }\r
137                 setvideo(0);\r
138                 printf("wwww¥n%dx%d¥n", width,height);\r
139                 printf("[%d]¥n", mxGetVersion());\r
140                 puts("where to next?  It's your move! wwww");\r
141                 printf("bakapi ver. 1.04.09.04¥nis made by sparky4(≧ω≦) feel free to use it ^^¥nLicence: GPL v2¥n");\r
142                 return 0;\r
143                 }\r
144 \r
145 #endif\r
146 #endif