Browse code

get_button: do not pass the whole event struct on the stack

Sigrid Solveig Haflínudóttir authored on 27/12/2021 14:24:22
Showing 1 changed files
... ...
@@ -394,9 +394,9 @@ restart(Uxn *u)
394 394
 }
395 395
 
396 396
 Uint8
397
-get_button(SDL_Event event)
397
+get_button(SDL_Event *event)
398 398
 {
399
-	switch(event.key.keysym.sym) {
399
+	switch(event->key.keysym.sym) {
400 400
 	case SDLK_LCTRL: return 0x01;
401 401
 	case SDLK_LALT: return 0x02;
402 402
 	case SDLK_LSHIFT: return 0x04;
... ...
@@ -483,9 +483,9 @@ run(Uxn *u)
483 483
 					clamp(event.motion.x - PAD, 0, ppu.width - 1),
484 484
 					clamp(event.motion.y - PAD, 0, ppu.height - 1));
485 485
 			else if(event.type == SDL_KEYDOWN)
486
-				controller_down(devctrl, get_button(event));
486
+				controller_down(devctrl, get_button(&event));
487 487
 			else if(event.type == SDL_KEYUP)
488
-				controller_up(devctrl, get_button(event));
488
+				controller_up(devctrl, get_button(&event));
489 489
 			/* continue */
490 490
 			switch(event.type) {
491 491
 			case SDL_DROPFILE: