Hello GDX gurus!
My game has a small shop where you can buy an "Extra Life".
The default texture for this item is bundled with the apk and initialized in LG_Create.
If I want, however, to update the in-game shop graphical assets, I don't want to force the user to download and updated version of the game.
Instead, the game itself checks the server for new textures and downloads them accordingly.
So far this part is done and working properly.
The code below saves the new texture in the internal assets folder:
Sub JobDone
Case "GetItem01BUY_Texture"
If File.Exists(File.DirInternal, "item01buy_texture.png") Then File.Delete(File.DirInternal, "item01buy_texture.png")
Dim Item01BUY_Texture_file As OutputStream
Item01BUY_Texture_file = File.OpenOutput(File.DirInternal, "item01buy_texture.png", False)
File.Copy2(Job.GetInputStream, Item01BUY_Texture_file)
Item01BUY_Texture_file.Close
If File.Exists(File.DirInternal, "item01buy_texture.png") Then
Downloaded_Texture = True
End If
End Sub
Now... how can I load this new PNG file into the 'extra_life_source' variable (lgTexture)?
I can't do it in LG_Create since the download happens during LG_Render.
Sub Globals
...
Dim extra_life_source As lgTexture
...
End Sub
Sub LG_Create
...
extra_life_source.Initialize("default_texture.png")
...
End Sub
Sub LG_Render
...
If Downloaded_Texture = True Then
'Replace the default texture with new downloaded texture
extra_life_source = "item01buy_texture.png"
'and do this only one time
Downloaded_Texture = False
End If
...
End Sub
Sub LG_Dispose
...
extra_life_source.dispose
...
End Sub
Please help me with this
IF statement in
LG_Render, since the above it's only pseudo-code.
Thanks in advance.