Mercurial > hg > Members > koba > t_dandy
view spe/asteroid.cc @ 60:cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
author | yutaka@localhost.localdomain |
---|---|
date | Sun, 06 Feb 2011 17:16:43 +0900 |
parents | c330ded6d728 |
children |
line wrap: on
line source
#include "task_base.h" #include "task_object.h" SchedDefineTask1(Asteroid, asteroid_task); static int asteroid_task(SchedTask *smanager, void *rbuf, void *wbuf) { int asteroidi = (int)smanager->get_param(0); CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); p->x += p->vx; p->y += p->vy; if (asteroidi > 0) { CHARACTER* asteroiddt = (CHARACTER*)smanager->get_input(rbuf, 1); for (int i = 0; i < asteroidi; i++) { if ((asteroiddt[i].x + 32 > p->x) && (p->x + 32 > asteroiddt[i].x) && (asteroiddt[i].y + 32 > p->y) && (asteroiddt[i].y < p->y + 32)) { p->vx *= -1; p->vy *= -1; } } } CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); *q = *p; return 0; }