Week 11

The final Week. Had to make the final run, and finish across the dash line, which is exactly what I had in mind as I approached this week.

The Dimensions activity had the issue of persistent images that remained across the games. This was caused on a code level, where the Sprile object created wasn’t updated on changing the games. Thus when a new game is loaded, the previous image is also rendered just because the Sprite object isn’t being updated. I fixed that by creating new Sprite object for each new game, thus ensuring only the relevant content to a game is rendered.

The issue of Letters and FollowMe were infact very similar. The simple patch to fix the issue was by removing the recursive call. The reason being the PyGame activity runs in one massive loop, and calling the loop just once is enough. Calling the loop several times, leads to many processes being created and other side effects.

The issue of Countries-activity is again similar to the above, the difference being the activity did not resize on changing display resolution or orientation. The reason being PyGame’s VIDEORESIZE event only handles Window resizes and not resolution changes. That needs to be explicitly handled in the activity, via a GTK signal/handler. So I connected a handler to the GDK “size-changed” signal, and reset the initial global variables and so on to fit the new resolution.

The issue of Stick-hero-activity was a simple fix, however, the directory where the score file was being created was incorrect. Sugar often runs from /usr/ directory, where a user cannot create files without sudo permission and that results in the activity not starting. I changed that by making using of the instance and data directory of each activity bundle. It was a simple fix and activity began to run correctly. However, the number of redraws and the frame rate at which the activity runs is too high and needs to optimised. But that’s a task for another day.

Time to wrap up.

Links to PR: Dimensions PR: #14 Letters PR: #6 FollowMe PR: #8 Countries-activity PR: #13 Stick-Hero-activity PR: #15

Written on August 26, 2019