annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
1 #include "task_base.h"
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
2 #include "task_object.h"
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
4 SchedDefineTask1(Asteroid, asteroid_task);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 static int
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
7 asteroid_task(SchedTask *smanager, void *rbuf, void *wbuf)
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
9 int asteroidi = (int)smanager->get_param(0);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
10
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 p->x += p->vx;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 p->y += p->vy;
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
15
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 if (asteroidi > 0) {
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
17 CHARACTER* asteroiddt = (CHARACTER*)smanager->get_input(rbuf, 1);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
18
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
19 for (int i = 0; i < asteroidi; i++) {
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
20 if ((asteroiddt[i].x + 32 > p->x)
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
21 && (p->x + 32 > asteroiddt[i].x)
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
22 && (asteroiddt[i].y + 32 > p->y)
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
23 && (asteroiddt[i].y < p->y + 32)) {
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 p->vx *= -1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 p->vy *= -1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 }
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
29 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
30
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 18
diff changeset
31 *q = *p;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 }