Easy compilation of your games for iOS

Posted on

screenshot
screenshot2
screenshot3
screenshot4
screenshot5
screenshot6
screenshot7

Trivially easy compilation of your games to iOS!!!

You can now take any Castle Game Engine game, and recompile it for iOS (iPhone, iPad) easily. No need to write *any* iOS-specific code. Short instructions:

  1. Follow iOS documentation to get FPC, with a cross-compiler, for iOS targets.
  2. Inside CastleEngineManifest.xml, define game_units="...", listing the necessary game units to be included in your lpr. It’s often just a single unit, that pulls other units along as dependencies.
  3. Run "castle-engine package --target=ios --verbose" in console.
  4. Open the resulting project in XCode. From XCode you can build it, run it in a simulator, publish… I emphasize that the project builds out-of-the-box on Xcode, zero modifications on your side are necessary. Just open the project, and press “Run” button in XCode.

I will be posting more details (and polishing some rough edges) soon πŸ™‚ Learn more about the build tool (“castle-engine”) and CastleEngineManifest.xml at these wiki pages. I just updated them with information about --target=ios and game_units.

Many thanks go to Szymon Stoma and Ten Square Games for making Apple hardware available to me, making it all possible!

And a great many thanks to Jan Adamec, who made the initial iOS work in our engine! Everything I did was just rehashing of that work, to integrate it with the build tool.

8 Replies to “Easy compilation of your games for iOS”

  1. Execuse me for my poor English. Can you tell me why there is no edit or combobox, or any other text input control in the castle game engine.

    1. It is simply not implemented yet. There is something resembling an edit box used internally as part of MessageInput function (it asks user to input some string). But I never needed a normal TCastleEditBox or TCastleComboBox or TCastleMemo so far… Adding them is easy, I can add one or two this weekend if you need it:) Which one do you need most — edit box, combo box, something similar?

      1. Thank you for your engine and your reply. Sometimes we need customize our input message box, we will be grateful if you can add the edit box control.

        1. > Thank you for your engine and your reply. Sometimes we need customize our input message box, we will be grateful if you can add the edit box control.

          You’re most welcome:) I’ll add a TCastleEditBox this weekend!

    2. The TCastleEdit is implemented now:) Just a simple edit box. It isn’t perfect yet (see below for “known issues”), but should be useful for simple input like a user nickname or such.

      – Get the engine code from GitHub https://github.com/castle-engine/castle-engine/ and try the castle-engine/examples/2d_standard_ui/edit_box/game.pas demo !
      – You can also browse the demo unit here: https://github.com/castle-engine/castle-engine/blob/master/examples/2d_standard_ui/edit_test/game.pas
      – The code is inside https://github.com/castle-engine/castle-engine/blob/master/src/ui/opengl/castlecontrols_edit.inc . Has some comments about what do the properties mean.

      Known issues:

      1. Right now, we don’t have a persistent concept of “currently focused control”. This means that the keys pressed are passed to the edit box under the mouse pointer (if TCastleEdit.CaptureAllInput = false) or, just always (if TCastleEdit.CaptureAllInput = true). So it’s most comfortable to use when you only have a single TCastleEdit visible at once, then you can set CaptureAllInput = true, otherwise using this is a little weird from the user point of view. Well, but we have to start from something:)

      2. On mobile, while you can run this demo, we don’t have a procedure to show the on-screen keyboard for now.

      3. It’s currently not integrated with clipboard (Ctrl + X / Ctrl + C / Ctrl + V do not work).

      4. It doesn’t scroll properly when the text is longer than the displayed width.

      5. There is no cursor movement within the edit field. Cursor is always at the end, and you can use backspace to delete last character.

      All of these will be fixed at some point:) It’s all to-be-improved, it just takes time:) All the points except 1. are actually quite easy to fix.

      Please let me know if this is useful for you, and if one of the disadvantages above is critical to be fixed for you!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.