| Ja ich weiß ich bin ne Nervensäge <.< hab wieder ein Problem und zwar erstelle ich mir gerade ein Mapeditor
 und will die Map auch scrollen können klappt auch aber irgendwie stimmen die Koordinaten der Maus nicht er zeichnet das Tile immer an einer anderen stelle hier mal der code:
 
 (mit Gui_engine aus Codebereich)
 
 
 editor:
 BlitzBasic:  [AUSKLAPPEN]  [EINKLAPPEN]
 
 Graphics(1024, 768, 16, 1)
 Include \"gui_funktion.bb\"
 
 
 
 
 
 Global x,y,mx,my,mapx,mapy,tile = 1, endung$=\".map\", map_width, map_height,tileset_laden$
 
 map_width=Input (\"geben sie die Breite an \")
 map_height=Input (\"geben sie die Höhe an \")
 tileset_laden$=Input (\"name des Tileset \")
 
 Tileset = LoadAnimImage(\"tiles/\"+tileset_laden$,16,16,0,480)
 
 
 Dim map (map_width, map_height)
 
 
 
 
 
 
 
 
 
 
 Win3.GUI_Window = GUI_WindowCreate(\"Option\", 4, 0, 150, 150)
 
 But1.GUI_Button = GUI_ButtonCreate(Win3, \"Neu\", 22, 30, 100, 20)
 But2.GUI_Button = GUI_ButtonCreate(Win3, \"Speichern\", 22, 60, 100, 20)
 But3.GUI_Button = GUI_ButtonCreate(Win3, \"Laden\", 22, 90, 100, 20)
 But4.GUI_Button = GUI_ButtonCreate(Win3, \"Ende\", 22, 120, 100, 20)
 
 
 Win2.GUI_Window = GUI_WindowCreate(\"Map Fenster\", 160, 0, 750, 550)
 Win3.GUI_Window = GUI_WindowCreate(\"Info Fenster\", 4, 150, 150, 130)
 Win4.GUI_Window = GUI_WindowCreate(\"Tilefenster\", 160, 550, 750, 200)
 
 
 While(KeyHit(1) = False)
 
 
 GUI_MousePosX =MouseX()+scrollx
 GUI_MousePosY =MouseY()+scrolly
 
 
 
 
 
 
 If KeyDown(2) Then tile = 1
 If KeyDown(3) Then tile = 2
 If KeyDown(4) Then tile = 3
 If KeyDown(5) Then tile = 4
 If KeyDown(7) Then tile = 5
 If KeyDown(8) Then tile = 6
 If KeyDown(9) Then tile = 7
 If KeyDown(10) Then tile = 8
 If KeyDown(11) Then tile = 9
 If KeyDown(12) Then tile = 10
 If KeyDown(13) Then tile = 11
 If KeyDown(14) Then tile = 12
 If KeyDown(15) Then tile = 13
 If KeyDown(16) Then tile = 14
 If KeyDown(17) Then tile = 15
 If KeyDown(18) Then tile = 16
 
 
 
 
 
 
 SetBuffer (ImageBuffer(Win2\Buffer))
 Cls
 
 For x = 0 To map_width
 For y = 0 To map_height
 DrawImage Tileset,x*16+scrollx,y*16+scrolly,map(x,y)
 Next
 Next
 
 If MouseHit(1) Then
 mapx = (GUI_MousePosX)/16
 mapy = (GUI_MousePosY)/16
 For x = 0 To map_width
 For y = 0 To map_height
 If RectsOverlap(x*16-scrollx,y*16-scrolly,16,16,MouseX(),MouseY(),1,1) Then
 map(x,y)=tile
 End If
 Next
 Next
 End If
 
 
 If KeyHit(208) Then scrolly = scrolly + 16
 If KeyHit(200) Then scrolly = scrolly - 16
 If KeyHit(205) Then scrollx = scrollx + 16
 If KeyHit(203) Then scrollx = scrollx - 16
 
 SetBuffer (ImageBuffer(Win3\Buffer))
 Cls
 
 Text 3,20,\"Maphöhe:\"
 Text 80,20,map_height
 Text 3,40,\"Mapbreite:\"
 Text 80,40,map_width
 Text 3,60,\"Tileset:\"
 Text 3,70, tileset_laden$
 Text 3,90,\"Maus X:\"
 Text 80,90,GUI_MousePosX
 Text 3,110,\"Maus Y:\"
 Text 80,110,GUI_MousePosY
 
 
 If(But1\Status)
 EndIf
 
 If(But2\Status)
 EndIf
 
 If(But3\Status)
 EndIf
 
 If(But4\Status) End
 
 SetBuffer(BackBuffer())
 ClsColor(0, 0, 0)
 Cls()
 
 GUI_Update()
 
 DrawImage maus, GUI_MousePosX,GUI_MousePosY
 Flip(True)
 
 Wend
 
 
 gui_funktion:
 BlitzBasic:  [AUSKLAPPEN]  [EINKLAPPEN]
 maus=LoadImage(\"data/maus.bmp\")
 
 Global GUI_MousePosX, GUI_MousePosY
 Global GUI_MouseKey1, GUI_MouseKey2
 
 Function GUI_MouseUpdate()
 GUI_MousePosX = MouseX()
 GUI_MousePosY = MouseY()
 
 GUI_MouseKey1 = MouseHit(1)
 GUI_MouseKey2 = MouseHit(2)
 SetBuffer(BackBuffer())
 
 End Function
 
 
 
 Global FONT_HeadLine = LoadFont(\"Trebuchet MS\", 17, 1, 0, 0)
 
 
 Type GUI_Window
 Field Name$
 Field PosX, PosY
 Field SizeX, SizeY
 Field Buffer, WinMask
 End Type
 Global GUI_W.GUI_Window
 Global GUI_LastWindow.GUI_Window
 
 Global GUI_WindowDropX, GUI_WindowDropY, GUI_WindowDrop
 
 Function GUI_WindowCreate.GUI_Window(Name$, PosX, PosY, SizeX, SizeY)
 GUI_W = New GUI_Window
 GUI_W\Name = Name
 GUI_W\PosX = PosX
 GUI_W\PosY = PosY
 GUI_W\SizeX = SizeX
 GUI_W\SizeY = SizeY
 
 GUI_W\Buffer = CreateImage(SizeX, SizeY)
 GUI_W\WinMask = CreateImage(SizeX, SizeY)
 
 MaskImage(GUI_W\WinMask, 255, 0, 128)
 
 SetBuffer(ImageBuffer(GUI_W\WinMask))
 ClsColor(255, 0, 128)
 Cls
 
 Color(20, 20, 20)
 Rect(0, 0, SizeX, 20, 1)
 Color(255, 255, 255)
 Rect(0, 0, SizeX, SizeY, 0)
 Rect(0, 0, SizeX, 20, 0)
 
 SetFont(FONT_HeadLine)
 Text(5, 2, Name)
 
 Return(GUI_W)
 End Function
 
 Function GUI_WindowUpdate()
 GUI_LastWindow = Null
 
 For GUI_W = Each GUI_Window
 DrawBlock(GUI_W\Buffer, GUI_W\PosX, GUI_W\PosY)
 DrawImage(GUI_W\WinMask, GUI_W\PosX, GUI_W\PosY)
 
 If(GUI_MouseKey1)
 If(RectsOverlap(GUI_MousePosX, GUI_MousePosY, 1, 1, GUI_W\PosX, GUI_W\PosY, GUI_W\SizeX, GUI_W\SizeY))
 GUI_LastWindow = GUI_W
 EndIf
 EndIf
 Next
 
 If(GUI_LastWindow <> Null) Insert GUI_LastWindow After Last GUI_Window
 
 GUI_W = Last GUI_Window
 If(GUI_MouseKey1)
 If(RectsOverlap(GUI_MousePosX, GUI_MousePosY, 1, 1, GUI_W\PosX, GUI_W\PosY, GUI_W\SizeX, 20))
 GUI_WindowDropX = GUI_MousePosX - GUI_W\PosX
 GUI_WindowDropY = GUI_MousePosY - GUI_W\PosY
 GUI_WindowDrop = True
 EndIf
 EndIf
 
 If(MouseDown(1))
 If(GUI_WindowDrop = True)
 GUI_W\PosX = GUI_MousePosX - GUI_WindowDropX
 GUI_W\PosY = GUI_MousePosY - GUI_WindowDropY
 EndIf
 Else
 GUI_WindowDrop = False
 EndIf
 End Function
 
 
 Type GUI_Button
 Field Window.GUI_Window
 Field Status
 Field Name$
 Field PosX, PosY
 Field SizeX, SizeY
 Field Image
 End Type
 Global GUI_B.GUI_Button
 
 Function GUI_ButtonCreate.GUI_Button(Window.GUI_Window, Name$, PosX, PosY, SizeX, SizeY)
 GUI_B = New GUI_Button
 GUI_B\Window = Window
 GUI_B\Name = Name
 GUI_B\PosX = PosX
 GUI_B\PosY = PosY
 GUI_B\SizeX = SizeX
 GUI_B\SizeY = SizeY
 
 GUI_B\Image = CreateImage(SizeX, SizeY, 2)
 
 SetBuffer(ImageBuffer(GUI_B\Image, 0))
 Color(0, 0, 0)
 Rect(0, 0, SizeX, SizeY, 1)
 Color(255, 255, 255)
 Rect(0, 0, SizeX, SizeY, 0)
 Text(SizeX / 2 - StringWidth(Name) / 2, SizeY / 2 - StringHeight(Name) / 2, Name)
 
 SetBuffer(ImageBuffer(GUI_B\Image, 1))
 Color(20, 20, 20)
 Rect(0, 0, SizeX, SizeY, 1)
 Color(255, 255, 255)
 Rect(0, 0, SizeX, SizeY, 0)
 Text(SizeX / 2 - StringWidth(Name) / 2, SizeY / 2 - StringHeight(Name) / 2, Name)
 
 Return(GUI_B)
 End Function
 
 Function GUI_ButtonUpdate()
 For GUI_B = Each GUI_Button
 Frame = 0
 If(GUI_B\Window = Last GUI_Window)
 Frame = 0
 
 GUI_B\Status = False
 If(RectsOverlap(GUI_MousePosX, GUI_MousePosY, 1, 1, GUI_B\PosX + GUI_B\Window\PosX, GUI_B\PosY + GUI_B\Window\PosY, GUI_B\SizeX, GUI_B\SizeY))
 Frame = 1
 If(GUI_MouseKey1) GUI_B\Status = True
 EndIf
 EndIf
 
 SetBuffer(ImageBuffer(GUI_B\Window\Buffer))
 DrawBlock(GUI_B\Image, GUI_B\PosX, GUI_B\PosY, Frame)
 Next
 End Function
 
 
 
 
 
 Function GUI_Update()
 GUI_WindowUpdate()
 GUI_ButtonUpdate()
 GUI_MouseUpdate()
 
 End Function
 
 Ja ich weiß mein Coding ist nicht das beste <.<
 mfg
 et
 |