typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
/*
#include <vga.h>
#include <vgagl.h>
*/
#define vgax 320
#define vgay 200
#define VGAMODE G320x200x256
#include "sprite01.H"

void setcustompalette() {
    /* colors 0-31 are a RGB mix (bits 0 and 1 red, 2 green, 3 and 4 blue) */
    Palette pal;
    int i;
    for (i = 0; i < 256; i++) 
    {
        pal.color[i].red = i/4;
	pal.color[i].green = i/4;
	pal.color[i].blue = i/4;
    }
    gl_setpalette(&pal);
}


int main()
{
    /* Root Rechte aufgeben */
    vga_init();
    sprite_linear_nontransparenttype vscreen(vgax,vgay,0,0,(char)0);
    sprite_linear_transparenttype lands(vgax,vgay,0,0,(char)0);
/*    for (int y=0;y<vgay;y++)
	for (int x=0;x<vgax;x++)
	    lands.putpixel(x,y,x);
    lands.copysprite(0,0,&vscreen);*/

    lands.putpixel(0,0,128);
    lands.putpixel(vgax-1,0,128);
    lands.putpixel(0,vgay-1,128);
    lands.putpixel(vgax-1,vgay-1,128);
/*    for (int y=0;y<vgay;y++)
    {
	lands.putpixel(0,y,1);
	lands.putpixel(vgax-1,y,255);
    }*/
    lands.randomsprite();
    lands.copysprite(0,0,&vscreen);
    
    getchar();

    // VgaMode initen 
    vga_setmode(VGAMODE);
    gl_setcontextvga(VGAMODE);
    setcustompalette();
    vscreen.malesprite(0,0);
    getchar();
    vga_setmode(TEXT);
    return(0);
}
