Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Super Scope support added, some other changes
What has been done: - Super Scope code is usable and available now, comes with example mini game. - Some minor changes to mouse support, now we can also use detectMouse() function to set snes_mouse automatically. Example was updated to display this function. MouseSpeedChange funciton was renamed to mouseSpeedChange(). My bad ^^ - Pad folder name was changed to "input" - input folder inside old pad folder was renamed to "controller", as well as other assets - pad.h was renamed to input.h, and every reference to that file inside other files - input name folder was changed to "controller", as well as assets inside - Some minor tabs P.D. Sorry for the big change! I think that input is a more suitable name, now that we have more controlling devices in addition to pad controllers. ***SUPER SCOPE USAGE*** first, we might use detectSuperScope() on boot to detect Super Scope presence. Other way is to force detection by populating snes_sscope to 1 manually, but we dont need to do that if we call this function. We need to call this function everytime Scope gets disconnected from the system, a usefull way to do it is inside this conditional: ``` if (snes_sscope == false) { detectSuperScope(); // some other code you might need in your program, like displaying warning messages and stopping your game. } ``` Here is a brief explanation of every variable we might be using: ``` extern u16 scope_holddelay; /*! \brief Hold delay. */ extern u16 scope_repdelay; /*! \brief Repeat rate. */ extern u16 scope_shothraw; /*! \brief Horizontal shot position, not adjusted. */ extern u16 scope_shotvraw; /*! \brief Vertical shot position, not adjusted. */ extern u16 scope_shoth; /*! \brief Horizontal shot position, adjusted for aim. */ extern u16 scope_shotv; /*! \brief Vertical shot position, adjusted for aim. */ extern u16 scope_centerh; /*! \brief 0x0000 is the center of the screen, positive values go to bottom right. */ extern u16 scope_centerv; /*! \brief 0x0000 is the center of the screen, positive values go to bottom right. */ extern u16 scope_down; /*! \brief flags that are currently true.*/ extern u16 scope_now; /*! \brief flags that have become true this frame.*/ extern u16 scope_held; /*! \brief flagsthat have been true for a certain length of time.*/ extern u16 scope_last; /*! \brief flags that were true on the previous frame.*/ extern u16 scope_sinceshot; /*! \brief Number of frames elapsed since last shot was fired.*/ ``` for scope_down, scope_now, scope_held, scope_last, we need to mask our bits with this usefull bits: ``` typedef enum SUPERSCOPE_BITS { SSC_FIRE = BIT(15), //!< superscope FIRE button. SSC_CURSOR = BIT(14), //!< superscope CURSOR button. SSC_PAUSE = BIT(12), //!< superscope PAUSE button. SSC_TURBO = BIT(13), //!< superscope TURBO flag. SSC_OFFSCREEN = BIT(9), //!< superscope OFFSCREEN flag. SSC_NOISE = BIT(8), //!< superscope NOISE flag. } SUPERSCOPE_BITS; ``` And that's most of it. You can look inside the example file to have an idea of how you can program Super Scope games. ***MOUSE USAGE UPDATE*** Same as Super Scope, mouse uses detectMouse() to populate snes_mouse to 1, so It can be called at boot and like this: ``` if (snes_mouse == false) { detectMouse(); // some other code you might need in your program, like displaying warning messages and stopping your game. } ``` Co-Authored-By: alekmaul <alekmaul@portabledev.com>
- Loading branch information