syntax
This commit is contained in:
38
osm.pb
38
osm.pb
@@ -175,7 +175,7 @@ Module OSM
|
|||||||
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
curl_easy_setopt(curl, #CURLOPT_FOLLOWLOCATION, 1)
|
||||||
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
curl_easy_setopt(curl, #CURLOPT_TIMEOUT, Timeout)
|
||||||
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 1)
|
curl_easy_setopt(curl, #CURLOPT_VERBOSE, 1)
|
||||||
curl_easy_setopt(curl, #CURLOPT_CONNECTTIMEOUT, 0)
|
;curl_easy_setopt(curl, #CURLOPT_CONNECTTIMEOUT, 60)
|
||||||
|
|
||||||
If Len(ProxyURL$)
|
If Len(ProxyURL$)
|
||||||
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
;curl_easy_setopt(curl, #CURLOPT_HTTPPROXYTUNNEL, #True)
|
||||||
@@ -512,8 +512,29 @@ Module OSM
|
|||||||
|
|
||||||
MovePathCursor(x, y)
|
MovePathCursor(x, y)
|
||||||
DrawVectorImage(ImageID(*Tile\nImage))
|
DrawVectorImage(ImageID(*Tile\nImage))
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure DrawLoading(*Tile.Tile)
|
||||||
|
|
||||||
|
Protected x = *Tile\Position\x
|
||||||
|
Protected y = *Tile\Position\y
|
||||||
|
Protected Text$ = "Loading"
|
||||||
|
|
||||||
|
; Debug " Drawing tile nb " + " X : " + Str(*Tile\OSMTileX) + " Y : " + Str(*Tile\OSMTileX)
|
||||||
|
; Debug " at coords " + Str(x) + "," + Str(y)
|
||||||
|
|
||||||
|
BeginVectorLayer()
|
||||||
|
;MovePathCursor(x, y)
|
||||||
|
VectorSourceColor(RGBA(255, 255, 255, 128))
|
||||||
|
AddPathBox(x, y, OSM\TileSize, OSM\TileSize)
|
||||||
|
FillPath()
|
||||||
MovePathCursor(x, y)
|
MovePathCursor(x, y)
|
||||||
DrawVectorText(Str(x) + ", " + Str(y))
|
VectorFont(FontID(OSM\Font), OSM\TileSize / 20)
|
||||||
|
VectorSourceColor(RGBA(150, 150, 150, 255))
|
||||||
|
MovePathCursor(x + (OSM\TileSize - VectorTextWidth(Text$)) / 2, y + (OSM\TileSize - VectorTextHeight(Text$)) / 2)
|
||||||
|
DrawVectorText(Text$)
|
||||||
|
EndVectorLayer()
|
||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
@@ -565,6 +586,7 @@ Module OSM
|
|||||||
DrawTile(*NewTile)
|
DrawTile(*NewTile)
|
||||||
Else
|
Else
|
||||||
;Debug "Image missing"
|
;Debug "Image missing"
|
||||||
|
DrawLoading(*NewTile)
|
||||||
*Drawing\Dirty = #True ;Signals that this image is missing so we should have to redraw
|
*Drawing\Dirty = #True ;Signals that this image is missing so we should have to redraw
|
||||||
EndIf
|
EndIf
|
||||||
|
|
||||||
@@ -681,6 +703,8 @@ Module OSM
|
|||||||
|
|
||||||
EndProcedure
|
EndProcedure
|
||||||
|
|
||||||
|
;-*** Main drawing thread
|
||||||
|
; always running, waiting for a semaphore to start refreshing
|
||||||
Procedure DrawingThread(*SharedDrawing.DrawingParameters)
|
Procedure DrawingThread(*SharedDrawing.DrawingParameters)
|
||||||
|
|
||||||
Protected Drawing.DrawingParameters
|
Protected Drawing.DrawingParameters
|
||||||
@@ -692,11 +716,12 @@ Module OSM
|
|||||||
|
|
||||||
; Debug "--------- Main drawing thread ------------"
|
; Debug "--------- Main drawing thread ------------"
|
||||||
|
|
||||||
;Creates a copy of the structure to work with, and precalculus some values
|
;Creates a copy of the structure to work with
|
||||||
LockMutex(*SharedDrawing\Mutex)
|
LockMutex(*SharedDrawing\Mutex)
|
||||||
CopyStructure(*SharedDrawing, @Drawing, DrawingParameters)
|
CopyStructure(*SharedDrawing, @Drawing, DrawingParameters)
|
||||||
UnlockMutex(*SharedDrawing\Mutex)
|
UnlockMutex(*SharedDrawing\Mutex)
|
||||||
|
|
||||||
|
;Precalc some values
|
||||||
Drawing\CenterX = GadgetWidth(OSM\Gadget) / 2
|
Drawing\CenterX = GadgetWidth(OSM\Gadget) / 2
|
||||||
Drawing\CenterY = GadgetHeight(OSM\Gadget) / 2
|
Drawing\CenterY = GadgetHeight(OSM\Gadget) / 2
|
||||||
;Pixel shift, aka position in the tile
|
;Pixel shift, aka position in the tile
|
||||||
@@ -715,12 +740,11 @@ Module OSM
|
|||||||
Pointer(Drawing\CenterX, Drawing\CenterY, #Red)
|
Pointer(Drawing\CenterX, Drawing\CenterY, #Red)
|
||||||
StopVectorDrawing()
|
StopVectorDrawing()
|
||||||
|
|
||||||
;- Redraw
|
;Redraw
|
||||||
;If something was not correctly drawn, redraw after a while
|
;If something was not correctly drawn, redraw after a while
|
||||||
LockMutex(*SharedDrawing\Mutex) ;Be sure that we're not modifying while moving (seems not useful, but it is, especially to clean the semaphore)
|
LockMutex(*SharedDrawing\Mutex) ;Be sure that we're not modifying while moving (seems not useful, but it is, especially to clean the semaphore)
|
||||||
If Drawing\Dirty
|
If Drawing\Dirty
|
||||||
; Debug "Something was dirty ! We try again to redraw"
|
; Debug "Something was dirty ! We try again to redraw"
|
||||||
;Delay(250)
|
|
||||||
Drawing\PassNb + 1
|
Drawing\PassNb + 1
|
||||||
SignalSemaphore(*SharedDrawing\Semaphore)
|
SignalSemaphore(*SharedDrawing\Semaphore)
|
||||||
Else
|
Else
|
||||||
@@ -1057,8 +1081,8 @@ CompilerEndIf
|
|||||||
|
|
||||||
; IDE Options = PureBasic 5.42 LTS (Windows - x86)
|
; IDE Options = PureBasic 5.42 LTS (Windows - x86)
|
||||||
; ExecutableFormat = Console
|
; ExecutableFormat = Console
|
||||||
; CursorPosition = 435
|
; CursorPosition = 594
|
||||||
; FirstLine = 448
|
; FirstLine = 569
|
||||||
; Folding = -------
|
; Folding = -------
|
||||||
; EnableUnicode
|
; EnableUnicode
|
||||||
; EnableThread
|
; EnableThread
|
||||||
|
Reference in New Issue
Block a user