]>
git.r.bdr.sh - rbdr/super-polarity/blob - src/actor_manager.c
c9303d2f85de18dc98565db872f9bdf20e108856
5 // Created by Ruben Beltran del Rio on 8/14/13.
6 // Copyright (c) 2013 Abuguet. All rights reserved.
10 #include "actor_manager.h"
12 void actorManagerUpdate(ActorManager
*this, Uint32 dt
) {
13 ActorNode
*head
= this->actors
;
15 while (head
!= NULL
) {
16 head
->val
->update(head
->val
, dt
);
21 void actorManagerDraw(ActorManager
*this) {
22 ActorNode
*head
= this->actors
;
24 while (head
!= NULL
) {
25 head
->val
->draw(head
->val
);
30 void actorManagerAddActor(ActorManager
*this, Actor
*actor
) {
31 ActorNode
*actorNode
= malloc(sizeof(ActorNode
*));
32 ActorNode
**head
= &this->actors
;
34 actorNode
->val
= actor
;
35 actorNode
->next
= NULL
;
42 while (temp
->next
!= NULL
) {
45 temp
->next
= actorNode
;
49 ActorManager
* createActorManager () {
50 ActorManager
*actorManager
= malloc(sizeof(ActorManager
*));
51 actorManager
->actors
= NULL
;
52 actorManager
->update
= actorManagerUpdate
;
53 actorManager
->draw
= actorManagerDraw
;
54 actorManager
->addActor
= actorManagerAddActor
;