Also ich probier grad das WindowedScreen Beispiel aus und erweitere das um mein eigenes zusätzliches Fenster! Sieht dann so aus:
Code: Alles auswählen
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitMouse() = 0
MessageRequester("Error", "Can't open the sprite system", 0)
End
EndIf
Enumeration
#frMain
EndEnumeration
Global DCMain.l = 0
If OpenWindow(#frMain, 0, 0, 1024, 768, "Gadget and sprites!", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
DCMain = WindowID(#frMain)
ButtonGadget(1, 10, 10, 100, 25, "Grab input")
ButtonGadget(2, 120, 10, 100, 25, "Button 2")
ButtonGadget(3, 230, 10, 100, 25, "Button 3")
TextGadget (4, 10, 40, 300, 30, "Press 'F1' to ungrab keyboard and mouse")
If OpenWindowedScreen(WindowID(#frMain), 10, 70, 800, 600, 0, 0, 0)
LoadSprite(0, "images/back.bmp")
Else
MessageRequester("Error", "Can't open windowed screen!", 0)
End
EndIf
EndIf
ReleaseMouse(#True)
direction = 1
playerX = 1
playerY = 1
IncludeFile "frLogIN.pb"
Repeat
Repeat
; Always process all the events to flush the queue at every frame
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
; Do the normal application management here
Gadget = EventGadget()
Select Gadget
Case 1
InputReleased = 0
ReleaseMouse(#False)
SetGadgetText(4, "Press 'F1' to ungrab keyboard and mouse")
Case 2
Open_frLogIN()
Case 3
SetGadgetText(4, "Button "+Str(Gadget)+" pressed.")
EndSelect
EndSelect
Until Event = 0 ; Quit the event loop only when no more events are available
If InputReleased = 0
ExamineMouse()
; do the sprite & screen management at every frame
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Up) And playerY > 0 : playerY -3 : EndIf
If KeyboardPushed(#PB_Key_Down) And playerY < 280 : playerY +3 : EndIf
If KeyboardPushed(#PB_Key_Left) And playerX > 0 : playerX -3 : EndIf
If KeyboardPushed(#PB_Key_Right) And playerX < 300 : playerX +3 : EndIf
If KeyboardPushed(#PB_Key_F1)
ReleaseMouse(#True)
InputReleased = 1
EndIf
EndIf
; Clear the screen and draw our sprites
ClearScreen(RGB(0,0,0))
ClipSprite(0, 0, 0, x, x/8)
DisplaySprite(0, x, 100)
DisplaySprite(0, x, x)
DisplaySprite(0, 300-x, x)
DisplaySprite(0, playerX, playerY)
x + direction
If x > 300 : direction = -1 : EndIf ; moving back to the left with negative value
If x < 0 : direction = 1 : EndIf ; moving to the right with positive value
FlipBuffers() ; Inverse the buffers (the back become the front (visible)... and we can do the rendering on the back
Until Quit Or KeyboardPushed(#PB_Key_Escape)
Code: Alles auswählen
Enumeration
#frLogin
EndEnumeration
Enumeration
#background
EndEnumeration
;- Gadget Constants
;
Enumeration
#frLogin_btn0
#frLogin_btn1
#frLogin_btn2
#frLogin_btn3
#frLogin_btn4
#frLogin_btn5
#frLogin_btn6
#frLogin_btn7
#frLogin_btn8
#frLogin_btn9
#frLogin_btnPkt
#frLogin_btnDel
#frLogin_btnEnter
#frLogin_UserName
#frLogin_Pin
#frLogin_Frame
#frLogin_txtBenutzer
#frLogin_txtPin
EndEnumeration
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Arial", 18, #PB_Font_Bold)
Global frLoginFocus.b = 1
Procedure Open_frLogIN()
DisableWindow(#frMain,1)
If OpenWindow(#frLogin, 343, 30, 600, 570, "LogIn", #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered, WindowID(#frMain) )
If CreateGadgetList(WindowID(#frLogin))
SetActiveWindow(#frLogin)
StringGadget(#frLogin_UserName, 130, 60, 300, 50, "")
SetGadgetFont(#frLogin_UserName, FontID1)
Frame3DGadget(#frLogin_Frame, 110, 20, 340, 490, "")
StringGadget(#frLogin_Pin, 130, 140, 300, 50, "", #PB_String_Password)
SetGadgetFont(#frLogin_Pin, FontID1)
ButtonGadget(#frLogin_btn7, 130, 200, 60, 50, "7")
SetGadgetFont(#frLogin_btn7, FontID1)
ButtonGadget(#frLogin_btn8, 200, 200, 60, 50, "8")
SetGadgetFont(#frLogin_btn8, FontID1)
ButtonGadget(#frLogin_btn9, 270, 200, 60, 50, "9")
SetGadgetFont(#frLogin_btn9, FontID1)
ButtonGadget(#frLogin_btn4, 130, 260, 60, 50, "4")
SetGadgetFont(#frLogin_btn4, FontID1)
ButtonGadget(#frLogin_btn5, 200, 260, 60, 50, "5")
SetGadgetFont(#frLogin_btn5, FontID1)
ButtonGadget(#frLogin_btn6, 270, 260, 60, 50, "6")
SetGadgetFont(#frLogin_btn6, FontID1)
ButtonGadget(#frLogin_btn1, 130, 320, 60, 50, "1")
SetGadgetFont(#frLogin_btn1, FontID1)
ButtonGadget(#frLogin_btn2, 200, 320, 60, 50, "2")
SetGadgetFont(#frLogin_btn2, FontID1)
ButtonGadget(#frLogin_btn3, 270, 320, 60, 50, "3")
SetGadgetFont(#frLogin_btn3, FontID1)
ButtonGadget(#frLogin_btn0, 130, 380, 60, 50, "0")
SetGadgetFont(#frLogin_btn0, FontID1)
ButtonGadget(#frLogin_btnEnter, 340, 200, 90, 290, "Enter")
SetGadgetFont(#frLogin_btnEnter, FontID1)
TextGadget(#frLogin_txtBenutzer, 130, 40, 100, 20, "Benutzer:")
TextGadget(#frLogin_txtPin, 130, 120, 100, 20, "Pin:")
ButtonGadget(#frLogin_btnDel, 130, 440, 200, 50, "Löschen")
SetGadgetFont(#frLogin_btnDel, FontID1)
ButtonGadget(#frLogin_btnPkt, 270, 380, 60, 50, ".")
SetGadgetFont(#frLogin_btnPkt, FontID1)
SetActiveGadget(#frLogin_UserName)
EndIf
EndIf
EndProcedure
". Aber warum???? Mit "DisableWindow(#frMain,1)" wird doch nur das Hauptfenster disabled und ich öffne ein neues??!?!?
Sorry für die blöden Fragen!
Gruss
Markus