Hey,
ich hab gerade ein älteres Tool gefunden und ich dachte mir ich release es mal. Es ist nichts brandheißes und bei weitem auch nicht das einzige Tool dieser Art. Aber es ist zumindest ein nettes Beispiel für die Verwendung von GDIPlus_ und evtl. haben einige Leute Interesse sich den Sourcecode mal anzugucken.
Es reiht die Tiles der Silkroadmap aneinander, sodass man wie bei einer großen Map herumscrollen kann.
Vorher halt alle Tiles aus der Pk2 exportieren, zu .PNG konvertieren und in den Ordner "map" im Scriptverzeichnis kopieren.
Bilder:
Sourcecode:
C
- #include <GUIConstants.au3>
- #include <GDIPlus.au3>
- #include <EditConstants.au3>
- $version = "1.0"
- $fenster = GUICreate("SRO Map Tool v."&$version,1070,890,16,2)
- GUICtrlCreateLabel("Top left tile:",20,10)
- $tilebox = GUICtrlCreateInput("35x59",80,7,50,20)
- $drawmapbutton = GUICtrlCreateButton("Draw", 135, 7, 50,20)
- GUICtrlCreateLabel("Quick jump:",20,30)
- $quickjumpcombo = GUICtrlCreateCombo("Alexandria",20,50,110,20)
- GUICtrlSetData($quickjumpcombo, "Constantinople|Consta. Fortress|Samarkand|Bagdad|Hotan|Hotan Fortress|Hidden Town|Donwhang|Bandit Fortress|Jangan|Jangan Fortress|FGW - Shipwreck|FGW - Earth Ghost|Arena - Aztec|Arena - Garden|Arena - Wall|Holy Water Temple|Jupiter Temple")
- $quickjumpbutton = GUICtrlCreateButton("Go", 135, 50, 50,20)
- $drawrectbox = GUICtrlCreateCheckbox("Show grid",230,10)
- $northbutton = GUICtrlCreateButton("North", 970,10,50,25)
- $southbutton = GUICtrlCreateButton("South", 970,60,50,25)
- $westbutton = GUICtrlCreateButton("West", 945,35,50,25)
- $eastbutton = GUICtrlCreateButton("East", 995,35,50,25)
- GUISetState()
- Global $outline = false
- while 1
- $msg = GUIGetMsg()
- switch $msg
- Case $GUI_Event_Close
- ExitLoop
- Case $drawmapbutton
- _drawmap()
- Case $southbutton
- _gosouth()
- Case $northbutton
- _gonorth()
- Case $westbutton
- _gowest()
- Case $eastbutton
- _goeast()
- Case $quickjumpbutton()
- _quickjump()
- Case $drawrectbox
- If $outline = False then
- $outline = True
- Else
- $outline = False
- EndIf
- _drawmap()
- EndSwitch
- sleep(10)
- Wend
- Func _drawmap()
- Global $string = GUICtrlRead($tilebox)
- Global $numbers = StringSplit($string, "x")
- _GDIPlus_Startup()
- If FileExists(@ScriptDir&"\map\"&$numbers[1]&"x"&$numbers[2]&".PNG") then
- $bild1 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]&"x"&$numbers[2]&".PNG")
- Else
- $bild1 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]&"x"&$numbers[2]-1&".PNG") then
- $bild2 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]&"x"&$numbers[2]-1&".PNG")
- Else
- $bild2 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]&"x"&$numbers[2]-2&".PNG") then
- $bild3 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]&"x"&$numbers[2]-2&".PNG")
- Else
- $bild3 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+1&"x"&$numbers[2]&".PNG") then
- $bild4 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+1&"x"&$numbers[2]&".PNG")
- Else
- $bild4 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+1&"x"&$numbers[2]-1&".PNG") then
- $bild5 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+1&"x"&$numbers[2]-1&".PNG")
- Else
- $bild5 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+1&"x"&$numbers[2]-2&".PNG") then
- $bild6 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+1&"x"&$numbers[2]-2&".PNG")
- Else
- $bild6 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+2&"x"&$numbers[2]&".PNG") then
- $bild7 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+2&"x"&$numbers[2]&".PNG")
- Else
- $bild7 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+2&"x"&$numbers[2]-1&".PNG") then
- $bild8 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+2&"x"&$numbers[2]-1&".PNG")
- Else
- $bild8 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+2&"x"&$numbers[2]-2&".PNG") then
- $bild9 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+2&"x"&$numbers[2]-2&".PNG")
- Else
- $bild9 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+3&"x"&$numbers[2]&".PNG") then
- $bild10 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+3&"x"&$numbers[2]&".PNG")
- Else
- $bild10 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+3&"x"&$numbers[2]-1&".PNG") then
- $bild11 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+3&"x"&$numbers[2]-1&".PNG")
- Else
- $bild11 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- If FileExists(@ScriptDir&"\map\"&$numbers[1]+3&"x"&$numbers[2]-2&".PNG") then
- $bild12 = _GDIPlus_BitmapCreateFromFile(@ScriptDir&"\map\"&$numbers[1]+3&"x"&$numbers[2]-2&".PNG")
- Else
- $bild12 = _GDIPlus_BitmapCreateFromFile("other\PLAIN.PNG")
- EndIf
- $malbereich = _GDIPlus_GraphicsCreateFromHWND($fenster)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild1, 20+256*0, 100+256*0)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild2, 20+256*0, 100+256*1)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild3, 20+256*0, 100+256*2)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild4, 20+256*1, 100+256*0)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild5, 20+256*1, 100+256*1)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild6, 20+256*1, 100+256*2)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild7, 20+256*2, 100+256*0)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild8, 20+256*2, 100+256*1)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild9, 20+256*2, 100+256*2)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild10, 20+256*3, 100+256*0)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild11, 20+256*3, 100+256*1)
- _GDIPlus_GraphicsDrawImage($malbereich, $bild12, 20+256*3, 100+256*2)
- If $outline = True then
- $rot = _GDIPlus_PenCreate(0xffff0000, 1,2)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256, 256, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256, 256*2, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256, 256*3, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*2, 256, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*2, 256*2, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*2, 256*3, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*3, 256, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*3, 256*2, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*3, 256*3, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*4, 256, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*4, 256*2, $rot)
- _GDIPlus_GraphicsDrawRect($malbereich, 20, 100, 256*4, 256*3, $rot)
- _GDIPlus_PenDispose($rot)
- EndIf
- _GDIPlus_GraphicsDispose($malbereich)
- _GDIPlus_BitmapDispose($bild1)
- _GDIPlus_BitmapDispose($bild2)
- _GDIPlus_BitmapDispose($bild3)
- _GDIPlus_BitmapDispose($bild4)
- _GDIPlus_BitmapDispose($bild5)
- _GDIPlus_BitmapDispose($bild6)
- _GDIPlus_BitmapDispose($bild7)
- _GDIPlus_BitmapDispose($bild8)
- _GDIPlus_BitmapDispose($bild9)
- _GDIPlus_BitmapDispose($bild10)
- _GDIPlus_BitmapDispose($bild11)
- _GDIPlus_BitmapDispose($bild12)
- _GDIPlus_Shutdown()
- EndFunc
- Func _gosouth()
- GUICtrlSetData($tilebox, $numbers[1]&"x"&$numbers[2]-1)
- _drawmap()
- EndFunc
- Func _gonorth()
- GUICtrlSetData($tilebox, $numbers[1]&"x"&$numbers[2]+1)
- _drawmap()
- EndFunc
- Func _gowest()
- GUICtrlSetData($tilebox, $numbers[1]-1&"x"&$numbers[2])
- _drawmap()
- EndFunc
- Func _goeast()
- GUICtrlSetData($tilebox, $numbers[1]+1&"x"&$numbers[2])
- _drawmap()
- EndFunc
- Func _quickjump()
- Global $quickselect = GUICtrlRead($quickjumpcombo)
- Switch $quickselect
- Case "Hotan"
- GUICtrlSetData($tilebox, "42x47")
- _drawmap()
- Case "Jangan"
- GUICtrlSetData($tilebox, "74x52")
- _drawmap()
- Case "Constantinople"
- GUICtrlSetData($tilebox, "77x106")
- _drawmap()
- Case "Donwhang"
- GUICtrlSetData($tilebox, "59x57")
- _drawmap()
- Case "Samarkand"
- GUICtrlSetData($tilebox, "106x107")
- _drawmap()
- Case "Hotan Fortress"
- GUICtrlSetData($tilebox, "69x62")
- _drawmap()
- Case "Jangan Fortress"
- GUICtrlSetData($tilebox, "69x70")
- _drawmap()
- Case "Bandit Fortress"
- GUICtrlSetData($tilebox, "77x69")
- _drawmap()
- Case "Alexandria"
- GUICtrlSetData($tilebox, "46x91")
- _drawmap()
- Case "Bagdad"
- GUICtrlSetData($tilebox, "88x89")
- _drawmap()
- Case "Hidden Town"
- GUICtrlSetData($tilebox, "93x94")
- _drawmap()
- Case "FGW - Shipwreck"
- GUICtrlSetData($tilebox, "241x114")
- _drawmap()
- Case "FGW - Earth Ghost"
- GUICtrlSetData($tilebox, "226x125")
- _drawmap()
- Case "Arena - Wall"
- GUICtrlSetData($tilebox, "214x123")
- _drawmap()
- Case "Arena - Aztec"
- GUICtrlSetData($tilebox, "212x116")
- _drawmap()
- Case "Arena - Garden"
- GUICtrlSetData($tilebox, "210x110")
- _drawmap()
- Case "Holy Water Temple"
- GUICtrlSetData($tilebox, "191x116")
- _drawmap()
- Case "Jupiter Temple"
- GUICtrlSetData($tilebox, "235x125")
- _drawmap()
- Case "Consta. Fortress"
- GUICtrlSetData($tilebox, "91x62")
- _drawmap()
- EndSwitch
- EndFunc
Ich hoffe der Eine oder Andere kann damit was anfangen... =)