As a tool designed to expand on Ren’Py’s existing functionality to add better controller support, sometimes functions and features need to be overwritten to provide a better experience. Where practical, I will endeavour to get these changes into the engine (and in the case of the bugs I discovered, those fixes are incorporated but only in newer engine versions, so they are backported here). In the meantime, my goal is to have a tool override to get that functionality sooner. This article is a brief overview of the engine functionalities which needed to be overwritten rather than built upon, and thus have the potential to be updated in the future.
Pick up the tool from itch.io if you haven’t already:
Most of the overwritten content can be found in controller_override.rpy. There are comments denoting where the overwritten code is.
renpy.display.controller.start
This function runs when a new controller is connected. It has been overwritten to support callbacks.
renpy.display.controller.quit
This function runs when a controller is disconnected. It has been overwritten to support callbacks.
renpy.map_event
This function has been overwritten if the user’s version is below 8.3.x, as there was a bug preventing lists of controller events from working. In 8.3.x+ it is untouched.
renpy.display.controller.event
This function is called to process and categorize pygame controller events. It has been overwritten to pass along CONTROLLERAXISMOTION events when a stick enters or leaves its dead zone (to enable granular controller stick movement).
renpy.display.focus.before_interact
This function is called before a new focusable element is selected. It is overwritten only if the user’s version is below 8.3.6, as there’s a bug whereby the default_focus displayable gets focus even if it has been explicitly set by the user to be something else.