Hi,
bin grade dabei ein Multiplayer RPG zu machen. Der Titel und die Story stehen noch nicht ganz fest. Werde hier immer mal wieder den aktuellen Stand posten und auch nach und nach Sachen zum selbst ausprobieren rausgeben. Der Anfang macht mal die erste Grundversion des Mapeditors. Einfach rechts das "Objekt" auswählen und links die Map zusammen klicken. Beim schließen des Fensters wird das ganze dann gespeichert. Viel Spaß beim ausprobieren hehe.
Spoiler anzeigen
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
Opt("GuiOnEventMode", 1)
Opt("MouseCoordMode", 2)
OnAutoItExitRegister("_end")
[/autoit] [autoit][/autoit] [autoit]$Gui = GUICreate("Beispiel", 736, 608)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Chipsetauswahl")
GUISetState(@SW_SHOW)
Dim $selectedposx, $selectedposy
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$chipset = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\1.png")
[/autoit] [autoit][/autoit] [autoit]$graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
$bitmap = _GDIPlus_BitmapCreateFromGraphics(736, 608, $graphic)
$buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsClear($buffer, 0xFF000000)
_GDIPlus_GraphicsDrawImageRectRect($buffer, $chipset, 0, 0, 256, 1024, 608, 0, 128, 512)
_GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
$pen = _GDIPlus_PenCreate(0xFFFFFF33,2)
$mouscordsalt = MouseGetPos()
$xposalt = 0
$xposalt = 0
While 1
$mouscords = MouseGetPos()
If $mouscordsalt[0] <> $mouscords[0] Or $mouscordsalt[1] <> $mouscords[1] Then
$mouscordsalt[0] = $mouscords[0]
$mouscordsalt[1] = $mouscords[1]
If $mouscords[0] > 608 And $mouscords[1] > -1 And $mouscords[0] < 801 And $mouscords[1] < 513 Then
$xpos = 608 + 16 * Round((($mouscords[0] - 7 - 608) / 16), 0)
$ypos = 16 * Round((($mouscords[1] - 7) / 16), 0)
If $xposalt <> $xpos Or $yposalt <> $ypos Then
$xposalt = $xpos
$yposalt = $ypos
_GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
_GDIPlus_GraphicsDrawRect($graphic, $xpos, $ypos, 16, 16,$pen)
EndIf
ElseIf $mouscords[0] > 0 And $mouscords[1] > -1 And $mouscords[0] < 608 And $mouscords[1] < 608 And $selectedposx <> "" Then
$xpos = 16 * Round((($mouscords[0] - 7) / 16), 0)
$ypos = 16 * Round((($mouscords[1] - 7) / 16), 0)
If $xposalt <> $xpos Or $yposalt <> $ypos Then
$xposalt = $xpos
$yposalt = $ypos
_GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
_GDIPlus_GraphicsDrawImageRectRect($graphic, $chipset, ($selectedposx - 608) * 2, $selectedposy * 2, 32, 32, $xpos, $ypos, 16, 16)
EndIf
EndIf
EndIf
Sleep(100)
WEnd
Func Chipsetauswahl()
If $mouscords[0] > 608 And $mouscords[1] > -1 And $mouscords[0] < 801 And $mouscords[1] < 513 Then
_GDIPlus_GraphicsFillRect($buffer, 608, 0, 128, 512)
_GDIPlus_GraphicsDrawImageRectRect($buffer, $chipset, 0, 0, 256, 1024, 608, 0, 128, 512)
$selectedposx = 608 + 16 * Round((($mouscords[0] - 5 - 608) / 16), 0)
$selectedposy = 16 * Round((($mouscords[1] - 5) / 16), 0)
_GDIPlus_GraphicsDrawRect($buffer, $selectedposx, $selectedposy, 16, 16,$pen)
_GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
ElseIf $mouscords[0] > 0 And $mouscords[1] > -1 And $mouscords[0] < 608 And $mouscords[1] < 608 And $selectedposx <> "" Then
$xpos = 16 * Round((($mouscords[0] - 7) / 16), 0)
$ypos = 16 * Round((($mouscords[1] - 7) / 16), 0)
_GDIPlus_GraphicsDrawImageRectRect($buffer, $chipset, ($selectedposx - 608) * 2, $selectedposy * 2, 32, 32, $xpos, $ypos, 16, 16)
_GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
EndIf
EndFunc ;==>Chipsetauswahl
Func CLOSEClicked()
Exit
EndFunc ;==>CLOSEClicked
Func _end()
$klon = _GDIPlus_BitmapCloneArea($bitmap, 0, 0, 608, 608)
_GDIPlus_ImageSaveToFile($klon, @ScriptDir & "\GDIPlus_Image.png")
_GDIPlus_PenDispose($pen)
_GDIPlus_ImageDispose($chipset)
_GDIPlus_GraphicsDispose($graphic)
_GDIPlus_GraphicsDispose($buffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_BitmapDispose($klon)
_GDIPlus_Shutdown()
EndFunc ;==>_end