Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Tank War Beta v0.1
- // Created by Lars Knaup
- // on 19.02.2011
- // sprites by Timo Keim
- #include <oslib/oslib.h>
- #define HSIZE 480
- #define VSIZE 272
- PSP_MODULE_INFO("TankWar", 0, 1, 1);
- PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
- OSL_IMAGE* tank;
- OSL_IMAGE* bg;
- int positionx = HSIZE / 2;
- int positiony = VSIZE / 2;
- // Funktion: ReadKeys
- // Aufgabe: Reagieren auf Tasten
- // X: Drehen um 90° gegen den Uhrzeigersinn
- // Analog Stick: Fahren
- // R: Schießen
- void ReadKeys()
- {
- oslReadKeys();
- if ((osl_keys->held.right) && (positionx < 374)) positionx +=1;
- if ((osl_keys->held.left) && (positionx > 0)) positionx -=1;
- if ((osl_keys->held.up) && (positiony < 222)) positiony += 1;
- if ((osl_keys->held.down) && (positiony > 0)) positiony -= 1;
- }
- int main (int argc, char* argv[])
- {
- oslInit(0);
- oslInitGfx(OSL_PF_8888, 1);
- oslInitConsole();
- tank = oslLoadImageFile("tank.png", OSL_IN_VRAM, OSL_PF_5551);
- bg = oslLoadImageFile("bg.png", OSL_IN_VRAM, OSL_PF_5551);
- while(!osl_quit)
- {
- ReadKeys();
- oslStartDrawing();
- oslClearScreen(RGB(0,0,0));
- oslDrawImage(bg);
- oslDrawImageXY(tank, positionx, positiony);
- oslEndDrawing();
- oslSyncFrame();
- }
- oslEndGfx();
- oslQuit();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement