toyGraphics / com.anysolo.toyGraphics

Package com.anysolo.toyGraphics

Types

Animation

class Animation

Animation is a set of pictures (activeFrames) showing in a sequence with given delay between them.

AnimationFrames

class AnimationFrames

A set of animation frames.

AnimationManager

class AnimationManager

Animation manager is what makes animation alive.

Color

class Color

Rgb color. You can create any color from red, green and blue values. RGB values should from in 0..255 range.

Graphics

class Graphics : Closeable

Use this class to draw on a window.

Image

class Image

An image from file.

Key

class Key

Contains information about one pressed key

Keyboard

class Keyboard

Use this class to work with keyboard

KeyCodes

object KeyCodes

KeyModifiers

data class KeyModifiers

Pal16

object Pal16

16 colors palette from old computers.

Point

data class Point

Point on the window.

Rect

data class Rect

Rectangular. You can define it either with top left corner and size or top left and right bottom cornet.

Size

data class Size

Width and height in one object

Turtle

class Turtle

Allows to use turtle graphics like in Logo language.

Window

open class Window

The graphic window of your program.

Exceptions

ImageError

open class ImageError : ToyGraphicsError

ImageFileError

class ImageFileError : ImageError

ToyGraphicsError

abstract class ToyGraphicsError : RuntimeException

Extensions for External Classes

kotlin.Double

Functions

drawAnimation

fun Graphics.drawAnimation(x: Int, y: Int, animation: Animation): Unit

Draws current frame from animation.

fun Graphics.drawAnimation(x: Int, y: Int, animation: Animation, angle: Double, anchorx: Int = 0, anchory: Int = 0): Unit

Draws rotated animation.

Image

fun Image(filename: String): Image

sleep

fun sleep(ms: Int): Unit

Just do nothing for n milliceconds.