Ich hab jetzt ein IsScreenActive() eingebaut damit er nicht mehr drawt wenns Fenster minimized ist (taskmgr open),hab eine Größere Maus eingebaut und hab das FlipBuffers hinter das StopDrawing gesetzt jetzt bleibt er wenigstens nicht mehr komplett hängen und lässt sich auch wenn die Wins hängen mit Escape beenden. Aber hinter das Problem warum die Wins auf der Rechten Seite "unantastbar" sind bin ich immer noch nicht gekommen.
Code: Alles auswählen
Declare InitWindows()
Declare WindowMGR()
Declare PaintWindows()
#ScreenWidth = 1024
#ScreenHeight = 768
#ScreenName = "PB Windows in Screen"
InitSprite()
InitKeyboard()
InitMouse()
OpenScreen(#ScreenWidth,#ScreenHeight,32,#ScreenName)
Delay(700)
InitWindows()
Structure Window
x.l
y.l
Width.l
Height.l
Schatten.l
Title$
InWindowColor.l
WindowTitleColor.l
ShadowColor.l
TitleTextColorR.l
TitleTextColorG.l
TitleTextColorB.l
Hidden.l
WindowExists.l
EndStructure
Dim Windows.Window(100)
Global ForeGroundWindowID
Global *Thread
Global MouseX
Global MouseY
Procedure WindowMGR()
Protected WindowID
Protected x
Protected y
Protected Width
Protected Height
Repeat
If IsScreenActive()
ExamineMouse()
;Check Mouse in Screen
MouseX=MouseX()
MouseY=MouseY()
If MouseX>#ScreenWidth
MouseX-2
EndIf
If MouseY>#ScreenHeight
MouseY-2
EndIf
If MouseX<1
MouseX+2
EndIf
If MouseY<1
MouseY+2
EndIf
;::::::::Start WindowEventTask::::::::
;::::::::Check WindowMove
If MouseButton(1)>0
For WindowID=0 To 100
x=Windows(WindowID)\x
y=Windows(WindowID)\y
Width=Windows(WindowID)\Width
Height=Windows(WindowID)\Height
;If WindowID=0 Or WindowID=1
;Debug x: Debug y: Debug Width: Debug Height
;EndIf
If MouseX>=x And MouseY>=y And MouseX<=x+Width And MouseX<=y+Height
ForeGroundWindowID=WindowID
Repeat
ExamineMouse()
Windows(WindowID)\x+MouseDeltaX()
Windows(WindowID)\y+MouseDeltaY()
If MouseButton(1)=0
Exit=1
EndIf
If Exit=0
MouseX+MouseDeltaX()
MouseY+MouseDeltaY()
;Check Mouse in Screen
If MouseX>#ScreenWidth
MouseX=#ScreenWidth-2
EndIf
If MouseY>#ScreenHeight
MouseY=#ScreenHeight-2
EndIf
If MouseX<1
MouseX=2
EndIf
If MouseY<1
MouseY=2
EndIf
PaintWindows()
FlipBuffers()
EndIf
Delay(4)
Until Exit =1
EndIf
If Exit=1
Break
EndIf
Next
EndIf
Exit=0
;::::::::End WindowEventTask::::::::
PaintWindows()
Delay(20)
EndIf
FlipBuffers()
ForEver
EndProcedure
Procedure InitWindows()
*Thread=CreateThread(@WindowMGR(),0)
EndProcedure
Procedure DeactivateWindows()
KillThread(*Thread)
EndProcedure
Procedure OpenScreenWindow(WindowID,x,y,Width,Height,Schatten,Title$,InWindowColor,WindowTitleColor,ShadowColor,TitleTextColorR,TitleTextColorG,TitleTextColorB,Hidden)
Protected WindowID
Windows(WindowID)\x=x
Windows(WindowID)\y=y
Windows(WindowID)\Width=Width
Windows(WindowID)\Height=Height
Windows(WindowID)\Schatten=Schatten
Windows(WindowID)\Title$=Title$
Windows(WindowID)\InWindowColor=InWindowColor
Windows(WindowID)\WindowTitleColor=WindowTitleColor
Windows(WindowID)\ShadowColor=ShadowColor
Windows(WindowID)\TitleTextColorR=TitleTextColorR
Windows(WindowID)\TitleTextColorG=TitleTextColorG
Windows(WindowID)\TitleTextColorB=TitleTextColorB
Windows(WindowID)\Hidden=Hidden
Windows(WindowID)\WindowExists=1
EndProcedure
Procedure CloseScreenWindow(WindowID)
Protected WindowID
Windows(WindowID)\WindowExists=0
EndProcedure
Procedure HideScreenWindow(WindowID,Hidden)
Protected WindowID
Windows(WindowID)\Hidden=Hidden
EndProcedure
Procedure PaintWindow(WindowID)
Protected WindowID
x=Windows(WindowID)\x
y=Windows(WindowID)\y
Width=Windows(WindowID)\Width
Height=Windows(WindowID)\Height
Schatten=Windows(WindowID)\Schatten
Title$=Windows(WindowID)\Title$
InWindowColor=Windows(WindowID)\InWindowColor
WindowTitleColor=Windows(WindowID)\WindowTitleColor
ShadowColor=Windows(WindowID)\ShadowColor
TitleTextColorR=Windows(WindowID)\TitleTextColorR
TitleTextColorG=Windows(WindowID)\TitleTextColorG
TitleTextColorB=Windows(WindowID)\TitleTextColorB
Hidden=Windows(WindowID)\Hidden
WindowExists=Windows(WindowID)\WindowExists
If WindowExists=1
If Schatten=1
Box(x+5,y+5,Width,Height,ShadowColor);Schatten.
EndIf
Box(x,y,Width,Height,InWindowColor) ;FensterInneres
Box(x,y,Width,22,WindowTitleColor) ;TitelLeiste
Line(x ,y,Width, 0,$FFFFFF):Line(x,y , 0,height,$FFFFFF)
Line(x+Width,y, 0,Height,$000000):Line(x,y+height,Width, 0,$000000)
Locate(x+2,y+2) ;Springe zu FensterTitel
DrawingMode(1)
FrontColor(TitleTextColorR, TitleTextColorG, TitleTextColorB)
DrawText(Title$)
EndIf
EndProcedure
Procedure PaintWindows()
Protected WindowID
StartDrawing(ScreenOutput())
Box(0,0,#ScreenWidth,#ScreenHeight)
For WindowID=0 To 100
If WindowID<>ForeGroundWindowID
PaintWindow(WindowID)
EndIf
Next
If ForeGroundWindowID <> -1
WindowID=ForeGroundWindowID
PaintWindow(WindowID)
EndIf
FrontColor(255,0,0)
Circle(MouseX,MouseY,5)
StopDrawing()
EndProcedure
Procedure ActivateScreenWindow(WindowID)
Protected WindowID
ForeGroundWindowID=WindowID
EndProcedure
Procedure MoveScreenWindow(WindowID,x,y)
Protected WindowID
Windows(WindowID)\x=x
Windows(WindowID)\y=y
EndProcedure
OpenScreenWindow(0,200,455,300,200,0,"Window1",$c0c0c0,$ff0000,$404040,255,255,255,0)
OpenScreenWindow(1,100,100,300,500,0,"Window2",$c0c0c0,$ff0000,$404040,255,255,255,0)
Repeat
ExamineKeyboard()
Delay(4)
Until KeyboardPushed(#PB_Key_Escape)
DeactivateWindows()
End