Hi all,
I have a question about the correct way of using the functions RenderToImage() and SetRenderToImage().
The following code works correctly on Windows, but doesn't on Android (nothing appear).
Do you have any idea about what could be wrong with it?
The purpose is to create a sprite with walls (top, right, bottom and left) by reading a value in a table.
// #Data for g_iLevelWalls
renderImage as integer
for y = 0 to g_iLevelSizeY-1
if ( FileEOF ( iFileID ) = 0 )
sFileLine = ReadLine ( iFileID )
w = Split ( sFileLine, "," )
for x = 0 to g_iLevelSizeX-1
g_iLevelWalls [y*(g_iLevelSizeX)+x] = val( w[x] )
if (val( w[x] ) <> 0)
renderImage = CreateRenderImage ( 40, 40, 0, 0 )
SetRenderToImage ( renderImage, 0 )
SetVirtualResolution ( 40, 40 )
ClearScreen ( )
SetImageTransparentColor ( renderImage, 0, 0, 0 )
if ((val( w[x] ) && CC_GFX_WALL_TOP) = CC_GFX_WALL_TOP)
s = CreateSprite ( g_iGfxWallTop )
SetSpritePosition ( s, 0, 4 )
DrawSprite (s)
DeleteSprite (s)
endif
if ((val( w[x] ) && CC_GFX_WALL_RIGHT) = CC_GFX_WALL_RIGHT)
s = CreateSprite ( g_iGfxWallRight )
SetSpritePosition ( s, 32, 0 )
DrawSprite (s)
DeleteSprite (s)
endif
if ((val( w[x] ) && CC_GFX_WALL_BOTTOM) = CC_GFX_WALL_BOTTOM)
s = CreateSprite ( g_iGfxWallBottom )
SetSpritePosition ( s, 0, 32 )
DrawSprite (s)
DeleteSprite (s)
endif
if ((val( w[x] ) && CC_GFX_WALL_LEFT) = CC_GFX_WALL_LEFT)
s = CreateSprite ( g_iGfxWallLeft )
SetSpritePosition ( s, 4, 0 )
DrawSprite (s)
DeleteSprite (s)
endif
SetRenderToScreen ( )
SetVirtualResolution ( CC_SCREENX, CC_SCREENY )
s = CreateSprite ( renderImage )
SetSpriteTransparency (s, 1)
SetSpritePosition ( s, x*32+CC_SPRITE_SIZE/2-4, (y+2)*32+CC_SPRITE_SIZE/2-4 )
SetSpriteDepth ( s, 100)
endif
next
endif
next
Thanks all.