Mausbedienung
Übersicht

junky |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ok - ihr wolltet es so haben 8)
Code: [AUSKLAPPEN] ; ======== MAUSFUNKTION ========>> ; normalerweise ist das en Include ; mousecontrol.bb ; dann kann man die Funktion in alle Programme einbinden ; ++++++++ ; BSP: ; mouse\hit[1] für linke Maustaste ; mouse\hit[2] für rechte Maustaste ; mouse\hit[3] für mittlere Maustaste Type mousetype Field hit[3] Field doppelhit[3] Field temp[3] Field released[3] Field down[3] Field ct[3] Field maxct End Type Global mouse.mousetype=New mousetype ; Reaktionszeit für Doppel-Klick mouse\maxct=20 Function mousecontrol() For a=1 To 3 If mouse\ct[a]>0 Then mouse\ct[a]=mouse\ct[a]-1 If MouseDown(a) If mouse\temp[a]=1 Then mouse\down[a]=1 If mouse\temp[a]=0 mouse\hit[a]=1 If mouse\ct[a]=0 mouse\ct[a]=mouse\maxct Else mouse\doppelhit[a]=1 mouse\ct[a]=0 EndIf Else mouse\doppelhit[a]=0 mouse\hit[a]=0 EndIf mouse\temp[a]=1 Else mouse\released[a]=0 If mouse\down[a]=1 Then mouse\released[a]=1 mouse\hit[a]=0 mouse\down[a]=0 mouse\temp[a]=0 EndIf Next End Function ; <<================ ; ======== PROGRAMMBEGINN ========>> Graphics 640,480,32,1 Dim click(4) Global buttonwidth=100 ; ======== IMAGES ========>> image=CreateImage(buttonwidth,40,2) SetBuffer ImageBuffer(image,0) Color 0,0,200 Rect 0,0,buttonwidth,40,1 SetBuffer ImageBuffer(image,1) Color 0,0,200 Rect 0,0,buttonwidth,40,0 mousepointer=CreateImage(2,2) SetBuffer ImageBuffer(mousepointer) Color 200,200,200 Rect 0,0,2,2,0 ; <<======== ; ======== HAUPT-SCHLEIFE ========>> Color 255,255,255 SetBuffer BackBuffer() Repeat ; ==== FPS-Counter ====>> syszeit=MilliSecs() If syszeit>fpszeit+1000 fps=fpsct : fpszeit=syszeit : fpsct=0 Else fpsct=fpsct+1 EndIf ; <<==== mx=MouseX() my=MouseY() mousecontrol() ; alle Überprüfungen sind mit linker Maustaste mt=1 ; mt=2 für rechte ; mt=3 für mittlere a=1 If ImageRectOverlap(image,a*buttonwidth,200,mx,my,2,2) If mouse\hit[mt] click(a)=click(a) Xor 1 EndIf EndIf a=2 If ImageRectOverlap(image,a*buttonwidth,200,mx,my,2,2) If mouse\down[mt] click(a)=1 Else click(a)=0 EndIf EndIf a=3 If ImageRectOverlap(image,a*buttonwidth,200,mx,my,2,2) If mouse\released[mt] click(a)=click(a) Xor 1 EndIf EndIf a=4 If ImageRectOverlap(image,a*buttonwidth,200,mx,my,2,2) If mouse\doppelhit[mt] click(a)=click(a) Xor 1 EndIf EndIf Cls Text 0,0,"FPS: "+fps+" ESC zum beenden drücken" For a=1 To 4 If click(a)=1 DrawBlock image,a*buttonwidth,200,0 Else DrawBlock image,a*buttonwidth,200,1 EndIf Next Text 1*buttonwidth,200,"geklickt" Text 2*buttonwidth,200,"gehalten" Text 3*buttonwidth,200,"losgelassen" Text 4*buttonwidth,200,"Doppel-Klick" DrawBlock mousepointer,mx,my Flip 1 Until KeyHit(1) End ; <<================ falls euch noch irgendwelche Fragen quälen, könnt ihr euch ruhig an mich wenden |
||
gestern stand ich noch vorm Abgrund
heute bin ich einen Schritt weiter... |
Gandalf13 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
könnte bitte einer von euch mir einen vollständigen Quelltext mit mausbedienung u. menü inclusive buttons!? ![]() bitte 8) bitte ![]() mfg gandalf |
||
![]() |
Flori-D |
![]() Antworten mit Zitat ![]() |
---|---|---|
Also son Richtigkommplttes Menü? | ||
BB is Macht!
Homepage: www.flori-d.de |
Gandalf13 |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ja !!! ![]() ![]() |
||
![]() |
Julz |
![]() Antworten mit Zitat ![]() |
---|---|---|
Also erst ma was grundsätzliches du bedienst die maus aber auf dem bildschirm steuert man sie und bedient sie nicht 8) | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group