68af6977bb08a4d8825948eb0cf63b80eb44dec8
1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2011-2013 Alexis Laferrière <alexis.laf@xymus.net>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # General Mnit application structure
23 # An App instance serves as base to every Mnit projects.
25 # This class is redefed by plateforme modules and so
26 # App can be specialized directly in the user app.
32 # Display to use by apps
33 # Is null if the display is not available or not yet ready
34 var display
: nullable D
protected writable = null
37 var quit
: Bool writable = false
41 # App is visible? (vs minimized or in background)
42 fun visible
: Bool is abstract
44 # Invoqued at each frame
45 # Usually you want to redef frame_core instead of this
48 var display
= self.display
49 if display
!= null then
56 # Main frame method to redef
57 # Is called between readying display and flipping it
58 fun frame_core
( display
: D
) is abstract
64 # Called when asked by the system (mainly for Android)
67 # Called when asked by the system (mainly for Android)
70 # Called when asked by the system (mainly for Android)
74 fun gained_focus
do end
79 # Main init method for graphical stuff
80 # Is called when display is ready so graphical assets
81 # can be loaded at this time.
82 fun init_window
do end
84 # Called before destroying the window
85 fun term_window
do end
87 # Receive and deal with all inputs
88 fun input
( event
: InputEvent ): Bool
93 # Internal method to generate inputs
94 protected fun generate_input
is abstract
97 # Usually you want to redef framw_core instead of this