Aldaron's Device Interface: API Rules

Aldaron's Device Interface has a standardized way of naming API.

Constants

use adi...::VERSION;

const VERSION : &'static str = "adi... x.y.z";

Function Names

impl Xyz

fn apply(self, ...) -> ...

Apply a variable onto another.

fn auto(self, window: &mut Window, pos: (f32, f32)) -> TransformApply

Multiply by a projection that scales width and height by the smallest widget size. The widget is put at position pos. Position isn't affected by aspect ratio.

fn background(&mut self, r: f32, g: f32, b: f32) -> ()

Set the background color of Xyz.

fn create(...) -> Xyz

This creates a new Xyz, or a connection to device Xyz. Returns: New Xyz.

fn gradient(self) -> Style

Use the second 4 values on a vertex as RGB colors.

fn opaque(self, window: &mut Window, image: &'static [u8]) -> Style

Set the style to opaque image from ppm data, image.

fn orthographic(self, window: &Window) -> TransformApply

Apply an orthographic projection ( depth doesn't change x and y position ). Note: The return value is TransformApply.

fn perspective(self, window: &Window, fov: f32) -> TransformApply

Apply perspective with fov degrees for field of view. Note: The return value is TransformApply.

fn pulse_...(...) -> f32

Functions related to animations.

pulse_half_linear(): A linear animation with that interpolates between 0 and 1, then jumps back to 0.

pulse_full_linear(): A linear animation with that interpolates between 0 and 1 and back to 0 again.

pulse_half_smooth(): A non-linear ( cosine ) animation with that interpolates between 0 and 1, then jumps back to 0.

pulse_full_smooth(): A non-linear ( cosine ) animation with that interpolates between 0 and 1 and back to 0 again.

fn rotate(self, yaw:f32, pitch:f32, roll:f32) -> Transform

Rotate self by yaw, pitch and roll.

fn scale(mut self, x:f32, y:f32, z:f32) -> Transform

Scale self by x, y and z.

fn since(...) -> f32

Get time passed in seconds, since a call to create().

fn sleep(...) -> f32

This sleeps for a fixed interval. Returns: Time actually passed.

fn style(&self, window: &mut Window, i: usize, style: &Style) -> ()

Change the style to style for an instance i of a Sprite (self).

fn translate(mut self, x:f32, y:f32, z:f32) -> Transform

Translate self by x, y and z.

fn unit_size(...) -> (f32, f32)

Get the width & height of one unit.

fn update(...) -> ...

Update the state of a variable. Returns: Variable representing user input.

fn vertices(&mut self, window: &mut Window, v: &[f32]) -> ()

Change the vertices for Sprite self to v.

fn wait(...) -> f32

This sleeps until an event happens. Returns: Total time actually passed.


Author: Jeron Aldaron Lau - The Aldaron's Device Interface Documentation Is Public Domain