-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help] How to use ImagineEngine in native development #49
Comments
Hi @pmlbrito 👋 Thanks a lot for opening an issue, it's so much easier than on Twitter 👍 Welcome to Imagine Engine, very exciting that you are trying it out! Since it hasn't been open sourced for long, there's a ton of documentation, guides and tutorials that need to be written, but in the meantime, let me show you how I have setup Imagine Engine in my game Revazendo. Since Revazendo is a 100% Imagine Engine powered game I use @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let scene = RevazendoScene(size: UIScreen.main.bounds.size)
let window = GameWindow(scene: scene)
window.makeKeyAndVisible()
self.window = window
return true
}
} You could of course just use To answer your question about whether to use multiple or a single class MenuScene: Scene {
func setup() {
events.clicked.addObserver(self) { scene in
game?.scene = LevelScene(size: scene.size)
}
}
} Or you could use a Hope the above gives you some insight into how you can setup Imagine Engine in a real app. Let me know if I can help in any other way or answer any other questions - and I'm soon going to post the next tutorial which will be a step by step guide to setting up a cross-platform app using Imagine. |
Hi @JohnSundell Thank you very much for your fast response. Also, it was very enlightening, as you answered pretty much everything I was thinking about. `class ViewController: UIViewController {
} class WalkaboutScene: Scene {...}` Anyway, you actually answered a lot more than I asked and gave me a lot of information on how I can continue with my experiments. This is a great project you have here! I'll keep following it actively! Great Work!! And thank you very much for your support! |
@pmlbrito My pleasure 😄 Happy to help! To add a child view controller to a let game = Game(scene: scene)
game.view.frame = view.bounds
view.addSubview(game.view) That should do it 👍 |
Cool if I close this one @pmlbrito? |
Sorry, didn't have the chance to come here and close it myself. It's cool to close, you've been a great help! |
👍 |
Hi John,
I'm opening this issue after our small twitter ping-pong chat.
I'm here to ask for your help on how to incorporate the ImagineEngine in the context of a native app. I started messing around the playground you created, and then I tried to port it to a full fledged app starting a blank application.
I went through the code and came up that the GameViewController is a (closed) subclass of UIViewController, and that we have to feed it the Scene class where we describe the state of the components, actors and stuff. However (I didn't spend a lot of time into it yet), I couldn't get it to load the playground code in the app as I wasn't able to figure out how to transition between viewcontrollers (is that even possible?). A full fledged app would have more than one gameviewcontroller? Is the game flow represented only by scenes in one gameviewcontroller?
Thanks in advance
The text was updated successfully, but these errors were encountered: