]> 4ch.mooo.com Git - 16.git/blob - src/test.c
extended video initiation stuff
[16.git] / src / test.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 \r
23 #include <stdio.h>\r
24 #include "src/lib/modex16.h"\r
25 \r
26 global_game_variables_t gvar;\r
27 \r
28 void main() {\r
29         int i, j;\r
30         word start, end;\r
31         page_t page, page2;\r
32         byte *pal, *pal2=NULL;\r
33 \r
34         /* load our palette */\r
35         modexLoadPalFile("data/default.pal", &pal2);\r
36 \r
37         /* save the palette */\r
38         pal  = modexNewPal();\r
39         modexPalSave(pal);\r
40         modexFadeOff(1, pal);\r
41         modexPalBlack();\r
42 \r
43         VGAmodeX(1, &gvar);\r
44         modexPalBlack();\r
45 \r
46         /* set up the page, but with 16 pixels on all borders in offscreen mem */\r
47         page=modexDefaultPage();\r
48         page2 = modexNextPage(&page);\r
49         page.width += 32;\r
50         page.height += 32;\r
51 \r
52 \r
53         /* fill the page with one color, but with a black border */\r
54         modexShowPage(&page2);\r
55         modexClearRegion(&page, 16, 16, SCREEN_WIDTH, SCREEN_HEIGHT, 128);\r
56         modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42);\r
57         modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128);\r
58         modexShowPage(&page);\r
59 \r
60         /* fade in */\r
61         modexFadeOn(1, pal2);\r
62 \r
63 \r
64         start = *clockw;\r
65         for(i=0; i<5; i++) {\r
66         /* go right */\r
67         for(j=0; j<32; j++) {\r
68                 page.dx++;\r
69                 modexShowPage(&page);\r
70         }\r
71         /* go left */\r
72         for(j=0; j<32; j++) {\r
73                 page.dx--;\r
74                 modexShowPage(&page);\r
75         }\r
76         /* go up */\r
77         for(j=0; j<32; j++) {\r
78                 page.dy++;\r
79                 modexShowPage(&page);\r
80         }\r
81 \r
82         /* go down */\r
83         for(j=0; j<32; j++) {\r
84                 page.dy--;\r
85                 modexShowPage(&page);\r
86         }\r
87         }\r
88 \r
89         end = *clockw;\r
90 \r
91         /* fade back to text mode */\r
92         modexFadeOff(1, pal2);\r
93         modexPalBlack();\r
94         VGAmodeX(0, &gvar);\r
95         modexPalBlack();\r
96         modexFadeOn(1, pal);\r
97 }\r