Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Noob Coding Question

                  
   
  1. #1
    DCEmu Rookie
    Join Date
    May 2007
    Location
    Under your Bed
    Posts
    168
    Rep Power
    0

    Default Noob Coding Question

    how do i code analog stick movements??

  2. #2

  3. #3
    DCEmu Rookie
    Join Date
    May 2007
    Location
    Under your Bed
    Posts
    168
    Rep Power
    0

    Default

    thank you very much

  4. #4
    DCEmu Rookie
    Join Date
    May 2007
    Location
    Under your Bed
    Posts
    168
    Rep Power
    0

    Default

    how do i detect the movements???

  5. #5
    GP2X Coder/Moderator
    Join Date
    Jan 2006
    Posts
    1,678
    Rep Power
    83

    Default

    You already have an example and code in the topic I linked. What do you mean by movement?

  6. #6
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Tutorials Anna Logg

    2 perpendicular strips attach to the base of the stick with geared movement for precision.

    Each strip connects to a potentiometer,whose resistance varies according to the position of the strip.

    Changing voltage/current caused by varying resistance is digitised and stored in an 8 bit data register.

    X,Y registers for the 2 strips are read from f/ware, and returned to a prog.

    'movement' (velocity) is programmed, using the time between 2 reads,and the distance between the
    positions that were read

  7. #7
    DCEmu Rookie
    Join Date
    May 2007
    Location
    Under your Bed
    Posts
    168
    Rep Power
    0

    Default

    yes yaustar, i typed that in my code but how do i use it??

  8. #8
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Tutorials Logg II (The Apad)

    Analog velocity's uncommon in games, except on the Wii.
    Tiger Woods PGA tour 2004 (PS2) uses it for the golfers' clubswing.
    It's an ambitious piece of coding to attempt.

    More often, the Analog stick's used like a Dpad:

    The range of (X,Y) positions are divided into sectors.
    Each sector corresponds to a direction button.
    When the Analog position read is inside a sector,it's treated as
    a push of the corresponding button.
    Central sector = no button push

    e.g. (-127,0) = Apad LEFT ,(120,118) = Apad RIGHT+UP

  9. #9
    DCEmu Rookie
    Join Date
    May 2007
    Location
    Under your Bed
    Posts
    168
    Rep Power
    0

    Default

    ok, but i want to know how to use it, for example, to use dpad buttons you would type
    if(pad.Buttons & PSP_CTRL_UP){
    }

    so what do i do for that analog stick??

  10. #10
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Tutorials Logg III (The DeadZone)

    Size and shape of the Apad centre(-off) sector has a
    significant effect on performance and sensitivity.

    A precise method uses a circle centred at (0,0) with a variable radius (R).
    The value (R × R) is calculated (RSQ).
    An Apad position (X,Y) is inside the centre-off sector if ((X × X) + (Y × Y)) is less than RSQ.

    ex:
    Code:
    if (analogX^2+analogY^2)<rsquared {/* no analog i/p */}
    RSQ effects sensitivity.
    (RSQ = 32768) : disables the Apad
    (RSQ = 1) : maximum sensitivity
    (RSQ = 3698) : default

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •