Exemplo n.º 1
0
void mainloop(void)
{
    gfx_calcpalette(64, 0, 0, 0);
    gfx_setpalette();
    win_getspeed(60);

    for (;;)
    {
        speed = win_getspeed(60);
        key = kbd_getkey();
        getmousemove();
        getmousebuttons();
        if ((key == KEY_ESC) || (win_quitted)) break;
        generalcommands();
        gfx_fillscreen(0);
        printinfo();
        printstatus();
        gfx_drawsprite(mousex, mousey, 0x00010001);
        gfx_updatepage();
    }
}
Exemplo n.º 2
0
void printinfo(void)
{
    int y, x, f;
    unsigned char *infoptr = &blkinfdata[16*blk];
    txt_print(40, 96, SPR_FONTS, "0");
    txt_print(40+24, 96, SPR_FONTS, "1");
    txt_print(40+2*24, 96, SPR_FONTS, "2");
    txt_print(40+3*24, 96, SPR_FONTS, "3");
    txt_print(40+4*24, 96, SPR_FONTS, "4");
    txt_print(40+5*24, 96, SPR_FONTS, "5");
    txt_print(40+6*24, 96, SPR_FONTS, "6");
    txt_print(40+7*24, 96, SPR_FONTS, "7");
    for (y = 0; y < 4; y++)
    {
        for (x = 0; x < 4; x++)
        {
            if (*infoptr & 1) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+x*4,64+y*4,f);
            if (*infoptr & 2) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+24+x*4,64+y*4,f);
            if (*infoptr & 4) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+2*24+x*4,64+y*4,f);
            if (*infoptr & 8) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+3*24+x*4,64+y*4,f);
            if (*infoptr & 16) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+4*24+x*4,64+y*4,f);
            if (*infoptr & 32) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+5*24+x*4,64+y*4,f);
            if (*infoptr & 64) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+6*24+x*4,64+y*4,f);
            if (*infoptr & 128) f=0x00010005; else f=0x00010006;
            gfx_drawsprite(32+7*24+x*4,64+y*4,f);
            infoptr++;
        }
    }
}
Exemplo n.º 3
0
void layeroptions(void)
{
    int newsizex = layer[cl].xsize;
    int newsizey = layer[cl].ysize;

    for (;;)
    {
        win_getspeed(60);
        key = kbd_getkey();

        if ((key == KEY_ESC) || (key == KEY_ENTER)) break;
        if (key == KEY_DOWN) layermenusel++;
        if (key == KEY_UP) layermenusel--;
        if (layermenusel < 0) layermenusel = 5;
        if (layermenusel > 5) layermenusel = 0;
        if (key == KEY_I)
        {
            newsizey -= 10;
            if (newsizey < minysize) newsizey = 0;
        }
        if (key == KEY_J)
        {
            newsizex -= 10;
            if (newsizex < minxsize) newsizex = 0;
        }
        if (key == KEY_M)
        {
            if (newsizey) newsizey += 10;
            else newsizey = minysize;
        }
        if (key == KEY_K)
        {
            if (newsizex) newsizex += 10;
            else newsizex = minxsize;
        }
        if (key == KEY_RIGHT)
        {
            switch(layermenusel)
            {
                case 0:
                if (newsizex) newsizex++;
                else newsizex = minxsize;
                break;

                case 1:
                if (newsizey) newsizey++;
                else newsizey = minysize;
                break;

                case 2:
                layer[cl].xdivisor++;
                break;

                case 3:
                layer[cl].ydivisor++;
                break;

                case 4:
                layer[cl].xwrap ^= 1;
                break;

                case 5:
                layer[cl].ywrap ^= 1;
                break;
            }
        }
        if (key == KEY_LEFT)
        {
            switch(layermenusel)
            {
                case 0:
                if (newsizex) newsizex--;
                if (newsizex < minxsize) newsizex = 0;
                break;

                case 1:
                if (newsizey) newsizey--;
                if (newsizey < minysize) newsizey = 0;
                break;

                case 2:
                if (layer[cl].xdivisor) layer[cl].xdivisor--;
                break;

                case 3:
                if (layer[cl].ydivisor) layer[cl].ydivisor--;
                break;

                case 4:
                layer[cl].xwrap ^= 1;
                break;

                case 5:
                layer[cl].ywrap ^= 1;
                break;
            }
        }

        gfx_fillscreen(0);
        sprintf(printbuffer, "LAYER %d OPTIONS", cl+1);
        txt_printcenter(40, SPR_FONTS, printbuffer);
        sprintf(printbuffer, "X SIZE %04d", newsizex);
        txt_printcenter(60, SPR_FONTS, printbuffer);
        sprintf(printbuffer, "Y SIZE %04d", newsizey);
        txt_printcenter(70, SPR_FONTS, printbuffer);
        sprintf(printbuffer, "X DIVISOR %03d", layer[cl].xdivisor);
        txt_printcenter(80, SPR_FONTS, printbuffer);
        sprintf(printbuffer, "Y DIVISOR %03d", layer[cl].ydivisor);
        txt_printcenter(90, SPR_FONTS, printbuffer);
        if (layer[cl].xwrap) txt_printcenter(100, SPR_FONTS, "X WRAP ON");
        else txt_printcenter(100, SPR_FONTS, "X WRAP OFF");
        if (layer[cl].ywrap) txt_printcenter(100, SPR_FONTS, "Y WRAP ON");
        else txt_printcenter(110, SPR_FONTS, "Y WRAP OFF");
        gfx_drawsprite(100, 60+layermenusel*10, 0x00010004);
        gfx_updatepage();

    }

    if ((newsizex != layer[cl].xsize) || (newsizey != layer[cl].ysize))
    {
        resizelayer(cl, newsizex, newsizey);
    }
    mark = 0;
    copybuffer = 0;
}
Exemplo n.º 4
0
void mainloop(void)
{
    gfx_calcpalette(64, 0, 0, 0);
    gfx_setpalette();

    win_getspeed(60);
    for (;;)
    {
        speed = win_getspeed(60);
        if (speed > 10) speed = 10;
        key = kbd_getkey();
        getmousemove();
        getmousebuttons();
        if ((key == KEY_ESC) || (win_quitted)) break;
        blockediting();
        scrollmap();
        generalcommands();
        gfx_fillscreen(transparent);
        drawalllayers();
        printstatus();
        if (mark)
        {
            int mx, my;
            if (layer[cl].xdivisor) mx = markx1*gfx_blockxsize-xpos/layer[cl].xdivisor;
            else mx = markx1*gfx_blockxsize;
            if (layer[cl].xsize)
            {
                while (mx < 0)
                {
                    mx += layer[cl].xsize*gfx_blockxsize;
                }
                mx %= (layer[cl].xsize*gfx_blockxsize);
            }
            if (layer[cl].ydivisor) my = marky1*gfx_blockysize-ypos/layer[cl].ydivisor;
            else my = marky1*gfx_blockysize;
            if (layer[cl].ysize)
            {
                while (my < 0)
                {
                    my += layer[cl].ysize*gfx_blockysize;
                }
                my %= (layer[cl].ysize*gfx_blockysize);
            }
            gfx_drawsprite(mx,my,0x00010002);
        }
        if (mark==2)
        {
            int mx, my;
            if (layer[cl].xdivisor) mx = markx2*gfx_blockxsize-xpos/layer[cl].xdivisor;
            else mx = markx2*gfx_blockxsize;
            if (layer[cl].xsize)
            {
                while (mx < 0)
                {
                    mx += layer[cl].xsize*gfx_blockxsize;
                }
                mx %= (layer[cl].xsize*gfx_blockxsize);
            }
            if (layer[cl].ydivisor) my = marky2*gfx_blockysize-ypos/layer[cl].ydivisor;
            else my = marky2*gfx_blockysize;
            if (layer[cl].ysize)
            {
                while (my < 0)
                {
                    my += layer[cl].ysize*gfx_blockysize;
                }
                my %= (layer[cl].ysize*gfx_blockysize);
            }
            gfx_drawsprite(mx,my,0x00010003);
        }
        gfx_drawsprite(mousex,mousey,0x00010001);
        gfx_updatepage();

    }
}