Module adi::screen

source ·
Expand description

Screen interface API.

Screen Feature

Render graphics to a computer monitor, laptop display, or phone screen.

In order to do this we need to create an App. To do this we:

#[macro_use]
extern crate adi;

use adi::{App, screen, hid};

main!(
    Ctx,
    struct Ctx {
        mode: fn(app: &mut Ctx),
    }
);

impl App for Ctx {
    fn new() -> Ctx {
        Ctx {
            mode: mode,
        }
    }

    fn run(&mut self) {
        (self.mode)(self)
    }
}

fn mode(app: &mut App, _ctx: &mut Ctx, _runner: &mut Runner<Ctx>, event: Event, _dt: f32) {
    // Check for exit request
    if hid::Key::Back.pressed(0) {
        adi::old();
    }
}

Modules

Prelude module.

Structs

An audio frame (2000 samples = 1/24 of a second)
A Window to the Screen.
An Audio Buffer (48kHz/48,000hz).
A list of colors to be paired with vertices.
Index for a frame.
4x4 Matrix.
A list of vertices that make a shape.
A renderable object that exists on the Display.
A list of texture coordinates to be paired with vertices.
A Texture
A Video Frame
A Video Buffer (24fps).
A Viewer Object (viewing position, and direction).

Enums

Mono, Stereo or Surround.
The format for the color channels of the Video.
3D Path operation for vector graphics.
Type of renderer that is available and in use.

Traits

A trait for implementing decoding audio, video or both.
A trait for implementing encoding audio.
A trait for implementing encoding audio and video together.
A trait for implementing encoding video (use only with non-audio formats).

Functions

Blend multiple sRGBA colors in the linear HSVA colorspace.
Update the clear color of the Window.
Update window’s surface.
Get the delta timestep (amount of time since previous frame).
Put sRGBA src color over sRGBA dst color in the linear HSVA colorspace.
Get the pitch of the window’s surface.
Create texture coordinate object.
Upload a texture to the GPU.
Get the width and height of the window.