Code cleaning

This commit is contained in:
djes
2016-08-26 12:40:07 +02:00
parent bc94b653b6
commit 71b4c66856

174
PBMap.pb
View File

@@ -28,7 +28,7 @@ UsePNGImageEncoder()
DeclareModule PBMap DeclareModule PBMap
#Red = 255 #Red = 255
;-Show debug infos ;-Show debug infos
Global Verbose = 1 Global Verbose = 0
Global MyDebugLevel = 3 Global MyDebugLevel = 3
;-Proxy ON/OFF ;-Proxy ON/OFF
Global Proxy = #False Global Proxy = #False
@@ -36,7 +36,7 @@ DeclareModule PBMap
Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i) Declare MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
Declare Event(Event.l) Declare Event(Event.l)
Declare SetLocation(latitude.d, longitude.d, zoom = 15, mode.i = #PB_Absolute) Declare SetLocation(latitude.d, longitude.d, zoom = 15, mode.i = #PB_Absolute)
Declare DrawingThread() Declare Drawing()
Declare SetZoom(Zoom.i, mode.i = #PB_Relative) Declare SetZoom(Zoom.i, mode.i = #PB_Relative)
Declare ZoomToArea() Declare ZoomToArea()
Declare SetCallBackLocation(*CallBackLocation) Declare SetCallBackLocation(*CallBackLocation)
@@ -241,6 +241,25 @@ Module PBMap
EndProcedure EndProcedure
;- *** ;- ***
Procedure LoadingImageCreation()
Protected Text$ = "Loading"
PBmap\ImgLoading = CreateImage(#PB_Any, 256, 256)
If PBmap\ImgLoading
StartVectorDrawing(ImageVectorOutput(PBMap\Imgloading))
BeginVectorLayer()
VectorSourceColor(RGBA(255, 255, 255, 128))
AddPathBox(0, 0, 256, 256)
FillPath()
MovePathCursor(0, 0)
VectorFont(FontID(PBMap\Font), 256 / 20)
VectorSourceColor(RGBA(150, 150, 150, 255))
MovePathCursor(0 + (256 - VectorTextWidth(Text$)) / 2, 0 + (256 - VectorTextHeight(Text$)) / 2)
DrawVectorText(Text$)
EndVectorLayer()
StopVectorDrawing()
EndIf
EndProcedure
Procedure InitPBMap(window) Procedure InitPBMap(window)
Protected Result.i Protected Result.i
If Verbose If Verbose
@@ -260,7 +279,6 @@ Module PBMap
PBMap\Font = LoadFont(#PB_Any, "Arial", 20, #PB_Font_Bold) PBMap\Font = LoadFont(#PB_Any, "Arial", 20, #PB_Font_Bold)
PBMap\Window = window PBMap\Window = window
PBMap\Options\WheelMouseRelative = #True PBMap\Options\WheelMouseRelative = #True
;-Options
;-Preferences ;-Preferences
;Use this to create and customize your preferences file for the first time ;Use this to create and customize your preferences file for the first time
; CreatePreferences(GetHomeDirectory() + "PBMap.prefs") ; CreatePreferences(GetHomeDirectory() + "PBMap.prefs")
@@ -285,41 +303,12 @@ Module PBMap
Global ProxyPassword$ = InputRequester("ProxyPass", "Do you use a password ? Then enter it", "") ;TODO Global ProxyPassword$ = InputRequester("ProxyPass", "Do you use a password ? Then enter it", "") ;TODO
EndIf EndIf
ClosePreferences() ClosePreferences()
curl_global_init(#CURL_GLOBAL_WIN32); curl_global_init(#CURL_GLOBAL_WIN32)
;- Main drawing thread launching LoadingImageCreation()
;PBMap\MainDrawingThread = CreateThread(@DrawingThread(), @PBMap\Drawing)
;If PBMap\MainDrawingThread = 0
; Error("MapGadget : can't create main drawing thread.")
Protected Text$ = "Loading"
PBmap\ImgLoading = CreateImage(#PB_Any,256,256)
If PBmap\ImgLoading
StartVectorDrawing(ImageVectorOutput(PBMap\Imgloading))
BeginVectorLayer()
VectorSourceColor(RGBA(255, 255, 255, 128))
AddPathBox(0, 0, 256, 256)
FillPath()
MovePathCursor(0, 0)
VectorFont(FontID(PBMap\Font), 256 / 20)
VectorSourceColor(RGBA(150, 150, 150, 255))
MovePathCursor(0 + (256 - VectorTextWidth(Text$)) / 2, 0 + (256 - VectorTextHeight(Text$)) / 2)
DrawVectorText(Text$)
EndVectorLayer()
StopVectorDrawing()
EndIf
EndProcedure EndProcedure
Procedure Quit() Procedure Quit()
PBMap\Drawing\End = #True PBMap\Drawing\End = #True
; ;wait for loading threads to finish nicely
; ResetList(PBMap\TilesThreads())
; While NextElement(PBMap\TilesThreads())
; If IsThread(PBMap\TilesThreads()\GetImageThread) = 0
; FreeMemory(PBMap\TilesThreads()\Tile)
; DeleteElement(PBMap\TilesThreads())
; ResetList( PBMap\TilesThreads())
; EndIf
; Wend
;Wait for loading threads to finish nicely. Passed 2 seconds, kills them. ;Wait for loading threads to finish nicely. Passed 2 seconds, kills them.
Protected TimeCounter = ElapsedMilliseconds() Protected TimeCounter = ElapsedMilliseconds()
Repeat Repeat
@@ -472,19 +461,6 @@ Module PBMap
ProcedureReturn -1 ProcedureReturn -1
EndProcedure EndProcedure
; Procedure.i GetTileFromMem(Zoom.i, XTile.i, YTile.i)
; Protected key.s = "Z" + RSet(Str(Zoom), 4, "0") + "X" + RSet(Str(XTile), 8, "0") + "Y" + RSet(Str(YTile), 8, "0")
; MyDebug("Check if we have this image in memory")
; If FindMapElement(PBMap\MemCache\Images(), key)
; MyDebug("Key : " + key + " found !")
; ProcedureReturn PBMap\MemCache\Images()\nImage
; Else
; Protected CacheFile.s = PBMap\HDDCachePath + "PBMap_" + Str(Zoom) + "_" + Str(XTile) + "_" + Str(YTile) + ".png"
; MyDebug("Key : " + key + " Try HDD!")
; ProcedureReturn GetTileFromHDD(CacheFile.s)
; EndIf
; EndProcedure
Procedure.i GetLocalTile(key.s, CacheFile.s) Procedure.i GetLocalTile(key.s, CacheFile.s)
MyDebug("Check if we have this image in memory", 3) MyDebug("Check if we have this image in memory", 3)
If FindMapElement(PBMap\MemCache\Images(), key) If FindMapElement(PBMap\MemCache\Images(), key)
@@ -534,10 +510,7 @@ Module PBMap
Procedure GetImageThread(*Tile.Tile) Procedure GetImageThread(*Tile.Tile)
Protected nImage.i = -1 Protected nImage.i = -1
;nImage = GetTileFromHDD(CacheFile)
;If nImage = -1
nImage = GetTileFromWeb(*Tile\PBMapZoom, *Tile\PBMapTileX, *Tile\PBMapTileY, *Tile\CacheFile) nImage = GetTileFromWeb(*Tile\PBMapZoom, *Tile\PBMapTileX, *Tile\PBMapTileY, *Tile\CacheFile)
;EndIf
If nImage <> -1 If nImage <> -1
LockMutex(PBMap\TileThreadMutex) LockMutex(PBMap\TileThreadMutex)
PBMap\MemCache\Images(*Tile\key)\nImage = nImage PBMap\MemCache\Images(*Tile\key)\nImage = nImage
@@ -550,7 +523,7 @@ Module PBMap
EndIf EndIf
;Define this tile image nb ;Define this tile image nb
*Tile\nImage = nImage *Tile\nImage = nImage
PostEvent(#PB_Event_Gadget,PBMap\window,PBmap\Gadget,#PB_MAP_REDRAW,*tile) PostEvent(#PB_Event_Gadget, PBMap\window,PBmap\Gadget, #PB_MAP_REDRAW, *Tile)
EndProcedure EndProcedure
Procedure DrawTile(*Tile.Tile) Procedure DrawTile(*Tile.Tile)
@@ -577,7 +550,6 @@ Module PBMap
Protected ty = Int(*Drawing\Position\y) Protected ty = Int(*Drawing\Position\y)
Protected nx = *Drawing\CenterX / PBMap\TileSize ;How many tiles around the point Protected nx = *Drawing\CenterX / PBMap\TileSize ;How many tiles around the point
Protected ny = *Drawing\CenterY / PBMap\TileSize Protected ny = *Drawing\CenterY / PBMap\TileSize
Protected px, py, img, key.s, CacheFile.s Protected px, py, img, key.s, CacheFile.s
MyDebug("Drawing tiles") MyDebug("Drawing tiles")
For y = - ny - 1 To ny + 1 For y = - ny - 1 To ny + 1
@@ -614,8 +586,6 @@ Module PBMap
\GetImageThread = CreateThread(@GetImageThread(), *NewTile) \GetImageThread = CreateThread(@GetImageThread(), *NewTile)
PBMap\TilesThreads()\GetImageThread = \GetImageThread PBMap\TilesThreads()\GetImageThread = \GetImageThread
myDebug(" Creating get image thread nb " + Str(\GetImageThread)) myDebug(" Creating get image thread nb " + Str(\GetImageThread))
; DrawLoading(*NewTile)
;*Drawing\Dirty = #True ;Signals that this image is missing so we should have to redraw
EndWith EndWith
Else Else
MyDebug(" Error, can't create a new tile") MyDebug(" Error, can't create a new tile")
@@ -625,7 +595,7 @@ Module PBMap
Next Next
Next Next
;Free tile memory ;Free tile memory
;TODO : get out this proc from drawtiles in a special "free ressources" task ;TODO : maybe get out this proc from drawtiles in a special "free ressources" task
ForEach PBMap\TilesThreads() ForEach PBMap\TilesThreads()
;Check if there's no more loading thread ;Check if there's no more loading thread
If IsThread(PBMap\TilesThreads()\GetImageThread) = 0 If IsThread(PBMap\TilesThreads()\GetImageThread) = 0
@@ -636,19 +606,6 @@ Module PBMap
;EnableDebugger ;EnableDebugger
EndProcedure EndProcedure
; Procedure Pointer(x.i, y.i, color.l = #Red)
; color=RGBA(255, 0, 0, 255)
; VectorSourceColor(color)
; MovePathCursor(x, y)
; AddPathLine(-8,-16,#PB_Path_Relative)
; AddPathCircle(8,0,8,180,0,#PB_Path_Relative)
; AddPathLine(-8,16,#PB_Path_Relative)
; ;FillPath(#PB_Path_Preserve)
; ;ClipPath(#PB_Path_Preserve)
; AddPathCircle(0,-16,5,0,360,#PB_Path_Relative)
; VectorSourceColor(color)
; FillPath(#PB_Path_Preserve):VectorSourceColor(RGBA(0, 0, 0, 255)):StrokePath(1)
; EndProcedure
; ;-**** Clean Mem Cache ; ;-**** Clean Mem Cache
; ;TODO in development, by now there's many cache problem as the loading thread could be perturbed ; ;TODO in development, by now there's many cache problem as the loading thread could be perturbed
; ;GadgetWidth(PBMap\Gadget)/PBMap\TileSize ; ;GadgetWidth(PBMap\Gadget)/PBMap\TileSize
@@ -675,7 +632,6 @@ Module PBMap
; EndIf ; EndIf
; Next ; Next
Procedure DrawPointer(*Drawing.DrawingParameters) Procedure DrawPointer(*Drawing.DrawingParameters)
If PBMap\CallBackMainPointer > 0 If PBMap\CallBackMainPointer > 0
; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib) ; @Procedure(X.i, Y.i) to DrawPointer (you must use VectorDrawing lib)
@@ -729,7 +685,6 @@ Module PBMap
Protected km.f, memKm.i Protected km.f, memKm.i
If ListSize(PBMap\track())>0 If ListSize(PBMap\track())>0
;Trace Track ;Trace Track
; LockMutex(PBMap\Drawing\Mutex)
ForEach PBMap\track() ForEach PBMap\track()
If *Drawing\TargetLocation\Latitude<>0 And *Drawing\TargetLocation\Longitude<>0 If *Drawing\TargetLocation\Latitude<>0 And *Drawing\TargetLocation\Longitude<>0
GetPixelCoordFromLocation(@PBMap\track(),@Pixel) GetPixelCoordFromLocation(@PBMap\track(),@Pixel)
@@ -763,7 +718,6 @@ Module PBMap
EndIf EndIf
EndIf EndIf
Next Next
; UnlockMutex(PBMap\Drawing\Mutex)
EndIf EndIf
EndProcedure EndProcedure
@@ -793,18 +747,10 @@ Module PBMap
Next Next
EndProcedure EndProcedure
;-*** Main drawing thread ;-*** Main drawing
; always running, waiting for a semaphore to start refreshing Procedure Drawing()
Procedure DrawingThread();*SharedDrawing.DrawingParameters)
Protected *Drawing.DrawingParameters = @PBMap\Drawing Protected *Drawing.DrawingParameters = @PBMap\Drawing
Protected Px.d, Py.d Protected Px.d, Py.d
;Repeat
; WaitSemaphore(*SharedDrawing\Semaphore)
; MyDebug("--------- Main drawing thread ------------")
;Creates a copy of the structure to work with to avoid multiple mutex locks
; LockMutex(*SharedDrawing\Mutex)
; CopyStructure(*SharedDrawing, @Drawing, DrawingParameters)
; UnlockMutex(*SharedDrawing\Mutex)
;Precalc some values ;Precalc some values
*Drawing\CenterX = GadgetWidth(PBMap\Gadget) / 2 *Drawing\CenterX = GadgetWidth(PBMap\Gadget) / 2
*Drawing\CenterY = GadgetHeight(PBMap\Gadget) / 2 *Drawing\CenterY = GadgetHeight(PBMap\Gadget) / 2
@@ -814,16 +760,12 @@ Module PBMap
*Drawing\DeltaY = Py * PBMap\TileSize - (Int(Py) * PBMap\TileSize) *Drawing\DeltaY = Py * PBMap\TileSize - (Int(Py) * PBMap\TileSize)
*Drawing\TargetLocation\Latitude = PBMap\TargetLocation\Latitude *Drawing\TargetLocation\Latitude = PBMap\TargetLocation\Latitude
*Drawing\TargetLocation\Longitude = PBMap\TargetLocation\Longitude *Drawing\TargetLocation\Longitude = PBMap\TargetLocation\Longitude
;Drawing\Dirty = #False
;Main drawing stuff ;Main drawing stuff
StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget)) StartVectorDrawing(CanvasVectorOutput(PBMap\Gadget))
DrawTiles(*Drawing) DrawTiles(*Drawing)
DrawTrack(*Drawing) DrawTrack(*Drawing)
DrawMarker(*Drawing) DrawMarker(*Drawing)
DrawPointer(*Drawing) DrawPointer(*Drawing)
;DrawTrack(*Drawing)
;DrawMarker(*Drawing)
;Pointer(*Drawing\CenterX, *Drawing\CenterY, #Red)
;- Display how many images in cache ;- Display how many images in cache
VectorFont(FontID(PBMap\Font), 30) VectorFont(FontID(PBMap\Font), 30)
VectorSourceColor(RGBA(0, 0, 0, 80)) VectorSourceColor(RGBA(0, 0, 0, 80))
@@ -832,24 +774,10 @@ Module PBMap
MovePathCursor(50,80) MovePathCursor(50,80)
DrawVectorText(Str(ListSize(PBMap\TilesThreads()))) DrawVectorText(Str(ListSize(PBMap\TilesThreads())))
StopVectorDrawing() StopVectorDrawing()
;Redraw
; If something was not correctly drawn, redraw after a while
; LockMutex(*SharedDrawing\Mutex) ;Be sure that we're not modifying variables while moving (seems not useful, but it is, especially to clean the semaphore)
; If Drawing\Dirty
; MyDebug("Something was dirty ! We try again to redraw")
; Drawing\PassNb + 1
; SignalSemaphore(*SharedDrawing\Semaphore)
; Else
; ;Clean the semaphore to avoid multiple unuseful redraws
; Repeat : Until TrySemaphore(*SharedDrawing\Semaphore) = 0
; EndIf
;UnlockMutex(*SharedDrawing\Mutex)
;Until Drawing\End
EndProcedure EndProcedure
Procedure Refresh() Procedure Refresh()
DrawingThread() Drawing()
;SignalSemaphore(PBMap\Drawing\Semaphore)
EndProcedure EndProcedure
Procedure SetLocation(latitude.d, longitude.d, zoom = 15, Mode.i = #PB_Absolute) Procedure SetLocation(latitude.d, longitude.d, zoom = 15, Mode.i = #PB_Absolute)
@@ -870,10 +798,7 @@ Module PBMap
PBMap\Position\x = PBMap\Drawing\Position\x * PBMap\TileSize PBMap\Position\x = PBMap\Drawing\Position\x * PBMap\TileSize
PBMap\Position\y = PBMap\Drawing\Position\y * PBMap\TileSize PBMap\Position\y = PBMap\Drawing\Position\y * PBMap\TileSize
PBMap\Drawing\PassNb = 1 PBMap\Drawing\PassNb = 1
;Start drawing Drawing()
;SignalSemaphore(PBMap\Drawing\Semaphore)
DrawingThread()
;***
If PBMap\CallBackLocation > 0 If PBMap\CallBackLocation > 0
CallFunctionFast(PBMap\CallBackLocation, @PBMap\TargetLocation) CallFunctionFast(PBMap\CallBackLocation, @PBMap\TargetLocation)
EndIf EndIf
@@ -934,12 +859,8 @@ Module PBMap
;Convert X, Y in tile.decimal into real pixels ;Convert X, Y in tile.decimal into real pixels
PBMap\Position\X = PBMap\Drawing\Position\x * PBMap\TileSize PBMap\Position\X = PBMap\Drawing\Position\x * PBMap\TileSize
PBMap\Position\Y = PBMap\Drawing\Position\y * PBMap\TileSize PBMap\Position\Y = PBMap\Drawing\Position\y * PBMap\TileSize
;*** Creates a drawing thread and fill parameters ;First drawing
;PBMap\Drawing\PassNb = 1 Drawing()
;Start drawing
;SignalSemaphore(PBMap\Drawing\Semaphore)
DrawingThread()
;***
If PBMap\CallBackLocation > 0 If PBMap\CallBackLocation > 0
CallFunctionFast(PBMap\CallBackLocation, @PBMap\TargetLocation) CallFunctionFast(PBMap\CallBackLocation, @PBMap\TargetLocation)
EndIf EndIf
@@ -955,25 +876,19 @@ Module PBMap
Procedure.d GetLatitude() Procedure.d GetLatitude()
Protected Value.d Protected Value.d
; LockMutex(PBMap\Drawing\Mutex)
Value = PBMap\TargetLocation\Latitude Value = PBMap\TargetLocation\Latitude
; UnlockMutex(PBMap\Drawing\Mutex)
ProcedureReturn Value ProcedureReturn Value
EndProcedure EndProcedure
Procedure.d GetLongitude() Procedure.d GetLongitude()
Protected Value.d Protected Value.d
; LockMutex(PBMap\Drawing\Mutex)
Value = PBMap\TargetLocation\Longitude Value = PBMap\TargetLocation\Longitude
; UnlockMutex(PBMap\Drawing\Mutex)
ProcedureReturn Value ProcedureReturn Value
EndProcedure EndProcedure
Procedure.i GetZoom() Procedure.i GetZoom()
Protected Value.d Protected Value.d
; LockMutex(PBMap\Drawing\Mutex)
Value = PBMap\Zoom Value = PBMap\Zoom
; UnlockMutex(PBMap\Drawing\Mutex)
ProcedureReturn Value ProcedureReturn Value
EndProcedure EndProcedure
@@ -1010,7 +925,7 @@ Module PBMap
MouseX = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX) - PBMap\MoveStartingPoint\x MouseX = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX) - PBMap\MoveStartingPoint\x
MouseY = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY) - PBMap\MoveStartingPoint\y MouseY = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY) - PBMap\MoveStartingPoint\y
PBMap\Moving = #True PBMap\Moving = #True
;move Marker ;Move marker
If PBMap\EditMarkerIndex > -1 If PBMap\EditMarkerIndex > -1
SelectElement(PBMap\Marker(), PBMap\EditMarkerIndex) SelectElement(PBMap\Marker(), PBMap\EditMarkerIndex)
LatLon2XY(@PBMap\Marker()\Location, @Marker) LatLon2XY(@PBMap\Marker()\Location, @Marker)
@@ -1021,29 +936,19 @@ Module PBMap
;New move values ;New move values
PBMap\Position\x - MouseX PBMap\Position\x - MouseX
PBMap\Position\y - MouseY PBMap\Position\y - MouseY
;-*** Fill parameters and signal the drawing thread
; LockMutex(PBMap\Drawing\Mutex)
;PBMap tile position in tile.decimal ;PBMap tile position in tile.decimal
PBMap\Drawing\Position\x = PBMap\Position\x / PBMap\TileSize PBMap\Drawing\Position\x = PBMap\Position\x / PBMap\TileSize
PBMap\Drawing\Position\y = PBMap\Position\y / PBMap\TileSize PBMap\Drawing\Position\y = PBMap\Position\y / PBMap\TileSize
PBMap\Drawing\PassNb = 1 PBMap\Drawing\PassNb = 1
XY2LatLon(@PBMap\Drawing, @PBMap\TargetLocation) XY2LatLon(@PBMap\Drawing, @PBMap\TargetLocation)
;If CallBackLocation send Location to function ;If CallBackLocation send Location to function
If PBMap\CallBackLocation > 0 If PBMap\CallBackLocation > 0
CallFunctionFast(PBMap\CallBackLocation, @PBMap\TargetLocation) CallFunctionFast(PBMap\CallBackLocation, @PBMap\TargetLocation)
EndIf EndIf
; UnlockMutex(PBMap\Drawing\Mutex)
EndIf EndIf
;Start drawing Drawing()
;SignalSemaphore(PBMap\Drawing\Semaphore)
DrawingThread()
;- ***
PBMap\MoveStartingPoint\x = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX) PBMap\MoveStartingPoint\x = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseX)
PBMap\MoveStartingPoint\y = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY) PBMap\MoveStartingPoint\y = GetGadgetAttribute(PBMap\Gadget, #PB_Canvas_MouseY)
; DrawingThread()
EndIf EndIf
Case #PB_EventType_LeftButtonUp Case #PB_EventType_LeftButtonUp
PBMap\Moving = #False PBMap\Moving = #False
@@ -1051,16 +956,14 @@ Module PBMap
If PBMap\EditMarkerIndex > -1 If PBMap\EditMarkerIndex > -1
PBMap\EditMarkerIndex = -1 PBMap\EditMarkerIndex = -1
Else ;Move Map Else ;Move Map
;LockMutex(PBMap\Drawing\Mutex)
PBMap\Drawing\Position\x = PBMap\Position\x / PBMap\TileSize PBMap\Drawing\Position\x = PBMap\Position\x / PBMap\TileSize
PBMap\Drawing\Position\y = PBMap\Position\y / PBMap\TileSize PBMap\Drawing\Position\y = PBMap\Position\y / PBMap\TileSize
MyDebug("PBMap\Drawing\Position\x " + Str(PBMap\Drawing\Position\x) + " ; PBMap\Drawing\Position\y " + Str(PBMap\Drawing\Position\y) ) MyDebug("PBMap\Drawing\Position\x " + Str(PBMap\Drawing\Position\x) + " ; PBMap\Drawing\Position\y " + Str(PBMap\Drawing\Position\y) )
XY2LatLon(@PBMap\Drawing, @PBMap\TargetLocation) XY2LatLon(@PBMap\Drawing, @PBMap\TargetLocation)
; UnlockMutex(PBMap\Drawing\Mutex) Drawing()
DrawingThread()
EndIf EndIf
Case #PB_MAP_REDRAW Case #PB_MAP_REDRAW
DrawingThread() Drawing()
EndSelect EndSelect
EndSelect EndSelect
EndSelect EndSelect
@@ -1140,7 +1043,6 @@ CompilerIf #PB_Compiler_IsMainFile
EndProcedure EndProcedure
;- MAIN TEST ;- MAIN TEST
OpenConsole()
If OpenWindow(#Window_0, 260, 225, 700, 571, "PBMap", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_SizeGadget) If OpenWindow(#Window_0, 260, 225, 700, 571, "PBMap", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
LoadFont(0, "Arial", 12) LoadFont(0, "Arial", 12)
@@ -1210,10 +1112,10 @@ CompilerIf #PB_Compiler_IsMainFile
CompilerEndIf CompilerEndIf
; IDE Options = PureBasic 5.42 LTS (Windows - x86) ; IDE Options = PureBasic 5.42 LTS (Windows - x86)
; ExecutableFormat = Console ; CursorPosition = 272
; CursorPosition = 333 ; FirstLine = 262
; FirstLine = 331
; Folding = --------- ; Folding = ---------
; EnableUnicode ; EnableUnicode
; EnableThread ; EnableThread
; EnableXP ; EnableXP
; DisableDebugger