Versuch noch mal anders ich habe ein bild das 500x500 pixel hat.
Mittelpunkt ist jetzt 250x250 wenn ich jetzt z.b. mit der maus ins bild klicke möchte ich das von dort aus der kreis gezeichnet wir in bezug auf den Mittelpunkt(radius)!
Ich habe hier schon etwas versucht aber klappt nicht so wie ich will vielleicht kann jemand helfen:
Code: Alles auswählen
Global teiler.l,Image0
teiler=360/12
Enumeration
#Window_0
EndEnumeration
Enumeration
#Image_0
EndEnumeration
Image0 = CreateImage(0,500,500)
StartDrawing(ImageOutput(0))
Box(0,0,500,500,RGB(255,255,255))
StopDrawing()
Procedure GetMouseX(Gadget)
GetCursorPos_(mouse.POINT)
MapWindowPoints_(0,GadgetID(Gadget),mouse,1)
ProcedureReturn mouse\x
EndProcedure
Procedure GetMouseY(Gadget)
GetCursorPos_(mouse.POINT)
MapWindowPoints_(0,GadgetID(Gadget),mouse,1)
ProcedureReturn mouse\y
EndProcedure
Procedure Open_Window_0()
If OpenWindow(#Window_0, 391, 283, 521, 511, "test", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
ImageGadget(#Image_0, 10, 10, 500, 500, Image0)
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
WindowID = EventWindow()
GadgetID = EventGadget()
EventType = EventType()
If GetAsyncKeyState_(#VK_LBUTTON)
winkel=0
posx= GetMouseX(#Image_0)
posy=GetMouseY(#Image_0)
x_mitte=250
y_mitte=250
If posx>0 And posx<501
If posy>0 And posy<501
Debug "x"+Str(posx)
Debug "y"+Str(posy)
Repeat
If winkel < 370
winkel + teiler % 360
x = posx * Cos(winkel *(2*3.1415/360)) + x_mitte ; Winkel als Bogenmaß
y = posy * Sin(winkel *(2*3.1415/360)) + y_mitte
StartDrawing(ImageOutput(0))
Box(posx,posy,4,4,RGB(0,0,0))
Box(x,y,4,4,RGB(0,0,0))
StopDrawing()
SetGadgetState(#Image_0,ImageID(0))
EndIf
Until winkel>360
EndIf
EndIf
EndIf
If Event = #PB_Event_Gadget
EndIf
Until Event = #PB_Event_CloseWindow
End