Mentions légales du service

Skip to content
Snippets Groups Projects
Commit e156a2c6 authored by SZCZEPANSKI Marin's avatar SZCZEPANSKI Marin
Browse files

Use apply_input from engine in interrupteurs

parent 0c22da4f
No related branches found
No related tags found
No related merge requests found
...@@ -32,26 +32,10 @@ void touch(void) { ...@@ -32,26 +32,10 @@ void touch(void) {
#endif #endif
} }
void apply_input(command * c) { void c_apply_input(command * c) {
if (!strcmp(c->command_buffer, "UP")) { if (!strcmp(c->command_buffer, "TOUCH")) {
up();
} else if (!strcmp(c->command_buffer, "UP_N")) {
up_n(atoi(c->args[0]));
} else if (!strcmp(c->command_buffer, "DOWN")) {
down();
} else if (!strcmp(c->command_buffer, "DOWN_N")) {
down_n(atoi(c->args[0]));
} else if (!strcmp(c->command_buffer, "LEFT")) {
left();
} else if (!strcmp(c->command_buffer, "LEFT_N")) {
left_n(atoi(c->args[0]));
} else if (!strcmp(c->command_buffer, "RIGHT")) {
right();
} else if (!strcmp(c->command_buffer, "RIGHT_N")) {
right_n(atoi(c->args[0]));
} else if (!strcmp(c->command_buffer, "TOUCH")) {
touch(); touch();
} else { } else {
printf("Unknown input command.\n"); apply_input(c);
} }
} }
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
#include "custom_map.h" #include "custom_map.h"
// examine la commande c et appelle les fonctions d'action ou de déplacement correspondantes // examine la commande c et appelle les fonctions d'action ou de déplacement correspondantes
void apply_input(command * c); void c_apply_input(command * c);
#endif // INPUT_MANAGER_H #endif // INPUT_MANAGER_H
\ No newline at end of file
...@@ -91,7 +91,7 @@ int main(int argc, char ** argv) { ...@@ -91,7 +91,7 @@ int main(int argc, char ** argv) {
// The Holy Main Loop // The Holy Main Loop
while (!exit_main_loop) { while (!exit_main_loop) {
apply_input(com); c_apply_input(com);
/* since the events may be applied if the input is FORWARD_N, /* since the events may be applied if the input is FORWARD_N,
we need to check to avoid triggering the same event twice*/ we need to check to avoid triggering the same event twice*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment