Hi, I’ve got a question - is it possible to get current renderer and assign it to Render variable in Main function in lime?
Something like:
import lime.graphics.Renderer;
class Main extends Application {
private var currentRenderer:Renderer;
public function new () {
super ();
currentRenderer = ???
}
}
import lime.graphics.Renderer;
class Main extends Application {
private var currentRenderer:Renderer;
public function new () {
super ();
currentRenderer = renderer;
}
}
Or, since the renderer variable already exists, you can use that instead of currentRenderer.
Oh, I thought it was it, but right after super it is null. Is stepping into “while loop untill preloader.complete will be true” a good solution if I need to have acces to renderer in new function? Or I have something wrong and it should not be null immediately? I am running desktop target (linux).
Ah, looks like it won’t be defined until create() is called.
Maybe you could override that, and do all your initialization there:
class Main extends Application {
public function new () {
super ();
//Move all your initialization code from here...
}
public override function create (config:Config):Void {
super.create (config);
//...to here.
}
}