0% found this document useful (0 votes)
77 views

Delphi Sprite Engine Part 55 Deploying To iOS or Android

This document discusses deploying a Delphi sprite engine project to iOS, Android, Windows, and Mac. It details resolving code warnings and issues, removing unused code, and configuring deployment settings so that the sprite asset file is copied to the proper location on each platform for loading at runtime. The iOS and Android projects are already pre-configured to deploy the asset file, while Windows simply requires the file next to the executable. Deploying to Mac is untested but should work similarly to Windows.

Uploaded by

Deshone Marshall
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Delphi Sprite Engine Part 55 Deploying To iOS or Android

This document discusses deploying a Delphi sprite engine project to iOS, Android, Windows, and Mac. It details resolving code warnings and issues, removing unused code, and configuring deployment settings so that the sprite asset file is copied to the proper location on each platform for loading at runtime. The iOS and Android projects are already pre-configured to deploy the asset file, while Windows simply requires the file next to the executable. Deploying to Mac is untested but should work similarly to Windows.

Uploaded by

Deshone Marshall
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Delphi Sprite Engine – Part 5.

5 – Deploying to iOS or Android


chapmanworld.com/2015/03/09/delphi-sprite-engine-part-5-5-deploying-to-ios-or-android/

Craig Chapman March 9,


2015

[If you’re new to this series, you may wish


to skip ahead to part-7, where I’ve done a
partial ‘start-over’]

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.

Code tidy up.

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.

Get the latest sources here: SpriteEngine_r4

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:

FS := TFileStream.Create(TPath.GetDocumentsPath + PathDelim + 'pigeon.dat',fmOpenRead);

As a result, the application is able to locate and load ‘pigeon.dat’ and…

1/2
Deploying to iOS

Just as with the Android platform above, the


source code download above is pre-configured to deploy the ‘pigeon.dat’ file to the iOS
device. Take a look at the deployment options as you did for the android platform and you’ll
notice that the remote path is set to ‘StartUp\Documents’ the result…

Deploying to Windows

As I’m sure you’re aware by now, deploying to


windows is as simple as ensuring that the ‘pigeon.dat’ file is sitting right along-side the exe
when you launch the application.

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.

Thanks for reading!

2/2

You might also like