src/behavior.c

changeset 112
3e956c96dd6c
parent 111
ee4b58dfcf7f
child 113
71ba88258ea0
equal deleted inserted replaced
111:ee4b58dfcf7f 112:3e956c96dd6c
25 * POSSIBILITY OF SUCH DAMAGE. 25 * POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "ascension/behavior.h" 28 #include "ascension/behavior.h"
29 #include "ascension/error.h" 29 #include "ascension/error.h"
30 #include "ascension/scene.h"
30 31
31 #include <cx/array_list.h> 32 #include <cx/array_list.h>
33 #include <cx/tree.h>
32 34
33 static void asc_behavior_destroy(void *b) { 35 static void asc_behavior_destroy(void *b) {
34 AscBehavior *behavior = b; 36 AscBehavior *behavior = b;
35 if (behavior->destroy_func) { 37 if (behavior->destroy_func) {
36 behavior->destroy_func(behavior); 38 behavior->destroy_func(behavior);
52 if (behavior == NULL) { 54 if (behavior == NULL) {
53 // TODO: output ID of node once we have implemented that 55 // TODO: output ID of node once we have implemented that
54 asc_error("Failed to add behavior to scene node."); 56 asc_error("Failed to add behavior to scene node.");
55 return NULL; 57 return NULL;
56 } 58 }
59 behavior->enabled = true;
57 behavior->node = node; 60 behavior->node = node;
58 behavior->func = args.func; 61 behavior->func = args.func;
59 behavior->destroy_func = args.destroy_func; 62 behavior->destroy_func = args.destroy_func;
60 behavior->data = args.data; 63 behavior->data = args.data;
61 return behavior; 64 return behavior;

mercurial