Results 1 to 2 of 2

Thread: General Button Input (mini tutorial)

  
  1. #1
    modsyn is offline -Hacks Guru
    Join Date
    Aug 2005
    Location
    Shinigami Kurosaki Ichigo!
    Posts
    2,475
    Rep Power
    17

    Default

    Use this skeleton to get basic input from the psp controller

    Code:
    oldPad = Controls.read()
    
    while true do
    	pad = Controls.read()
    	if pad:cross() then
    		if pad ~= oldPad then
                       --process cross button
    		end
    	end
    
    
    	if pad:circle() then
    		if pad ~= oldPad then
                        --process circle button
    		end
    	end
    
    	if pad:triangle() then
    		if pad ~= oldPad then
                        --process triangle button
    		end
    	end
    
    	if pad:square() then
    		if pad ~= oldPad then
                        --process square button
    		end
    	end
    
    	if pad:r() then
    		if pad ~= oldPad then
                        --process right trigger button
    		end
    	end
    
    	if pad:l() then
    		if pad ~= oldPad then
                        --process left trigger button
    		end
    	end
    
    	screen.waitVblankStart()
    	screen.flip()
    
    	if pad:start() then break end
    	if pad:select() then screen:save("screenshot.tga") end
    	oldPad = pad
    end
    as if it's not obvious, you'll have to write your own button processing
    code. start will exit to luaplayer or restart (if standalone). select saves
    a screenshot. i hope this has been helpful.

    cheers

    jMEnc Guide, jMEnc2 page - by the way, you smell nice

  2. #2
    RaiderX's Avatar
    RaiderX is offline Senior Member -Hacks Titan
    Join Date
    Jun 2005
    Posts
    4,192
    Rep Power
    21

    Default

    nice. hey can U make a small tutorial on how to put function for the analog stick to load a small picture (such as a pen or cursoer/mouse) and then the analog moves the little pic around the screen in respective directuions? I know I can go discect someone else's code, but Im tired and too lazy... w_:razz:

Posting Permissions

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