Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Reacting to volume key presses

in Questions Posts: 2

Hello

I basically want to use Codea to program something akin to a small slide full screen show app (it’s more specialised but this is the least complicated to explain analogy). I would like to be able to hold the ipad and use the hardware volume keys to move to the next / previous slide.

Can this be done from Codea? Or can I query the current system volume setting? (And therefore just do this in my draw function to react to changes).

Cheers,

Bene

Comments

  • dave1707dave1707 Mod
    Posts: 7,749

    @Bene Why not just tap the screen to go to the next slide or back to the previous slide.

  • dave1707dave1707 Mod
    Posts: 7,749

    @Bene Codea doesn't have access to the volume buttons. Here's a simple program that will let you move from slide to slide just by swiping your thumb or finger on the screen in the direction you want to go. Right now I just us text with the numbers 1 to 15. You would replace the numbers in the table with the pictures you want to show.

    displayMode(FULLSCREEN)
    
    function setup()
        fontSize(50)
        tab={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
        fill(255)
        pos=1
    end
    
    function draw()
        background(40, 40, 50)
        if pos<1 then
            pos=#tab
        elseif pos>#tab then
            pos=1
        end
        text("Slide "..tab[pos],WIDTH/2,HEIGHT/2)
    end
    
    function touched(t)
        if t.state==BEGAN then
            h=t.x
        elseif t.state==ENDED then
            if t.x<h then
                pos=pos+1
            end
            if t.x>h then
                pos=pos-1
            end
        end
    end
    
    
    
  • Posts: 2
    The volume keys are less noticeable when pressed, when I hold the iPad facing the audience. As said i am not really writing a slideshow app
Sign In or Register to comment.