Menüproblem

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

 

neun

Betreff: Menüproblem

BeitragMo, Dez 15, 2008 14:52
Antworten mit Zitat
Benutzer-Profile anzeigen
Zuerst der Code
Code: [AUSKLAPPEN]


;Der Button Type
Type button
   Field x,y
   Field modus
   Field xs,ys
End Type




hmenü()
End


Function hmenü()

SetFont schriftM
;Buttons erstellen
h.button=New button
   h\x=300
   h\y=200
   h\modus=0
   h\xs=200
h\ys=30

hb.button=New button
   hb\x=300
   hb\y=240
   hb\modus=0
   hb\xs=200
hb\ys=30


hc.button=New button
   hc\x=300
   hc\y=280
   hc\modus=0
   hc\xs=200
hc\ys=30



Repeat
mh=MouseHit(1)
Cls
;Buttons  triggern
For h.button=Each button
   Rect h\x,h\y,h\xs,h\ys,0
      If mh
               h\modus=1
            If h\modus=1
         submenü()
      EndIf
   EndIf
Next          

For hb.button=Each button
   Rect hb\x,hb\y,hb\xs,hb\ys,0
      If mh
                  hb\modus=1
         If hb\modus=1
      End
   EndIf
EndIf
Next          

For hc.button=Each button
   Rect hc\x,hc\y,hc\xs,hc\ys,0   
      If mh
               hc\modus=1
            If hc\modus=1
         End
      EndIf
   EndIf
Next          

      Text 355,200,"Spielen"
      Text 345,240,"Optionen"
      Text 370,280,"Ende"
            



DrawImage logo,230,0   
HidePointer
MidHandle cursorM
MaskImage cursorM,255,0,255
DrawImage cursorM,MouseX(),MouseY()      
   Flip
Until KeyHit(1)
End Function



Das Problem ist,dass nur die Funktion, die im ersten Button steht ausgeführt wird.

ozzi789

BeitragMo, Dez 15, 2008 15:05
Antworten mit Zitat
Benutzer-Profile anzeigen
Also bei mir wird die Funktion bei allen Buttons ausgeführt oO
Ach ja Hidepointer muss nur einmal gesetzt werden Wink
Code: [AUSKLAPPEN]


;Der Button Type
Type button
   Field x,y
   Field modus
   Field xs,ys
End Type




hmenü()
End


Function hmenü()

;Buttons erstellen
h.button=New button
   h\x=300
   h\y=200
   h\modus=0
   h\xs=200
h\ys=30

hb.button=New button
   hb\x=300
   hb\y=240
   hb\modus=0
   hb\xs=200
hb\ys=30


hc.button=New button
   hc\x=300
   hc\y=280
   hc\modus=0
   hc\xs=200
hc\ys=30



Repeat
mh=MouseHit(1)
Cls
;Buttons  triggern
For h.button=Each button
   Rect h\x,h\y,h\xs,h\ys,0
      If mh
               h\modus=1
            If h\modus=1
         submenü()
      EndIf
   EndIf
Next         

For hb.button=Each button
   Rect hb\x,hb\y,hb\xs,hb\ys,0
      If mh
                  hb\modus=1
         If hb\modus=1
      End
   EndIf
EndIf
Next         

For hc.button=Each button
   Rect hc\x,hc\y,hc\xs,hc\ys,0   
      If mh
               hc\modus=1
            If hc\modus=1
         End
      EndIf
   EndIf
Next         

      Text 355,200,"Spielen"
      Text 345,240,"Optionen"
      Text 370,280,"Ende"
           



ShowPointer
   Flip
Until KeyHit(1)
End Function

Function submenü()
Print "Tadaa"
Delay(2000)
end
End Function
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5
 

neun

BeitragMo, Dez 15, 2008 15:12
Antworten mit Zitat
Benutzer-Profile anzeigen
Liegt das vielleicht daran,dass ich noch ein menü verknüpft habe?

Code: [AUSKLAPPEN]

Type button
   Field x,y
   Field modus
   Field xs,ys
End Type


HidePointer

hmenü()
End


Function hmenü()

SetFont schriftM

h.button=New button
   h\x=300
   h\y=200
   h\modus=0
   h\xs=200
h\ys=30

hb.button=New button
   hb\x=300
   hb\y=240
   hb\modus=0
   hb\xs=200
hb\ys=30


hc.button=New button
   hc\x=300
   hc\y=280
   hc\modus=0
   hc\xs=200
hc\ys=30



Repeat
Cls
mh=MouseHit(1)
For h.button=Each button
   Rect h\x,h\y,h\xs,h\ys,0
      If mh=1
               h\modus=1
            If h\modus=1
         submenü()
      EndIf
   EndIf
Next          

For hb.button=Each button
   Rect hb\x,hb\y,hb\xs,hb\ys,0
      If mh
               hb\modus=1
            If hb\modus=1
         End
      EndIf
   EndIf
Next          

For hc.button=Each button
   Rect hc\x,hc\y,hc\xs,hc\ys,0   
      If mh
               hc\modus=1
            If hc\modus=1
         End
      EndIf
   EndIf
Next          

      Text 355,200,"Spielen"
      Text 345,240,"Optionen"
      Text 370,280,"Ende"
            



DrawImage logo,230,0   
HidePointer
MidHandle cursorM
MaskImage cursorM,255,0,255
DrawImage cursorM,MouseX(),MouseY()      
   Flip
Until KeyHit(1)
End Function



Function submenü()
      
      
SetFont schriftM

hs.button=New button
   hs\x=300
   hs\y=200
   hs\modus=0
   hs\xs=200
hs\ys=30

hsb.button=New button
   hsb\x=300
   hsb\y=240
   hsb\modus=0
   hsb\xs=200
hsb\ys=30


hsc.button=New button
   hsc\x=300
   hsc\y=280
   hsc\modus=0
   hsc\xs=200
hsc\ys=30

hsd.button=New button
   hsd\x=300
   hsd\y=320
   hsd\modus=0
   hsd\xs=200
hsd\ys=30

Repeat
mh=MouseHit(1)
Cls

For hs.button=Each button
   Rect hs\x,hs\y,hs\xs,hs\ys,0
      If mh
               hs\modus=1
            If hs\modus=1
         netzwerk()
      EndIf
   EndIf
Next          

For hsb.button=Each button
   Rect hsb\x,hsb\y,hsb\xs,hsb\ys,0
      If mh
               hsb\modus=1
            If hsb\modus=1
         netzwerk()
      EndIf
   EndIf
Next          

For hsc.button=Each button
   Rect hsc\x,hsc\y,hsc\xs,hsc\ys,0   
      If mh
               hsc\modus=1
            If hsc\modus=1
         terrmenü()
      EndIf
   EndIf
Next

For hsd.button=Each button
   Rect hsd\x,hsd\y,hsd\xs,hsd\ys,0   
      If mh
               hsd\modus=1
            If hsd\modus=1
           End
      EndIf
   EndIf
Next          


         


      Text 315,200,"Netzwerkspiel"
      Text 370,240,"LAN"
      Text 370,280,"BOTS"
      Text 370,320,"Ende"
            


mx=MouseX()
my=MouseY()            
         
DrawImage logo,230,0   
HidePointer
MidHandle cursorM
MaskImage cursorM,255,0,255
DrawImage cursorM,MouseX(),MouseY()      
   Flip
Until KeyHit(1)
End Function



In beide Menüs wird immer nur der Befehl des ersten Buttons asugeführt,auch bei allen anderen Buttons.

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group