gamnit_android

Dependencies

dep_module_gamnit__gamnit_androidandroidandroidgamnitgamnitinput_eventsinput_eventsrealtimerealtimedisplay_androiddisplay_androidsensorssensorsgamnit_androidgamnit_androidsensors->gamnit_androidgamnit_android->androidgamnit_android->gamnitgamnit_android->input_eventsgamnit_android->realtimegamnit_android->display_androidandroid19android19android19->gamnit_androidcamera_control_androidcamera_control_androidcamera_control_android->gamnit_android

Imports

  • android: Android services and implementation of app.nit
  • display_android: Gamnit display implementation for Android
  • gamnit: Game and multimedia framework for Nit
  • input_events: Pointer and hardware key events
  • realtime: Services to keep time of the wall clock time

Concerns

  • gamnit: Portable game and multimedia framework for Nit
    • display: Abstract display services
  • core: Nit common library of core classes and methods
    • kernel: Most basic classes and methods.
  • app: app.nit, a framework for portable applications
    • app_base: Base of the app.nit framework, defines App
  • android: Android platform support and APIs

from gamnit::display

from core::kernel

Sys

redef class Sys

The main class of the program.

Sys is a singleton class, its only instance is accessible from everywhere with sys.

Because of this, methods that should be accessible from everywhere, like print or exit, are defined in Sys. Moreover, unless there is an ambiguity with self, the receiver of a call to these methods is implicitly sys. Basically it means that the two following instructions are equivalent.

print "Hello World"
sys.print "Hello World"

Methods Implicitly Defined in Sys

Sys is the class where are defined top-level methods, i.e. those defined outside of any class like in a procedural language. Basically it means that

redef class Sys
   fun foo do print "hello"
end

is equivalent with

fun foo print "hello"

As a corollary, in a top-level method, self (the current receiver) is always sys.

from app::app_base

App

app::App

redef class App

App subclasses are cross-platform applications

This class is refined by platform modules and so App can be specialized directly in the user application code.

Redefines
  • init_window: Notification from the native_app glue framework, a new ANativeWindow is ready
  • term_window: Notification from the native_app glue framework, the existing window needs to be terminated
  • resume: Notification from the Android framework, native_activity has been resumed
  • pause: Notification from the Android framework, your app has been paused
  • gained_focus: Notification from the Android framework, native_activity has gained focus
  • lost_focus: Notification from the Android framework, native_activity has lost focus
  • destroy: Notification from the Android framework, native_activity is being destroyed
  • start: Notification from the Android framework, native_activity has been started
  • stop: Notification from the Android framework, your app has been stopped
  • config_changed: Notification from the Android framework, the current device configuration has changed
  • window_resized: Notification from the Android framework, the window has been resized.
  • content_rect_changed: Notification from the Android framework, the content area of the window has changed
  • recreate_gamnit: Hook to prepare for recreating the OpenGL context
  • run: Main entry point of your application

from android::activities