Thread: LUA Assistance

Results 1 to 2 of 2
  1. #1 LUA Assistance 
    Junior Member
    Join Date
    Dec 2007
    Posts
    3
    I'm quite familiar with the language, and its' C base. Having coding a ton of WoW addons for nooblets over the years. However I'm running into a bit of a snag with the PSP API.

    I'm sure this is a total dink error and I just can't figure it yet. But here's the issue:

    I've screen:blit a background and it centers properly at the 480x272 dimensions. I've made a 32x32 icon to serve as a "mouse" icon for the analog stick, and I can get it to show properly. It also moves around in tune with the analog stick. However the dimensions don't match given the -127/128(or whatever the exact values are) to the 480x272.

    It always paints it in a rectangle where you only see the bottom right corner of the total field. Where if you dip into the negatives the cursors goes off the screen up and to the left.

    What's the math function to convert the values of 127/128 to match the 480 width of the screen?

    I tinkered with math.abs but couldn't get the values correct. Further tinkering around and I eventually got the Y value to "work"(though I'm sure there's a better method than what I used). X however is giving me total fits.

    Can anyone solve this without me having to post code. I will if I have to, but I'm sure someone knows this error like the back of their hand.

    Big Love,
    Akurei



    ***NM I solved it, but it's still a sloppy solution. If someone has the algorithm for this please post away.

    Quote Originally Posted by Sloppy Method
    MouseLoc = Controls.read()
    MinX = MouseLoc:analogX() + 128
    MinY = MouseLoc:analogY() + 128

    MinX = MinX * 1.875

    if MinX > 450 then
    MinX = 450
    end

    screen:blit(0, 0, mainmenu)
    screen:blit(MinX, MinY, mouse)
    Last edited by Akurei; 12-10-2007 at 08:08 PM.
    Reply With Quote  
     

  2. #2  
    Senior Member I Modded My PSP linkinworm's Avatar
    Join Date
    May 2007
    Posts
    203
    this could work for you, it looks realy messy tho, u might not under stand t all but it works
    [code]
    p = {x = 0, y = 0, img = Image.createEmpty(32,32)}
    p.img:clear(Color.new(255,0,0))
    deadzone = 48
    sensitivity = 32
    while true do
    pad = Controls.read()
    screen:clear()
    anx = pad:analogX()
    any = pad:analogY()
    if math.abs(anx) > deadzone then
    p.x = p.x + anx/sensitivity
    elseif math.abs(any) > deadzone then
    p.y = p.y + any/sensitity
    end
    screen.waitVblankStart()
    screen.flip()
    end
    Reply With Quote  
     

Similar Threads

  1. Fat PSP 3.8 Assistance.
    By xv3nomx in forum PSP Software, Firmware & Plugins
    Replies: 17
    Last Post: 03-19-2009, 02:50 AM
  2. Need assistance, please
    By Vakrium in forum PSP Software, Firmware & Plugins
    Replies: 3
    Last Post: 03-06-2009, 05:35 PM
  3. Need little assistance
    By lizard in forum PSP Hardware & Repair
    Replies: 9
    Last Post: 07-24-2008, 08:43 PM
  4. So, I need some assistance, please.
    By Ceracyst in forum PSP Software, Firmware & Plugins
    Replies: 3
    Last Post: 06-30-2008, 11:15 AM
  5. Assistance
    By nova350z in forum PSP Software, Firmware & Plugins
    Replies: 2
    Last Post: 04-05-2008, 04:47 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •