Because of the `app` method is a `once new App`, the result of the `new`
is not stored until the `new` returns.
Therefore, suggests to doing stuff during the construction of App might
invoke something that use `app` as a global symbol, thus causing an
infinite recursions.
end
redef class App
- redef init
+ redef fun setup
do
var native_app_glue = native_app_glue
native_app_glue.user_data = self
class App
protected init do end
+ # Starts the internal setup of graphical and other stuff
+ # Is called just before run
+ protected fun setup do end
+
# Main entry point of your application
fun run do end
end
protected fun app: App do return once new App
+app.setup
app.run
redef type D: Opengles1Display
redef type I: Opengles1Image
- redef init
+ redef fun setup
do
display = new Opengles1Display
redef class App
var assets_dir: String
- redef init
+ redef fun setup
do
assets_dir = sys.program_name.dirname + "/../assets/"