Revision 226
implemented double-linked list. implemented bullet collision with walls from gunner collision. implemented bullet position updating with certain speed
proj.c | ||
---|---|---|
26 | 26 |
#include "bullet.h" |
27 | 27 |
#include "map1.h" |
28 | 28 |
|
29 |
#include "list.h" |
|
30 |
|
|
29 | 31 |
int main(int argc, char* argv[]) { |
30 | 32 |
|
31 | 33 |
lcf_set_language("EN-US"); |
... | ... | |
106 | 108 |
graph_draw(); |
107 | 109 |
rectangle_dtor(rect); |
108 | 110 |
|
111 |
list_t *l = list_ctor(); |
|
112 |
int *p = NULL; |
|
113 |
for(int i = 10; i < 20; ++i){ |
|
114 |
p = malloc(sizeof(int)); |
|
115 |
*p = i; |
|
116 |
printf("INSERTING %d\n", i); |
|
117 |
list_insert(l, list_end(l), p); |
|
118 |
printf("INSERTED, SIZE=%d\n", list_size(l)); |
|
119 |
} |
|
120 |
list_node_t *it = list_begin(l); |
|
121 |
while(it != list_end(l)){ |
|
122 |
printf("%d\n", **(int**)list_node_val(it)); |
|
123 |
it = list_node_next(it); |
|
124 |
} |
|
125 |
while(list_size(l) > 0){ |
|
126 |
printf("ERASING\n"); |
|
127 |
void *p = list_erase(l, list_begin(l)); |
|
128 |
printf("ERASED %d, SIZE=%d\n", *(int*)p, list_size(l)); |
|
129 |
free(p); |
|
130 |
} |
|
131 |
printf("DONE\n"); |
|
132 |
if(list_dtor(l)) printf("COULD NOT DESTRUCT LIST\n"); |
|
133 |
|
|
134 |
|
|
109 | 135 |
tickdelay(micros_to_ticks(1000000)); |
110 | 136 |
|
111 | 137 |
#endif |
Also available in: Unified diff