Package-level declarations

Types

Link copied to clipboard
abstract class Camera
Link copied to clipboard
open class Color(r: Float, g: Float, b: Float, a: Float = 1.0f) : Vec4f
Link copied to clipboard
class ColorGradient(colors: Pair<Float, Color>, n: Int = DEFAULT_N, toLinear: Boolean = false)
Link copied to clipboard
actual class Cursor(pixmap: Pixmap, xHotspot: Int, yHotSpot: Int) : Disposable
expect class Cursor(pixmap: Pixmap, xHotspot: Int = 0, yHotSpot: Int = 0) : Disposable
actual class Cursor(val pixmap: Pixmap, val xHotspot: Int, val yHotSpot: Int) : Disposable
actual class Cursor(val pixmap: Pixmap, val xHotspot: Int, val yHotSpot: Int) : Disposable
Link copied to clipboard
object Fonts

An object that contains a bunch of common fonts that are used across LittleKt.

Link copied to clipboard
class FrameBuffer(val width: Int, val height: Int, val hasDepth: Boolean = false, val hasStencil: Boolean = false, var hasPackedDepthStencil: Boolean = false, val format: Pixmap.Format = Pixmap.Format.RGBA8888, val minFilter: TexMinFilter = TexMinFilter.LINEAR, val magFilter: TexMagFilter = TexMagFilter.LINEAR) : Preparable, Disposable

Encapsulates OpenGL frame buffer objects.

Link copied to clipboard
interface GL
Link copied to clipboard
class GLVersion(val platform: Context.Platform, version: String = "0.0", val vendor: String = "N/A", val renderer: String = "N/A")
Link copied to clipboard
class IndexBufferObject(val gl: GL, val isStatic: Boolean = true, var buffer: ShortBuffer) : Disposable
Link copied to clipboard
class Mesh(val gl: GL, val geometry: MeshGeometry, var autoBind: Boolean = true) : Disposable
Link copied to clipboard
open class MutableColor(r: Float, g: Float, b: Float, a: Float) : Color
Link copied to clipboard
open class OrthographicCamera(virtualWidth: Float = 0.0f, virtualHeight: Float = 0.0f) : Camera
Link copied to clipboard
open class PerspectiveCamera(virtualWidth: Float = 0.0f, virtualHeight: Float = 0.0f) : Camera
Link copied to clipboard
class Pixmap(val width: Int, val height: Int, val pixels: ByteBuffer = createByteBuffer(width * height * 4))
Link copied to clipboard
data class PixmapSlice(val pixmap: Pixmap, val x: Int = 0, val y: Int = 0, val width: Int = pixmap.width, val height: Int = pixmap.height)

A rectangular slice of a pixmap.

Link copied to clipboard
interface Preparable
Link copied to clipboard
Link copied to clipboard
class Texture(val textureData: TextureData) : Preparable, Disposable
Link copied to clipboard
interface TextureData
Link copied to clipboard
object Textures

An object that contains a bunch of common texture slices that can be used to prevent texture switches.

Link copied to clipboard
data class VertexAttribute(val usage: VertexAttrUsage, val numComponents: Int, val alias: String, val type: VertexAttrType = if (usage == VertexAttrUsage.COLOR_PACKED) VertexAttrType.UNSIGNED_BYTE else VertexAttrType.FLOAT, val normalized: Boolean = usage == VertexAttrUsage.COLOR_PACKED, val unit: Int = 0, val asInt: Boolean = false)
Link copied to clipboard
value class VertexAttrUsage(val usage: Int)
Link copied to clipboard
class VertexBufferObject(val gl: GL, val isStatic: Boolean, val attributes: VertexAttributes, var buffer: FloatBuffer) : Disposable

Functions

Link copied to clipboard
fun Color.abgr(): Int
Link copied to clipboard
fun Pixmap.addBorderToSlices(context: Context, sliceWidth: Int, sliceHeight: Int, border: Int = 1, mipmaps: Boolean = false): Texture

Slice up the pixmap with the given size with an added border but returns the newly created Texture. This can be used to prevent atlas bleeding.

fun Texture.addBorderToSlices(context: Context, sliceWidth: Int, sliceHeight: Int, border: Int = 1, mipmaps: Boolean = false): Texture

Slice up the texture with the given size with an added border but returns the newly created Texture. This can be used to prevent atlas bleeding.

Link copied to clipboard
fun <T : ContextListener> T.colorMesh(size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
fun colorMesh(gl: GL, size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh

Creates a mesh with VertexAttribute.POSITION_2D and VertexAttribute.COLOR_PACKED attributes.

Link copied to clipboard
fun <T : ContextListener> T.colorMeshUnpacked(size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
fun colorMeshUnpacked(gl: GL, size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
Link copied to clipboard
fun <T : TextureData> T.generateMipMap(context: Context, target: TextureTarget, pixmap: Pixmap, width: Int, height: Int, useHWMipMap: Boolean = true)
Link copied to clipboard
fun <T : ContextListener> T.mesh(attributes: List<VertexAttribute>, size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
inline fun mesh(gl: GL, attributes: List<VertexAttribute>, size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
Link copied to clipboard
fun positionMesh(gl: GL, size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
Link copied to clipboard
fun Color.rgba(): Int
Link copied to clipboard
fun Pixmap.slice(sliceWidth: Int, sliceHeight: Int): Array<Array<PixmapSlice>>
fun Texture.slice(sliceWidth: Int, sliceHeight: Int): Array<Array<TextureSlice>>
Link copied to clipboard
fun Pixmap.sliceWithBorder(context: Context, sliceWidth: Int, sliceHeight: Int, border: Int = 1, mipmaps: Boolean = false): List<TextureSlice>
fun Texture.sliceWithBorder(context: Context, sliceWidth: Int, sliceHeight: Int, border: Int = 1, mipmaps: Boolean = false): List<TextureSlice>

Slice up the texture in a list of TextureSlice with the given size with an added border. This can be used to prevent atlas bleeding.

Link copied to clipboard
fun <T : ContextListener> T.textureMesh(size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
fun textureMesh(gl: GL, size: Int = 1000, grow: Boolean = false, generate: Mesh.() -> Unit): Mesh
Link copied to clipboard
Link copied to clipboard

Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float. Alpha is compressed from 0-255 to use only even numbers between 0-254 to avoid using float bits in the NaN range. Converting a color to a float and back can be lossy for alpha.

Link copied to clipboard
Link copied to clipboard
fun <T : TextureData> T.uploadImageData(context: Context, target: TextureTarget, data: TextureData, mipLevel: Int = 0)