Hallo Leute,
Ich hab mal wieder an meinem Editor geschrieben und bin auf ein Problem gestoßen...
Das Bild flackert immer
Ich möchte den Fehler gerne beheben aber ich weis nicht was ich verändern soll.
Ich glaube das hängt mit meinen 2 Buffern zsm.
Über Hilfe würde ich mich sehr freuen
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
Global $hGuiH = 640 ,$hGuiW = 640,$hGuiTitle = "NewMap",$iLastmX = "",$iLastmY = ""
[/autoit] [autoit][/autoit] [autoit]$hGui = GUICreate($hGuiTitle,$hGuiH,$hGuiW)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGr_Frontbuffer = _GDIPlus_GraphicsCreateFromHWND($hGUI)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$hBitmap_Backbuffer = _GDIPlus_BitmapCreateFromGraphics($hGuiW,$hGuiH , $hGr_Frontbuffer)
[/autoit] [autoit][/autoit] [autoit]$hGr_Backbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap_Backbuffer)
$hGr_OverBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap_Backbuffer)
_GDIPlus_GraphicsClear($hGr_Backbuffer)
[/autoit] [autoit][/autoit] [autoit]$hGlas = _GDIPlus_ImageLoadFromFile(@ScriptDir&"\NewGlassRed2.png");Irgend ein 32x32px png
[/autoit] [autoit][/autoit] [autoit]While 1
If GUIGetMsg() = -3 Then Exit
If WinActive($hGuiTitle) Then
$iMousePos = GUIGetCursorInfo()
For $a = 0 To $hGuiH Step 32
For $b = 0 To $hGuiW Step 32
If $a + 32 > $iMousePos[0] And $a < $iMousePos[0] + 1 And $b + 32 > $iMousePos[1] And $b < $iMousePos[1] + 1 Then
_GDIPlus_GraphicsClear($hGr_OverBackbuffer)
_GDIPlus_GraphicsDrawRect($hGr_OverBackbuffer,$a,$b,32,32,_GDIPlus_PenCreate(0xFFFFFFFF))
EndIf
Next
Next
EndIf
If _IsPressed(01) And WinActive($hGuiTitle) Then
$iMousePos = GUIGetCursorInfo()
For $a = 0 To $hGuiH Step 32
For $b = 0 To $hGuiW Step 32
If $a + 32 > $iMousePos[0] And $a < $iMousePos[0] + 1 And $b + 32 > $iMousePos[1] And $b < $iMousePos[1] + 1 Then
If $a = $iLastmX And $b = $iLastmY Then
;
Else
_GDIPlus_GraphicsFillRect($hGr_Backbuffer,$a,$b,32,32)
_GDIPlus_GraphicsDrawImage($hGr_Backbuffer,$hGlas,$a,$b)
EndIf
$iLastmX = $a
$iLastmY = $b
EndIf
Next
Next
EndIf
If _IsPressed(02) And WinActive($hGuiTitle) Then
$iMousePos = GUIGetCursorInfo()
For $a = 0 To $hGuiH Step 32
For $b = 0 To $hGuiW Step 32
If $a + 32 > $iMousePos[0] And $a < $iMousePos[0] + 1 And $b + 32 > $iMousePos[1] And $b < $iMousePos[1] + 1 Then
_GDIPlus_GraphicsFillRect($hGr_Backbuffer,$a,$b,32,32)
EndIf
Next
Next
EndIf
_GDIPlus_GraphicsDrawImage($hGr_Backbuffer,$hGr_OverBackbuffer,0,0)
_GDIPlus_GraphicsDrawImage($hBitmap_Backbuffer,$hGr_Backbuffer,0,0)
_GDIPlus_GraphicsDrawImage($hGr_Frontbuffer,$hBitmap_Backbuffer,0,0)
[/autoit] [autoit][/autoit] [autoit]WEnd
[/autoit]
Hier mein Code bis jetzt.