]> 4ch.mooo.com Git - 16.git/blob - src/bakapi.c
fb7d79a25e1df88cc708ec7a6a93738f6572fc30
[16.git] / src / bakapi.c
1 /* Project 16 Source Code~
2  * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
3  *
4  * This file is part of Project 16.
5  *
6  * Project 16 is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as publiSCREEN_HEIGHTed by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Project 16 is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You SCREEN_HEIGHTould have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,
19  * Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  */
22
23 #include "src/bakapi.h"
24
25 /*
26  * BAKAPEE!
27  */
28 void
29 main(int argc, char *argv[])
30 {
31         static bakapee_t bakapee;
32         page_t screen;
33         word key,d,xpos,ypos,xdir,ydir;
34         int ch=0x0;
35         // main variables values
36         d=4; // switch variable
37         key=2; // default screensaver number
38         xpos=TILEWH*2;
39         ypos=TILEWH*2;
40         xdir=1;
41         ydir=1;
42         bakapee.xx = rand()&0%SCREEN_WIDTH;
43         bakapee.yy = rand()&0%SCREEN_HEIGHT;
44         bakapee.gq = 0;
45         bakapee.sx=0;
46         bakapee.sy=0;
47         bakapee.bakax=0;
48         bakapee.bakay=0;
49         bakapee.coor=0;
50
51         /* setup camera and screen~ */
52         screen = modexDefaultPage();
53         screen.width += (TILEWH*2);
54         screen.height += (TILEWH*2);
55         textInit();
56
57         //modexPalUpdate(bmp.palette); //____
58         //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____
59         //getch(); //____
60
61         VGAmodeX(1);
62         modexShowPage(&screen);
63
64 // screen savers
65 #ifdef BOINK
66         while(d!=0)     // on!
67         {
68                 if(!kbhit())
69                 { // conditions of screen saver
70                         ding(&screen, &bakapee, key);
71                 }
72                 else
73                 {
74                         VGAmodeX(0);
75                         //modexLeave();
76                         // user imput switch
77                         printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n", getch());  // prompt the user
78                         scanf("%d", &key);
79                         //if(key==3){xx=yy=0;} // crazy screen saver wwww
80                         if(key==0){ d=0; }else{
81                                 screen = modexDefaultPage();
82                                 screen.width += (TILEWH*2);
83                                 screen.height += (TILEWH*2);
84                                 VGAmodeX(1);
85                                 modexShowPage(&screen);
86                         }
87                 }
88         }
89 #else
90         while(1)
91         { // conditions of screen saver
92                 while(!kbhit())
93                 {
94                         ding(&screen, &bakapee, key);
95                 }
96                 //end of screen savers
97                 /*for(int x = 0; x < screen.width; ++x)
98                 {
99                         modexputPixel(&page, x, 0, 15);
100                         mxPutPixel(x, SCREEN_HEIGHT-1, 15);
101                         }
102                 for (int y = 0; y < VH; ++y)
103                         {
104                                 mxPutPixel(0, y, 15);
105                                 mxPutPixel(SCREEN_WIDTH-1, y, 15);
106                         }
107                 for (int x = 0; x < VW; ++x)
108                         {
109                                 mxPutPixel(x, 0, 15);
110                                 mxPutPixel(x, VH-1, 15);
111                         }
112                 for (int y = 240; y < VH; ++y)
113                         {
114                                 mxPutPixel(0, y, 15);
115                                 mxPutPixel(VW-1, y, 15);
116                         }*/
117                 pdump(&screen);
118                 getch();
119                 //text box
120                 /*++++mxBitBlt(xpos, ypos+(TILEWH*12), SCREEN_WIDTH, TILEWH*BUFFMX, 0, BS); //copy background
121                 mxFillBox(xpos, ypos+(TILEWH*12), SCREEN_WIDTH, TILEWH*BUFFMX, 0, OP_SET); // background for text box
122                 //+(QUADWH*6)
123                 mxOutText(xpos+1, ypos+SCREEN_HEIGHT-48, "========================================");
124                 mxOutText(xpos+1, ypos+SCREEN_HEIGHT-40, "|    |Chikyuu:$line1");
125                 mxOutText(xpos+1, ypos+SCREEN_HEIGHT-32, "|    |$line2");
126                 mxOutText(xpos+1, ypos+SCREEN_HEIGHT-24, "|    |$line3");
127                 mxOutText(xpos+1, ypos+SCREEN_HEIGHT-16, "|    |$line4");
128                 mxOutText(xpos+1, ypos+SCREEN_HEIGHT-8,  "========================================");
129                 mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
130                 getch();
131                 mxBitBlt(0, BS, SCREEN_WIDTH, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
132                 getch();++++*/
133                 while(!kbhit())
134                 {
135                         //for(int i=0;i<TILEWH;i++){
136                                 ding(&screen, &bakapee, key);
137                                 modexPanPage(&screen, xpos, ypos);
138 //++++mxFillBox(384, 304, 384, 304, 10, OP_SET);
139 //mxBitBlt(xpos, ypos, SCREEN_WIDTH, SCREEN_HEIGHT, 32, (SCREEN_HEIGHT+64+32));
140 //++++mxBitBlt(TILEWH*2, TILEWH*2, SCREEN_WIDTH, SCREEN_HEIGHT, 32, (SCREEN_HEIGHT+64+32));
141                                 //for(word o = 0; o<TILEWH; o++){
142                                         xpos+=xdir;
143                                         ypos+=ydir;
144                                         //if(ypos==1 || (ypos==(BH-SCREEN_HEIGHT-1)))delay(500);
145                                         //if((xpos>(VW-SCREEN_WIDTH-1)) || (xpos<1))delay(500);
146                                         //mxWaitRetrace();
147 //mxBitBlt(32, (SCREEN_HEIGHT+32), SCREEN_WIDTH, SCREEN_HEIGHT, xpos, ypos);
148 //++++mxBitBlt(TILEWH*2, (SCREEN_HEIGHT+64+32), SCREEN_WIDTH, SCREEN_HEIGHT, TILEWH*2, TILEWH*2);
149 //xpos=ypos=TILEWH*2;
150                                         //????modexPanPage(&screen, 32, 32);
151                                 //}
152                                 if( (xpos>(VW-SCREEN_WIDTH-1))  || (xpos<1)){xdir=-xdir;}
153                                 if( (ypos>(BH-SCREEN_HEIGHT-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
154                         //}//    direction!
155 //mxBitBlt(32, (SCREEN_HEIGHT+64+32), SCREEN_WIDTH, SCREEN_HEIGHT, xpos, ypos);
156 //mxBitBlt(TILEWH*2, (SCREEN_HEIGHT+64+32), SCREEN_WIDTH, SCREEN_HEIGHT, TILEWH*2, TILEWH*2);
157                 }
158         ch=getch();
159         if(ch==0x71)break; // 'q'
160         if(ch==0x1b)break; // 'ESC'
161         }
162 //      VGAmodeX(0);
163 #endif
164         printf("bakapi ver. 1.04.13.04\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v3\n");
165 }
166 //pee!