Delphi Sprite Engine Part 55 Deploying To iOS or Android
Delphi Sprite Engine Part 55 Deploying To iOS or Android
It’s time for a little house keeping, and to see this sprite engine deployed to iOS and
Android.
At the end of part 5, I found myself dissatisfied with the sprite engine code so far. It has
several warnings, an ugly fix to TSprite.Render() to resolve missing textures when deployed
to ARC, and I’ve not yet demonstrated deployment to iOS and/or Android.
So I’ve decided to slot this part 5.5 in here to address these issues.
I’ve gone through the code and resolved any outstanding warnings. I’ve also removed the
‘fMaterial’ private member from the TSprite class, and instead of keeping that local
reference, I’ve added a TMaterialSource to the TSpriteSheet class. This TMaterialSource is
private, but may be accessed through the public ‘SourceImage’ and ‘Material’ properties.
Deploying to Android.
When you extract the source code file above, set the target for the ‘SpriteEngineTest’ to
‘Android’ and hit run, you’ll find that the project already contains the deployment options to
send the ‘pigeon.dat’ file over to the android device.
In the IDE select “Project/Deployment” from the menu and ensuring that “debug
configuration – android platform” is selected in the drop-down at the top, notice that I’ve set
the remote path for ‘pigeon.dat’ to “assets\internal”.
In code, this location is addressed in the OnCreate event handler for the form:
1/2
Deploying to iOS
Deploying to Windows
Deploying to Mac
I’ve not tried deploying to Mac yet, though it should be a matter of altering the conditional
defines in the forms creation so that Mac targets also expect the .dat file next to the binary
executable, and then deploying the file accordingly. I’ll update on this when I actually try it.
Conclusion
With cleaner code, and deployment demonstrated, I now feel a lot better about proceeding
on to our next goal! See you next time.
2/2