Lightning Demo App! (BBtouch + 3 hours of code)
Posted: 26 October 2009 09:05 PM   [ Ignore ]
Avatar
RankRank
Joined  2008-11-28
Total Posts:  122
Member

Hi all.
Give me 3 or so hours of coding and I come up with this little demo. Created in BBtouch, this is the first example of how BlitzBasic can be used with multitouch!
So without further delay, I give you lightning! :D

(Note: This demo app runs full-screen and in 1024x768 resolution)
showimage.do?filename=scrnsht1.jpg&seed=9089b63bf1c90c25c514b9c033a1d71e&code=53616c7465645f5f62424a2c039ab279695749d7b5d032c15be0911890f30602
showimage.do?filename=scrnsht2.jpg&seed=41411a98a1fd46bfa305d44c9cd119c6&code=53616c7465645f5f28d978a0598d3b397c1b229dbf566c563b7ed8d4f3242308

File Attachments
Lightning.zip  (File Size: 607KB - Downloads: 620)
Profile
 
 
Posted: 27 October 2009 04:42 PM   [ Ignore ]   [ # 1 ]
Rank
Joined  2009-10-15
Total Posts:  17
New Member

Hey mate,
you should really try my update… The paket\active is to sense how long the touch is held before the current frame… so if you move over the controls they wont change…
If you touch them and move them, they are changed.

Good feature for programs like yours smile

miLORD

Profile
 
 
Posted: 27 October 2009 05:34 PM   [ Ignore ]   [ # 2 ]
Avatar
RankRank
Joined  2008-11-28
Total Posts:  122
Member

I’m using your update… :O

Profile
 
 
Posted: 27 October 2009 05:40 PM   [ Ignore ]   [ # 3 ]
Rank
Joined  2009-10-15
Total Posts:  17
New Member

Graphics 800,600,0,2
SetBuffer BackBuffer
()

Include 
"TUIO_BB_Include.bb"


rectimage CreateImage(200,200)
SetBuffer ImageBuffer(rectimage)
ClsColor 255,0,0
Cls
ClsColor 0
,0,0
SetBuffer BackBuffer
()

imgx# = 100
imgy# = 100

startTuioUDPServer

While Not KeyHit(1)
    
Cls
    recieveTuioUDP    
    DrawImage rectimage
,imgx#,imgy#        
    
For paket.container Each container
        Oval paket\x
#-5,paket\y#-5,10,10,1
        
If ImageRectOverlap (rectimage,imgx#,imgy#,paket\x#-5,paket\y#-5,10,10) Then  
            
If Not paket\active 1 Then        ; If "klicked"
                
dragged paket\ID%
                
diffX# = ((paket\x#-5)-imgX#)
                
diffY# = ((paket\y#-5)-imgY#)
                
Text 0,20,"Klick"
            
ElseIf paket\ID% = dragged Then        ; If "klicked" and drag
                
1 touchdrag
                Text 0
,20,"Drag"
                
imgX# = (paket\x#-5) - diffX#
                
imgY# = (paket\y#-5) - diffY#
            
Else                                  ; If dragged over
                Text 0
,20,"No, no, no, this won't move it!"                
            
EndIf            
        EndIf
    
Next

    Text 0
,0,ID_number
    

    Flip
Wend

endTuioUDPServer

End

Try this one… wink
But use it with just one touch, the check if there are two points dragging isn’t set in here. But it could be used for something like zooming or so.

miLORD

Profile
 
 
Posted: 27 October 2009 09:51 PM   [ Ignore ]   [ # 4 ]
Avatar
RankRank
Joined  2008-11-28
Total Posts:  122
Member

That does work....
nice little demo wink

Profile