1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
\r
4 * This file is part of Project 16.
\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
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
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
26 #include "src/lib/modex16.h"
\r
27 #include "src/lib/bitmap.h"
\r
28 #include "src/lib/planar.h"
\r
30 global_game_variables_t gvar;
\r
32 planar_buf_t near *p;
\r
34 void main(int argc, char *argv[])
\r
45 bakapeee = malloc(64);
\r
47 if(argv[1]) bakapeee = argv[1];
\r
48 else bakapeee = "data/koishi~.pcx";
\r
50 if(argv[2]) baka = atoi(argv[2]);
\r
53 bmp = bitmapLoadPcx(bakapeee);
\r
54 p = planar_buf_from_bitmap(&bmp);
\r
55 VGAmodeX(baka, &gvar);
\r
56 gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
\r
58 /* fix up the palette and everything */
\r
59 modexPalUpdate1(bmp.palette);
\r
61 /* clear and draw one sprite and one bitmap */
\r
62 modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 0);
\r
64 /* update display~*/
\r
65 gvar.video.page[0].dx+=32;
\r
66 gvar.video.page[0].dy+=32;
\r
67 modexShowPage(&gvar.video.page[0]);
\r
69 /* non sprite comparison */
\r
71 // oldDrawBmp(VGA, 20, 20, &bmp, 0);
\r
72 for(i=0; i<100 ;i++) {
\r
73 modexDrawBmp(&gvar.video.page[0], 32, 32, &bmp);
\r
75 t1 = (*clockw-start) /18.2;
\r
77 // modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);
\r
78 // t2 = (*clockw-start)/18.2;
\r
80 for(i=0; i<100 ;i++) {
\r
81 DrawPBuf(&gvar.video.page[0], 0, 0, p, 0);
\r
83 t2 = (*clockw-start) /18.2;
\r
88 /*printf("\nmain=%Fp\n\n", &i);
\r
89 printf("bmp.data=%Fp\n", bmp.data);
\r
90 printf("*bmp.data=%Fp\n", *(bmp.data));
\r
91 printf("&bmp.data=%Fp\n", &(bmp.data));*/
\r
93 /* print out the contents of each plane */
\r
94 for(plane=0; plane < 4; plane++) {
\r
96 printf("Plane %d\n", plane);
\r
97 for(py=0; py < p->height; py++) {
\r
98 for(px=0; px < p->pwidth; px++) {
\r
99 printf("%02X ", (int) p->plane[plane][i++]);
\r
104 fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n");
\r
105 fprintf(stderr,"version %s\n", VERSION);
\r
106 fprintf(stderr,"%d\n", sizeof(p->plane));
\r
107 fprintf(stderr,"pw=%d\n", p->width);
\r
108 fprintf(stderr,"ph=%d\n", p->height);
\r
109 fprintf(stderr,"ppw=%d\n", p->pwidth);
\r
110 fprintf(stderr,"%d\n", sizeof(bmp));
\r
111 fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p->width), gvar.video.page[0].sh-(p->height));
\r
112 planar_buf_free(p);
\r
113 fprintf(stderr, "modexDrawBmp: %f\n", t1);
\r
114 fprintf(stderr, "DrawPBuf: %f\n", t2);
\r
115 fprintf(stderr, "gvar.video.page[0].width: %u\n", gvar.video.page[0].width);
\r
116 fprintf(stderr, "gvar.video.page[0].height: %u\n", gvar.video.page[0].height);
\r