#include "jgame.h" #include "jdraw.h" #include "jinput.h" #include #include "actor.h" draw::surface *surf; actor::actor_t *box; void game::init() { draw::init("The Pool", 320, 240, 3); surf = draw::loadSurface("test.gif"); draw::setSource(surf); draw::loadPalette("test.gif"); game::setUpdateTicks(64); box = actor::create({16,16,0}, {8,8,8}, {32,0,32,32}, {0,32}); actor::setDirty(box); box = actor::create({8,0,0}, {8,8,8}, {32,0,32,32}, {0,32}); actor::setDirty(box); actor::reorder(); } int sx=1, sy=0; bool game::loop() { if (input::keyDown(SDL_SCANCODE_LEFT) && box->pos.x>0) { box->pos.x--; actor::setDirty(box); } if (input::keyDown(SDL_SCANCODE_RIGHT) && box->pos.x<42) { box->pos.x++; actor::setDirty(box); } if (input::keyDown(SDL_SCANCODE_UP) && box->pos.y>0) { box->pos.y--; actor::setDirty(box); } if (input::keyDown(SDL_SCANCODE_DOWN) && box->pos.y<42) { box->pos.y++; actor::setDirty(box); } if (input::keyDown(SDL_SCANCODE_Z) && box->pos.z>0) { box->pos.z--; actor::setDirty(box); } if (input::keyDown(SDL_SCANCODE_A) && box->pos.z<42) { box->pos.z++; actor::setDirty(box); } actor::reorder(); draw::cls(8); for (int y=0;y<8;++y) { for (int x=0;x<8;++x) { draw::draw(148+x*16-y*16,76+x*8+y*8,32,15,0,1); } } actor::draw(actor::getFirst()); //draw::draw(148+sx*2-sy*2, 67+sx+sy,24,24,24,0); draw::render(); return true; }