]> 4ch.mooo.com Git - 16.git/blob - src/test.c
wwww
[16.git] / src / test.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 published 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 should 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 <stdio.h>\r
24 #include "src/lib/modex16.h"
25 \r
26 word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\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     modexEnter();\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     modexLeave();\r
95     modexPalBlack();\r
96     modexFadeOn(1, pal);\r
97 }\r