1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2011-2014 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.
18 new_annotation app_name
19 new_annotation app_version
22 # App subclasses are cross-platform applications
24 # This class is redefed by plateform modules and so
25 # App can be specialized directly in the user app.
29 # Starts the internal setup of graphical and other stuff
30 # Is called just before run
33 # Main entry point of your application
36 # Prefix to all log messages, used by `log_error`, `log_warning` and `log_info`.
37 fun log_prefix
: String do return "app.nit"
39 # Helper function for logging errors
40 fun log_error
(msg
: String) do sys
.stderr
.write
"{log_prefix} error: {msg}\n"
42 # Helper function for logging warnings
43 fun log_warning
(msg
: String) do sys
.stderr
.write
"{log_prefix} warn: {msg}\n"
45 # Main init method for graphical stuff
46 # Is called when display is ready so graphical assets
47 # can be loaded at this time.
48 fun window_created
do end
50 # Called before destroying the window
51 fun window_closing
do end
54 protected fun app
: App do return once
new App