Aktueller Code:
Code: Alles auswählen
;00005
Procedure Startbedingungen()
Structure Key
Zeichen.s
Code.l
EndStructure
Global NewList Key.Key()
EndProcedure
Procedure AddKey(Zeichen.s, Code.l)
AddElement(Key())
Key()\Zeichen = Zeichen
Key()\Code = Code
EndProcedure
Procedure InitKeys()
;Buchstaben von a bis z
AddKey("a", #PB_Key_A)
AddKey("b", #PB_Key_B)
AddKey("c", #PB_Key_C)
AddKey("d", #PB_Key_D)
AddKey("e", #PB_Key_E)
AddKey("f", #PB_Key_F)
AddKey("g", #PB_Key_G)
AddKey("h", #PB_Key_H)
AddKey("i", #PB_Key_I)
AddKey("j", #PB_Key_J)
AddKey("k", #PB_Key_K)
AddKey("l", #PB_Key_L)
AddKey("m", #PB_Key_M)
AddKey("n", #PB_Key_N)
AddKey("o", #PB_Key_O)
AddKey("p", #PB_Key_P)
AddKey("q", #PB_Key_Q)
AddKey("r", #PB_Key_R)
AddKey("s", #PB_Key_S)
AddKey("t", #PB_Key_T)
AddKey("u", #PB_Key_U)
AddKey("v", #PB_Key_V)
AddKey("w", #PB_Key_W)
AddKey("x", #PB_Key_X)
AddKey("y", #PB_Key_Y)
AddKey("z", #PB_Key_Z)
;Zahlen von 1 bis 0
AddKey("1", #PB_Key_1)
AddKey("2", #PB_Key_2)
AddKey("3", #PB_Key_3)
AddKey("4", #PB_Key_4)
AddKey("5", #PB_Key_5)
AddKey("6", #PB_Key_6)
AddKey("7", #PB_Key_7)
AddKey("8", #PB_Key_8)
AddKey("9", #PB_Key_9)
AddKey("0", #PB_Key_0)
;Sonderzeichen
AddKey(" ", #PB_Key_Space)
EndProcedure
Procedure Initialisierung()
InitMouse()
InitSprite()
InitKeyboard()
InitSound()
SetRefreshRate(75)
UseJPEGImageDecoder()
UseOGGSoundDecoder()
EndProcedure
Procedure Resourcen_laden()
LoadSound(00001, "data\m00001.ogg")
PlaySound(00001,1)
LoadSound(00002, "data\mouseover.wav")
LoadSound(00003, "data\mouseclick.wav")
LoadFont (0, "Arial", 8)
LoadImage(1,"data\00001.jpg")
LoadSprite(1, "data\mouse.bmp")
LoadSprite(2,"data\00002.bmp") ;verbinden
LoadSprite(6,"data\00006.bmp") ;rahmen
EndProcedure
Procedure Fenster_zeichnen()
OpenWindow(00002,1,1,640,480,"Optionen",#PB_Window_ScreenCentered|#PB_Window_Invisible)
CreateGadgetList(WindowID(00002))
ButtonGadget(00004,540,450,80,18,"Speichern")
HideWindow(00002,1)
OpenWindow(00003,1,1,640,480,"Updates",#PB_Window_ScreenCentered|#PB_Window_Invisible)
CreateGadgetList(WindowID(00003))
ButtonGadget(00005,540,450,80,18,"Speichern")
HideWindow(00003,1)
OpenWindow(00001, 0, 0, 800, 400, "(H)iveworx (C)lient (E)ngine", #PB_Window_ScreenCentered|#PB_Window_BorderLess)
CreateGadgetList(WindowID(00001))
OpenWindowedScreen(WindowID(00001),1,1,800,400,0,0,0)
EndProcedure
Procedure.s GetKeyboardReleasedKey()
ResetList(Key())
Shift.l = #False
While NextElement(Key())
If KeyboardReleased(Key()\Code)
If KeyboardPushed(#PB_Key_LeftShift) Or KeyboardPushed(#PB_Key_RightShift)
Shift = #True
Zeichen.s = UCase(Key()\Zeichen)
Else
If Shift = #False : Zeichen.s = Key()\Zeichen : EndIf
EndIf
EndIf
Wend
ProcedureReturn Zeichen
EndProcedure
Procedure Mainloop()
Repeat
Event = WindowEvent()
ExamineKeyboard()
ExamineMouse()
StartDrawing(ScreenOutput())
DrawingMode(1)
DrawImage(ImageID(1), 0, 0)
FrontColor(RGB(200,200,200))
DrawingFont(FontID(0))
;DrawText(10,10,""+Str(MouseX())) ;Debug Mouseoutput für X Koordinate
;DrawText(50,10,""+Str(MouseY())) ;Debug Mouseoutput für y Koordinate
StopDrawing()
; Over Events
If MouseX() > 597 And MouseX() < 740 And MouseY() > 366 And MouseY() < 385 ;Beenden Button
If OverEND = 0
PlaySound(00002,0)
OverEND = 1
EndIf
TransparentSpriteColor(2, RGB(255,0,255))
DisplayTransparentSprite(2, 594, 365)
Else
OverEND =0
EndIf
If MouseX() > 597 And MouseX() < 740 And MouseY() > 316 And MouseY() < 333 ;Verbinden Button
If OverCON = 0
PlaySound(00002,0)
OverCON = 1
EndIf
TransparentSpriteColor(2, RGB(255,0,255))
DisplayTransparentSprite(2, 594, 315)
Else
OverCON =0
EndIf
If MouseX() > 257 And MouseX() < 742 And MouseY() > 245 And MouseY() < 270 ;Username Feld
If OverUSR = 0
PlaySound(00002,0)
OverUSR = 1
EndIf
TransparentSpriteColor(6, RGB(255,0,255))
DisplayTransparentSprite(6, 253, 240)
Else
OverUSR=0
EndIf
If MouseX() > 257 And MouseX() < 742 And MouseY() > 280 And MouseY() < 303 ;Password Feld
If OverPWD = 0
PlaySound(00002,0)
OverPWD = 1
EndIf
TransparentSpriteColor(6, RGB(255,0,255))
DisplayTransparentSprite(6, 253, 276)
Else
OverPWD = 0
EndIf
; Klick Events
If MouseX() > 597 And MouseX() < 740 And MouseY() > 366 And MouseY() < 385 And MouseButton(1) ;Beenden Button
If KlickEND = 0
PlaySound(00003,0)
KlickEND = 1
EndIf
Delay(300 )
End
Else
KlickEND = 0
EndIf
If MouseX() > 597 And MouseX() < 740 And MouseY() > 316 And MouseY() < 333 And MouseButton(1) ;Verbinden Button
If KlickCON = 0
PlaySound(00003,0)
KlickCON = 1
EndIf
Else
KlickCON=0
EndIf
If MouseX() > 257 And MouseX() < 742 And MouseY() > 245 And MouseY() < 270 And MouseButton(1) ;Username Feld
If KlickUSR = 0
PlaySound(00003,0)
KlickUSR =1
EndIf
Else
KlickUSR =0
EndIf
If MouseX() > 257 And MouseX() < 742 And MouseY() > 280 And MouseY() < 303 And MouseButton(1) ;Password Feld
If KlickPAS =0
PlaySound(00003,0)
KlickPAS =1
EndIf
Else
KlickPAS=0
EndIf
TransparentSpriteColor(1, RGB(0,255,0))
DisplayTransparentSprite(1, MouseX(), MouseY())
FlipBuffers(0)
Until KeyboardPushed(#PB_Key_Escape)
CloseScreen()
End
EndProcedure
Startbedingungen()
InitKeys()
Initialisierung()
Fenster_zeichnen()
Resourcen_laden()
Mainloop()