PBFX 1.70a Mapping Test
Here's the first look see (for what's it worth) of the rebuilt mapping engine. While I could I have 'modified' the original edition of the library, it really needed to be re-written around the new image system. Which is the current little task. Initially, I was expecting the first slapped together version it to be slower than the older mature version of the library found PB1.63 for example. But interestingly the code bellow is running 80fps quicker in PB1.70a than PB1.63n. Which is more a collective improvement than just the map rendering thing I think.
CreateMap 1,176
BlockWidth=32
BlockHeight=32
TileX=800/BlockWidth
TileY=(600/Blockheight)+1
CreateLevel 1,50,tileX,Tiley
NumbOfBlocks=TileX*TileY
CreateMapGFX 1,BlockWidth,BlockHeight,NumbOfBlocks,$0
LoadImage "Pics\PB_ForestBlast_V012.JPG",1
RenderToImage 1
Ypos=0
Xpos=0
for lp=0 to NumbOfBlocks-1
GetMapBlk 1,lp,Xpos,Ypos
Xpos=Xpos+BlockWidth
if Xpos>=GetSurfaceWidth()
Xpos=0
Ypos=Ypos+Blockheight
endif
next
RenderToImage 0
Block=0
For ylp=0 to GetLevelHeight(1,50)-1
For Xlp=0 to GetLevelWidth(1,50)-1
PokeLevelTile 1,50,Xlp,ylp,block
inc block
next
next
Do
Cls 255
t=timer()
DrawMap 1,50,0,0
tt#=tt#+(timer()-t)
inc frames
TileXpos=(mousex()/GetMapBlockWidth(1))
TileYpos=(mousey()/GetMapBlockHeight(1))
pokeleveltile 1,50,TileXpos,TileYpos,TileXpos ;rnd(100)
setcursor 0,0
print fps()
print TT#/frames
print GetMapBlockQuantity(1)
Print "status:"+str$(GetLevelstatus(1,50))
Print GetLevelWidth(1,50)
Print GetLevelHeight(1,50)
Print GetMapLevels(1)
Print GetMapBlockStatus(1)
Print GetMapBlockWidth(1)
Print GetMapBlockHeight(1)
Print GetMapBlockQuantity(1)
Print GetMapMaskColour(1)
print TileXpos
print TileYpos
Sync
loop