Abstract display services

Introduced classes

class GamnitDisplay

gamnit :: GamnitDisplay

General display class, is sized and drawable

Redefined classes

redef class Sys

gamnit :: display $ Sys

The main class of the program.

All class definitions

class GamnitDisplay

gamnit $ GamnitDisplay

General display class, is sized and drawable
redef class Sys

gamnit :: display $ Sys

The main class of the program.
package_diagram gamnit::display display glesv2 glesv2 gamnit::display->glesv2 mnit::input input gamnit::display->mnit::input android android glesv2->android c c glesv2->c core core glesv2->core egl egl glesv2->egl sdl2 sdl2 glesv2->sdl2 realtime realtime glesv2->realtime mnit::input->core ...android ... ...android->android ...c ... ...c->c ...core ... ...core->core ...egl ... ...egl->egl ...sdl2 ... ...sdl2->sdl2 ...realtime ... ...realtime->realtime gamnit::textures textures gamnit::textures->gamnit::display gamnit::programs programs gamnit::programs->gamnit::display gamnit::egl egl gamnit::egl->gamnit::display gamnit::cameras cameras gamnit::cameras->gamnit::display gamnit::gamnit gamnit gamnit::gamnit->gamnit::textures gamnit::gamnit->gamnit::programs gamnit::display_android display_android gamnit::display_android->gamnit::textures gamnit::display_android->gamnit::egl gamnit::display_linux display_linux gamnit::display_linux->gamnit::textures gamnit::display_linux->gamnit::egl gamnit::display_ios display_ios gamnit::display_ios->gamnit::textures gamnit::virtual_gamepad_spritesheet virtual_gamepad_spritesheet gamnit::virtual_gamepad_spritesheet->gamnit::textures gamnit::gamnit... ... gamnit::gamnit...->gamnit::gamnit gamnit::display_android... ... gamnit::display_android...->gamnit::display_android gamnit::display_linux... ... gamnit::display_linux...->gamnit::display_linux gamnit::display_ios... ... gamnit::display_ios...->gamnit::display_ios gamnit::virtual_gamepad_spritesheet... ... gamnit::virtual_gamepad_spritesheet...->gamnit::virtual_gamepad_spritesheet gamnit::cameras_cache cameras_cache gamnit::cameras_cache->gamnit::cameras gamnit::camera_control camera_control gamnit::camera_control->gamnit::cameras gamnit::cameras_cache... ... gamnit::cameras_cache...->gamnit::cameras_cache gamnit::camera_control... ... gamnit::camera_control...->gamnit::camera_control


module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module array

core :: array

This module introduces the standard array structure.
module aware

android :: aware

Android compatibility module
module bitset

core :: bitset

Services to handle BitSet
module bytes

core :: bytes

Services for byte streams and arrays
module c

c :: c

Structures and services for compatibility with the C language
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.
module environ

core :: environ

Access to the environment variables of the process
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module file

core :: file

File manipulations (create, read, write, etc.)
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module kernel

core :: kernel

Most basic classes and methods.
module list

core :: list

This module handle double linked lists
module math

core :: math

Mathematical operations
module native

core :: native

Native structures for text and bytes
module numeric

core :: numeric

Advanced services for Numeric types
module protocol

core :: protocol

module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module re

core :: re

Regular expression support for all services based on Pattern
module ropes

core :: ropes

Tree-based representation of a String.
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module stream

core :: stream

Input and output streams of characters
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O


module glesv2

glesv2 :: glesv2

OpenGL graphics rendering library for embedded systems, version 2.0
module input

mnit :: input

Defines abstract classes for user and general inputs to the application.


module cameras

gamnit :: cameras

Camera services producing Model-View-Projection matrices
module egl

gamnit :: egl

Use of EGL to implement Gamnit on GNU/Linux and Android
module programs

gamnit :: programs

Services for graphical programs with shaders, attributes and uniforms
module textures

gamnit :: textures

Load textures, create subtextures and manage their life-cycle


module a_star-m


module android19

gamnit :: android19

Variation using features from Android API 19
module bmfont

gamnit :: bmfont

Parse Angel Code BMFont format and draw text
module camera_control

gamnit :: camera_control

Simple camera control for user, as the method accept_scroll_and_zoom
module camera_control_android

gamnit :: camera_control_android

Two fingers camera manipulation, pinch to zoom and slide to scroll
module camera_control_linux

gamnit :: camera_control_linux

Mouse wheel and middle mouse button to control camera
module cameras_cache

gamnit :: cameras_cache

Cache the Matrix produced by Camera::mvp_matrix
module cardboard

gamnit :: cardboard

Update the orientation of world_camera at each frame using the head position given by android::cardboard
module depth

gamnit :: depth

Framework for 3D games in Nit
module depth_core

gamnit :: depth_core

Base entities of the depth 3D game framework
module display_android

gamnit :: display_android

Gamnit display implementation for Android
module display_ios

gamnit :: display_ios

Gamnit display implementation for iOS
module display_linux

gamnit :: display_linux

Gamnit display implementation for GNU/Linux using egl, sdl and x11
module dynamic_resolution

gamnit :: dynamic_resolution

Virtual screen with a resolution independent from the real screen
module flat

gamnit :: flat

Simple API for 2D games, built around Sprite and App::update
module flat_core

gamnit :: flat_core

Core services for the flat API for 2D games
module font

gamnit :: font

Abstract font drawing services, implemented by bmfont and tileset
module gamnit

gamnit :: gamnit

Game and multimedia framework for Nit
module gamnit_android

gamnit :: gamnit_android

Support services for Gamnit on Android
module gamnit_ios

gamnit :: gamnit_ios

Support services for gamnit on iOS
module gamnit_linux

gamnit :: gamnit_linux

Support services for Gamnit on GNU/Linux
module input_ios

gamnit :: input_ios

Gamnit event support for iOS
module keys

gamnit :: keys

Simple service keeping track of which keys are currently pressed
module limit_fps

gamnit :: limit_fps

Frame-rate control for applications
module model_dimensions

gamnit :: model_dimensions

Dimensions related services for Model and Mesh
module more_lights

gamnit :: more_lights

More implementations of Light
module more_materials

gamnit :: more_materials

Various material implementations
module more_meshes

gamnit :: more_meshes

More simple geometric meshes
module more_models

gamnit :: more_models

Services to load models from the assets folder
module particles

gamnit :: particles

Particle effects
module selection

gamnit :: selection

Select Actor from a screen coordinate
module sensors

android :: sensors

Access Android sensors
module shadow

gamnit :: shadow

Shadow mapping using a depth texture
module stereoscopic_view

gamnit :: stereoscopic_view

Refine EulerCamera and App::frame_core_draw to get a stereoscopic view
module tileset

gamnit :: tileset

Support for TileSet, TileSetFont and drawing text with TextSprites
module virtual_gamepad

gamnit :: virtual_gamepad

Virtual gamepad mapped to keyboard keys for quick and dirty mobile support
module vr

gamnit :: vr

VR support for gamnit depth, for Android only
# Abstract display services
module display

import ::glesv2
import mnit::input

import display_linux is conditional(linux)
import display_android is conditional(android)
import display_ios is conditional(ios)

# Should Gamnit be more verbose?
fun debug_gamnit: Bool do return false

# General display class, is sized and drawable
class GamnitDisplay

	# Width of the display, in pixels
	fun width: Int is abstract

	# Height of the display, in pixels
	fun height: Int is abstract

	# Aspect ratio of the screen, `width / height`
	fun aspect_ratio: Float do return width.to_f / height.to_f

	# Is the cursor locked et the center of the screen?
	var lock_cursor = false is writable

	# Is the cursor visible?
	# Only affects the desktop implementations.
	var show_cursor: Bool = true is writable

	# Number of bits used for the red value in the color buffer
	fun red_bits: Int do return 8

	# Number of bits used for the green value in the color buffer
	fun green_bits: Int do return 8

	# Number of bits used for the blue value in the color buffer
	fun blue_bits: Int do return 8

	# Prepare this display
	# The implementation varies per platform.
	fun setup is abstract

	# Close this display and free underlying resources
	# The implementation varies per platform.
	fun close do end

	# Flip the display buffers
	# The implementation varies per platform.
	fun flip do end

	# Loop on available events and feed them back to the app
	# The implementation varies per platform.
	fun feed_events do end

	# Extensions to OpenGL ES 2.0 supported by the current configuration
	var gl_extensions: Array[String] is lazy do return glGetString(gl_EXTENSIONS).split(' ')