Use onQuit/quit instead of onApplicationExit
This commit is contained in:
@@ -112,7 +112,7 @@ class NativeApplication {
|
|||||||
var result = lime_application_exec (handle);
|
var result = lime_application_exec (handle);
|
||||||
__cleanup ();
|
__cleanup ();
|
||||||
|
|
||||||
parent.onExit.dispatch (result);
|
parent.onQuit.dispatch ();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ class Application extends Module {
|
|||||||
public var modules (default, null):Array<IModule>;
|
public var modules (default, null):Array<IModule>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit events are dispatched when the application is closing
|
* Quit events are dispatched when the application is being closed
|
||||||
*/
|
*/
|
||||||
public var onExit = new Event<Int->Void> ();
|
public var onQuit = new Event<Void->Void> ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update events are dispatched each frame (usually just before rendering)
|
* Update events are dispatched each frame (usually just before rendering)
|
||||||
@@ -60,8 +60,8 @@ class Application extends Module {
|
|||||||
windows = new Array ();
|
windows = new Array ();
|
||||||
backend = new ApplicationBackend (this);
|
backend = new ApplicationBackend (this);
|
||||||
|
|
||||||
onExit.add (onApplicationExit);
|
|
||||||
onUpdate.add (update);
|
onUpdate.add (update);
|
||||||
|
onQuit.add (quit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,17 +187,6 @@ class Application extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override function onApplicationExit (code:Int):Void {
|
|
||||||
|
|
||||||
for (module in modules) {
|
|
||||||
|
|
||||||
module.onApplicationExit (code);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override function onGamepadAxisMove (gamepad:Gamepad, axis:GamepadAxis, value:Float):Void {
|
public override function onGamepadAxisMove (gamepad:Gamepad, axis:GamepadAxis, value:Float):Void {
|
||||||
|
|
||||||
for (module in modules) {
|
for (module in modules) {
|
||||||
@@ -581,6 +570,17 @@ class Application extends Module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override function quit ():Void {
|
||||||
|
|
||||||
|
for (module in modules) {
|
||||||
|
|
||||||
|
module.quit ();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public override function render (context:RenderContext):Void {
|
public override function render (context:RenderContext):Void {
|
||||||
|
|
||||||
for (module in modules) {
|
for (module in modules) {
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ interface IModule {
|
|||||||
public function init (context:RenderContext):Void;
|
public function init (context:RenderContext):Void;
|
||||||
|
|
||||||
|
|
||||||
public function onApplicationExit (code:Int):Void;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a gamepad axis move event is fired
|
* Called when a gamepad axis move event is fired
|
||||||
* @param gamepad The current gamepad
|
* @param gamepad The current gamepad
|
||||||
@@ -255,6 +252,12 @@ interface IModule {
|
|||||||
public function onWindowRestore ():Void;
|
public function onWindowRestore ():Void;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a quit event is fired
|
||||||
|
*/
|
||||||
|
public function quit ():Void;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a render event is fired
|
* Called when a render event is fired
|
||||||
* @param context The current render context
|
* @param context The current render context
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ class Module implements IModule {
|
|||||||
public function init (context:RenderContext):Void { }
|
public function init (context:RenderContext):Void { }
|
||||||
|
|
||||||
|
|
||||||
public function onApplicationExit (code:Int):Void { }
|
|
||||||
|
|
||||||
|
|
||||||
public function onGamepadAxisMove (gamepad:Gamepad, axis:GamepadAxis, value:Float):Void { }
|
public function onGamepadAxisMove (gamepad:Gamepad, axis:GamepadAxis, value:Float):Void { }
|
||||||
public function onGamepadButtonDown (gamepad:Gamepad, button:GamepadButton):Void { }
|
public function onGamepadButtonDown (gamepad:Gamepad, button:GamepadButton):Void { }
|
||||||
public function onGamepadButtonUp (gamepad:Gamepad, button:GamepadButton):Void { }
|
public function onGamepadButtonUp (gamepad:Gamepad, button:GamepadButton):Void { }
|
||||||
@@ -227,6 +224,12 @@ class Module implements IModule {
|
|||||||
public function onWindowRestore ():Void { }
|
public function onWindowRestore ():Void { }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a quit event is fired
|
||||||
|
*/
|
||||||
|
public function quit ():Void { }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a render event is fired
|
* Called when a render event is fired
|
||||||
* @param context The current render context
|
* @param context The current render context
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class System {
|
|||||||
|
|
||||||
// TODO: Clean exit?
|
// TODO: Clean exit?
|
||||||
|
|
||||||
Application.current.onExit.dispatch (code);
|
Application.current.onQuit.dispatch ();
|
||||||
|
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|||||||
Reference in New Issue
Block a user