SGDK JOY Question

SGDK only sub forum

Moderator: Stef

Post Reply
nolddor
Very interested
Posts: 102
Joined: Sun Jun 02, 2013 1:35 pm
Location: Spain

SGDK JOY Question

Post by nolddor »

Hi guys, I create a bmp (PRESS START IMG) and i want to create a flicker effect, and when the joy press_start_buttom the main code clean the screen

but not works

Code: Select all

void JoyHandler_titlescreen( u16 joy, u16 changed, u16 state)
{
    while (!(state & BUTTON_START))
    {
        VDP_fillTileMapRectInc(APLAN, TILE_ATTR_FULL(PAL0, 0, 0, 0, 333), 14, 23, 12, 1);
        waitMs(500);
        VDP_clearTileMapRect (APLAN,14, 23, 12, 1);
        waitMs(400);
        VDP_waitVSync();
    }
}
With this code the result is not satisfactory, if not press START BUTTOM the text does not blink.

Should be blinking until you press start and stop when pressed to clean the screen in the main code

Note: the function WaitMs not works neither
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

If that's a callback for the joypad, it's called from within the vblank interrupt. You shouldn't do things like that inside ints. You should do that in the main task and have the joypad callback just set some (volatile) variables.
Xynxyn
Very interested
Posts: 54
Joined: Fri Jun 15, 2012 10:32 am
Location: Poland

Post by Xynxyn »

I finished a few days ago small module for joypad of my library "SGDK++". (Yes, I know... very originial name :D)
If you want, I will give you my module. (have some features that standard SGDK hasn't got -> 2-bit states, minimalistic easy use etc)
Chilly Willy
Very interested
Posts: 2993
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy »

Xynxyn wrote:I finished a few days ago small module for joypad of my library "SGDK++". (Yes, I know... very originial name :D)
If you want, I will give you my module. (have some features that standard SGDK hasn't got -> 2-bit states, minimalistic easy use etc)
Post some code and specs and examples over in the sgdk thread so Stef can decide on if it is worth including, or at least adding some of it to the current joy handling.

If you don't think it should be included in sgdk, perhaps you might make a thread in the tools forum where you make a pitch on why someone would want to use it compared to what is already in sgdk.

Remember we're (mostly) all devs here, so be sure to go into detail on it.
Xynxyn
Very interested
Posts: 54
Joined: Fri Jun 15, 2012 10:32 am
Location: Poland

Post by Xynxyn »

I'm very sorry, that I post it so late. I can't publish it before, because I didn't have any (free time and...) access to my computer, on which I'm working on SGDK++. Now I can upload it. Here it is:

Version 0.41: (can be buggy, if it's, I can upload 0.1 and 0.2 versions, and actualize actual version)
http://xynxyn.cba.pl/gendev/sgdkpp/

Just unpack it to SGDK directory, there is also a documentation. (very big, as for so small library). At all, only JoyPP_init() and Joy() functions are important, not so much theory, that it looks like.

Next modules will be soon, I couldn't work on it for a long time, but now I can. :)

EDIT:
Link repaired.
djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch »

Hi there,

I'm having a bit of trouble getting JoyPP to work. Buttons get stuck as pressed.

I'm calling JoyPP_init(1, JOY_3BUTTON, JOY_STANDARD) after calling VDP_init().

I print the value of Joy(0, bB) every frame for debugging purposes. When the application runs, it's 0 (unpressed) but when I press the button it gets set to 2 (pressed) and then stays at that value even if I let go of the button.

The strange thing is, if I print the values of Joy(0, bA) and Joy(0, bB) every frame and press just one of the buttons, both their values change to 2 at the same time and get stuck there.

Am I missing something?

Thanks!
DJCC

PS: Also, for me, simply dropping the files into SGDK doesn't automatically work. I had to modify the makefile to find joy.o.
Xynxyn
Very interested
Posts: 54
Joined: Fri Jun 15, 2012 10:32 am
Location: Poland

Post by Xynxyn »

Strange bugs. I will fix them and publish soon fixed version.
PS: Also, for me, simply dropping the files into SGDK doesn't automatically work. I had to modify the makefile to find joy.o.
Thanks. I know what makes problem. In next version it will be fixed. (I forget one file)
Last edited by Xynxyn on Wed Jun 26, 2013 4:44 pm, edited 2 times in total.
Xynxyn
Very interested
Posts: 54
Joined: Fri Jun 15, 2012 10:32 am
Location: Poland

Post by Xynxyn »

Fixed all known bugs, except for:
- sometimes pressing and leaving button in the same time on two pads will stop on one value of one of them, but when do something with the button, it just "fix" himself (but it could be bug on example, ;D I will check it tomorrow)
- only 3 button joypads support, the last four buttons don't work ;/

Download version 0.5 here:
http://xynxyn.cba.pl/gendev/sgdkpp/
Post Reply