116379180582415931

Published: Fri 10 April 2026
Updated: Fri 10 April 2026
By me

In misc.

I'm trying to make a gba game with the agb rust framework (more like loosely follow a tutorial) and I got bite by rust lifetime checker.
Game is pong, I have a paddle object, a ball object. I thought I could attach the sound mixer to the ball for collision sound effect and keep it in the main thread for music.
Double borrow error.
I tried changes things a bit, made a closure, send it to the ball so the ball can tell main thread play sound effect A.
Double borrow error.

This throw me off yesterday, I went to sleep thinking I could return what sound effect to play from one of the function called once per frame.
This morning it hit me, the method to show the ball or paddle already have the pattern I need. Update method compute logic. Show method get a frame as argument, put sprite on it, borrowes frame get returned at the end of the function. All I need is either add the mixer to the show method or a new method, and not attach mixer to the object

links

social