]> 4ch.mooo.com Git - 16.git/blob - src/test.c
many improvements for testing have been added ^^
[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 void main() {\r
27     int i, j;\r
28     word start, end;\r
29     page_t page, page2;\r
30     byte *pal, *pal2=NULL;\r
31 \r
32     /* load our palette */\r
33     modexLoadPalFile("data/default.pal", &pal2);\r
34 \r
35     /* save the palette */\r
36     pal  = modexNewPal();\r
37     modexPalSave(pal);\r
38     modexFadeOff(1, pal);\r
39     modexPalBlack();\r
40 \r
41     modexEnter();\r
42     modexPalBlack();\r
43 \r
44     /* set up the page, but with 16 pixels on all borders in offscreen mem */\r
45     page=modexDefaultPage();\r
46     page2 = modexNextPage(&page);\r
47     page.width += 32;\r
48     page.height += 32;\r
49 \r
50 \r
51     /* fill the page with one color, but with a black border */\r
52     modexShowPage(&page2);\r
53     modexClearRegion(&page, 16, 16, SCREEN_WIDTH, SCREEN_HEIGHT, 128);\r
54     modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42);\r
55     modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128);\r
56     modexShowPage(&page);\r
57 \r
58     /* fade in */\r
59     modexFadeOn(1, pal2);\r
60 \r
61 \r
62     start = *clockw;\r
63     for(i=0; i<5; i++) {\r
64         /* go right */\r
65         for(j=0; j<32; j++) {\r
66             page.dx++;\r
67             modexShowPage(&page);\r
68         }\r
69         /* go left */\r
70         for(j=0; j<32; j++) {\r
71             page.dx--;\r
72             modexShowPage(&page);\r
73         }\r
74         /* go up */\r
75         for(j=0; j<32; j++) {\r
76             page.dy++;\r
77             modexShowPage(&page);\r
78         }\r
79 \r
80         /* go down */\r
81         for(j=0; j<32; j++) {\r
82             page.dy--;\r
83             modexShowPage(&page);\r
84         }\r
85     }\r
86 \r
87     end = *clockw;\r
88 \r
89     /* fade back to text mode */\r
90     modexFadeOff(1, pal2);\r
91     modexPalBlack();\r
92     modexLeave();\r
93     modexPalBlack();\r
94     modexFadeOn(1, pal);\r
95 }\r