Problem mit QuickDraw und MouseGetPos()

  • Ich habe folgendes Problem:
    Wenn ich eine GUI mit einem QD Surface und einen Kreis mit QuickDraw erstelle und die Position mit MouseGetPos ermittel, dann ist der Kreis an einer ganz anderen Stelle.
    Wenn ich mit QD ein Fenster erstelle und dann den kreis zeichnen lasse, klappt es.
    Skripte:

    Surface
    [autoit]

    #AutoIt3Wrapper_usex64=n
    #include <QuickDraw.au3>
    #include <Misc.au3>
    Opt("MouseCoordMode", 2)
    $hGUI=GUICreate("")
    _QuickDraw_CreateSurface($hGUI, 0, 0, 0, 0)
    GUIDelete($hGUI)
    $hGUI=GUICreate("test")
    _QuickDraw_CreateSurface($hGUI, 0, 0, 500, 500)
    GUISetCursor(3, 1, $hGUI)
    While _QuickDraw_Running()
    Switch GUIGetMsg()
    Case -3
    ExitLoop
    EndSwitch
    _QuickDraw_ClearBuffer(0xFFFFFFFF)
    If _IsPressed(01) Then test()
    _QuickDraw_SwapBuffers()
    WEnd
    _QuickDraw_Disable()
    Func test()
    _QuickDraw_Circle(MouseGetPos(0), MouseGetPos(1), 5, $Draw_Fill, 0xF025Ff6)
    EndFunc

    [/autoit]
    QuickDraw_Enable
    [autoit]

    #AutoIt3Wrapper_usex64=n
    #include <QuickDraw.au3>
    #include <Misc.au3>
    Opt("MouseCoordMode", 2)
    _QuickDraw_Enable("test", 500, 500, 500, 500, 0)
    While _QuickDraw_Running()
    Switch GUIGetMsg()
    Case -3
    ExitLoop
    EndSwitch
    _QuickDraw_ClearBuffer(0xFFFFFFFF)
    If _IsPressed(01) Then test()
    _QuickDraw_SwapBuffers()
    WEnd
    _QuickDraw_Disable()
    Func test()
    _QuickDraw_Circle(MouseGetPos(0), MouseGetPos(1), 5, $Draw_Fill, 0xF025Ff6)
    EndFunc

    [/autoit]

    Einmal editiert, zuletzt von Ineluki (25. August 2010 um 15:17)

  • So wird´s was

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_UseX64=n
    #include <QuickDraw.au3>
    #include <Misc.au3>
    Opt("GuiOnEventMode", 1)
    $hGUI = GUICreate("")
    _QuickDraw_CreateSurface($hGUI, 0, 0, 0, 0)
    GUIDelete($hGUI)
    $hGUI = GUICreate("test",500,500)
    GUISetOnEvent(-3, "_Exit")
    _QuickDraw_CreateSurface($hGUI, 0, 0, 500, 500)
    GUISetCursor(3, 1, $hGUI)
    While _QuickDraw_Running()
    _QuickDraw_ClearBuffer(0xFFFFFFFF)
    If _IsPressed(01) Then test()
    _QuickDraw_SwapBuffers()
    WEnd
    _Exit()
    Func test()
    $Pos = GUIGetCursorInfo()
    If UBound($Pos) > 2 Then _QuickDraw_Circle($Pos[0], $Pos[1], 5, $Draw_Fill, 0xFFFF0000)
    EndFunc ;==>test

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _QuickDraw_Disable()
    Exit
    EndFunc ;==>_Exit

    [/autoit]


    bzw mit _QD Enable

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_UseX64=n
    #include <QuickDraw.au3>
    #include <Misc.au3>
    #include <WinAPI.au3>
    $Title = "test"
    $tCoords = DllStructCreate("int X;int Y;")
    _QuickDraw_Enable($Title, 500, 500, 500, 500, 0)
    $hQD = WinGetHandle($Title)

    [/autoit] [autoit][/autoit] [autoit]

    While _QuickDraw_Running()
    _QuickDraw_ClearBuffer(0xFFFFFFFF)
    If _IsPressed(01) Then test()
    _QuickDraw_SwapBuffers()
    WEnd
    _QuickDraw_Disable()
    Func test()
    DllStructSetData($tCoords, "X", MouseGetPos(0))
    DllStructSetData($tCoords, "Y", MouseGetPos(1))
    _WinAPI_ScreenToClient($hQD, $tCoords)
    _QuickDraw_Circle(DllStructGetData($tCoords, "X"), DllStructGetData($tCoords, "Y"), 5, $Draw_Fill, 0xF025Ff6)
    EndFunc ;==>test

    [/autoit]

    //Edit: Das Gui war schuld änder mal um auf $hGUI = GUICreate("test",500,500)