whale-core¶
WhaleJS core library. It handles user input, windows, file system, graphics and more. Probably too much. It may be split into smaller libraries in the future.
Most of classes in this library are just thin wrappers around SDL and OpenGL primitives.
- class whale-core.Buffer()¶
- class whale-core.Buffer(data)
- Arguments:
data (
String())
Represents a binary buffer.
It uses native platform’s endianness.
- Buffer.pushFloat(data)¶
- Arguments:
data (
Number())
- Buffer.pushInt8(data)¶
- Arguments:
data (
Number())
- Buffer.pushInt16(data)¶
- Arguments:
data (
Number())
- Buffer.pushInt32(data)¶
- Arguments:
data (
Number())
- Buffer.pushUInt8(data)¶
- Arguments:
data (
Number())
- Buffer.pushUInt16(data)¶
- Arguments:
data (
Number())
- Buffer.pushUInt32(data)¶
- Arguments:
data (
Number())
- Buffer.push(data)¶
- Arguments:
data (
whale-core.Vec2())
- Buffer.push(data)
- Arguments:
data (
whale-core.Vec3())
- Buffer.push(data)
- Arguments:
data (
whale-core.Vec4())
- Buffer.resize(size)¶
- Arguments:
size (
Number()) – New size in bytes.
- Buffer.reserve(capacity)¶
- Arguments:
capacity (
Number()) – New capacity in bytes.
Reserves buffer memory. Guarantees buffer to be able to hold a specified amount of data without the need for reallocation.
It doesn’t affect the size of the buffer.
- Buffer.size()¶
- Return type:
Number
Returns buffer’s size in bytes.
- Buffer.capacity()¶
- Return type:
Number
Returns buffer’s capacity in bytes.
- Buffer.empty()¶
- Return type:
Boolean
Tells if buffer is empty.
- Buffer.clear()¶
Clears the buffer.
After calling it, buffer will be empty. Buffer’s capacity won’t be affected.
- Buffer.toString()¶
- Return type:
String
Constructs a string from buffer’s contents.
- class whale-core.BufferObject()¶
- class whale-core.BufferObject(target, usage, data)
- Arguments:
target (
whale-core.BufferObject.Target())usage (
whale-core.BufferObject.Usage())data (
whale-core.Buffer())
Represents an OpenGL buffer object.
- BufferObject.Target¶
- Type:
Object
- BufferObject.Target.ARRAY
- BufferObject.Target.ELEMENT_ARRAY
- BufferObject.Usage¶
- Type:
Object
- BufferObject.Usage.DYNAMIC
- BufferObject.Usage.STATIC
- BufferObject.Usage.STREAM
- class whale-core.Canvas(renderContext, size)¶
- Arguments:
renderContext (
whale-core.RenderContext())size (
whale-core.Vec2())
Represents a canvas which can be used to draw sprites and print text.
- Canvas.draw(sprite)¶
- Arguments:
sprite (
whale-core.Sprite())
Draws a sprite.
- Canvas.draw(sprites)
- Arguments:
sprites (
Iterable[whale-core.Sprite])
Draws a batch of sprites.
- Canvas.print(text, transform, color, font, height)¶
- Arguments:
text (
String())transform (
whale-core.Mat3()) – Transformation matrix.color (
whale-core.Vec4()) – Text color.font (
whale-core.Font())height (
Number()) – Font line height.
Prints text.
- Canvas.scale¶
- Type:
Canvas scale.
- class whale-core.DRect2()¶
- class whale-core.DRect2(a, b)
- Arguments:
Represents a 2D rectangle defined by two points.
- DRect2.a¶
- Type:
- DRect2.b¶
- Type:
- class whale-core.DRect3()¶
- class whale-core.DRect3(a, b)
- Arguments:
Represents a 3D rectangle defined by two points.
- DRect3.a¶
- Type:
- DRect3.b¶
- Type:
- class whale-core.DRect4()¶
- class whale-core.DRect4(a, b)
- Arguments:
Represents a 4D rectangle defined by two points.
- DRect4.a¶
- Type:
- DRect4.b¶
- Type:
- class whale-core.DVec1()¶
- class whale-core.DVec1(v)
- Arguments:
- class whale-core.DVec1(v)
- Arguments:
- class whale-core.DVec1(v)
- Arguments:
- class whale-core.DVec1(v)
- Arguments:
- class whale-core.DVec1(x)
- Arguments:
x (
Number())
Represents a 1D vector.
- DVec1.x¶
- Type:
Number
- DVec1.add(v)¶
- Arguments:
- Return type:
- DVec1.add(n)
- Arguments:
n (
Number())
- Return type:
- DVec1.div(v)¶
- Arguments:
- Return type:
- DVec1.div(n)
- Arguments:
n (
Number())
- Return type:
- DVec1.dot(v)¶
- Arguments:
- Return type:
Number
- DVec1.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- DVec1.length()¶
- Return type:
Number
Returns length of the vector.
- DVec1.length2()¶
- Return type:
Number
Returns squared length of the vector.
- DVec1.mul(v)¶
- Arguments:
- Return type:
- DVec1.mul(n)
- Arguments:
n (
Number())
- Return type:
- DVec1.neg()¶
- Return type:
- DVec1.normalize()¶
- Return type:
- DVec1.reflect(normal)¶
- Arguments:
normal (
whale-core.DVec1())
- Return type:
- DVec1.sub(v)¶
- Arguments:
- Return type:
- DVec1.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.DVec2()¶
- class whale-core.DVec2(v)
- Arguments:
- class whale-core.DVec2(v)
- Arguments:
- class whale-core.DVec2(v)
- Arguments:
- class whale-core.DVec2(v)
- Arguments:
- class whale-core.DVec2(x)
- Arguments:
x (
Number())
- class whale-core.DVec2(x, y)
- Arguments:
x (
Number())y (
Number())
Represents a 2D vector.
- DVec2.x¶
- Type:
Number
- DVec2.y¶
- Type:
Number
- DVec2.s¶
- Type:
Number
- DVec2.t¶
- Type:
Number
- DVec2.add(v)¶
- Arguments:
- Return type:
- DVec2.add(n)
- Arguments:
n (
Number())
- Return type:
- DVec2.div(v)¶
- Arguments:
- Return type:
- DVec2.div(n)
- Arguments:
n (
Number())
- Return type:
- DVec2.dot(v)¶
- Arguments:
- Return type:
Number
- DVec2.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- DVec2.length()¶
- Return type:
Number
Returns length of the vector.
- DVec2.length2()¶
- Return type:
Number
Returns squared length of the vector.
- DVec2.mul(v)¶
- Arguments:
- Return type:
- DVec2.mul(n)
- Arguments:
n (
Number())
- Return type:
- DVec2.neg()¶
- Return type:
- DVec2.normalize()¶
- Return type:
- DVec2.reflect(normal)¶
- Arguments:
normal (
whale-core.DVec2())
- Return type:
- DVec2.sub(v)¶
- Arguments:
- Return type:
- DVec2.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.DVec3()¶
- class whale-core.DVec3(v)
- Arguments:
- class whale-core.DVec3(v)
- Arguments:
- class whale-core.DVec3(v)
- Arguments:
- class whale-core.DVec3(v)
- Arguments:
- class whale-core.DVec3(x)
- Arguments:
x (
Number())
- class whale-core.DVec3(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.DVec3(x, y, x)
- Arguments:
x (
Number())y (
Number())z (
Number())
Represents a 3D vector.
- DVec3.x¶
- Type:
Number
- DVec3.y¶
- Type:
Number
- DVec3.z¶
- Type:
Number
- DVec3.r¶
- Type:
Number
- DVec3.g¶
- Type:
Number
- DVec3.b¶
- Type:
Number
- DVec3.s¶
- Type:
Number
- DVec3.t¶
- Type:
Number
- DVec3.p¶
- Type:
Number
- DVec3.add(v)¶
- Arguments:
- Return type:
- DVec3.add(n)
- Arguments:
n (
Number())
- Return type:
- DVec3.div(v)¶
- Arguments:
- Return type:
- DVec3.div(n)
- Arguments:
n (
Number())
- Return type:
- DVec3.dot(v)¶
- Arguments:
- Return type:
Number
- DVec3.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- DVec3.length()¶
- Return type:
Number
Returns length of the vector.
- DVec3.length2()¶
- Return type:
Number
Returns squared length of the vector.
- DVec3.mul(v)¶
- Arguments:
- Return type:
- DVec3.mul(n)
- Arguments:
n (
Number())
- Return type:
- DVec3.neg()¶
- Return type:
- DVec3.normalize()¶
- Return type:
- DVec3.reflect(normal)¶
- Arguments:
normal (
whale-core.DVec3())
- Return type:
- DVec3.sub(v)¶
- Arguments:
- Return type:
- DVec3.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.DVec4()¶
- class whale-core.DVec4(v)
- Arguments:
- class whale-core.DVec4(v)
- Arguments:
- class whale-core.DVec4(v)
- Arguments:
- class whale-core.DVec4(v)
- Arguments:
- class whale-core.DVec4(x)
- Arguments:
x (
Number())
- class whale-core.DVec4(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.DVec4(x, y, z)
- Arguments:
x (
Number())y (
Number())z (
Number())
- class whale-core.DVec4(x, y, z, w)
- Arguments:
x (
Number())y (
Number())z (
Number())w (
Number())
Represents a 4D vector.
- DVec4.x¶
- Type:
Number
- DVec4.y¶
- Type:
Number
- DVec4.z¶
- Type:
Number
- DVec4.w¶
- Type:
Number
- DVec4.r¶
- Type:
Number
- DVec4.g¶
- Type:
Number
- DVec4.b¶
- Type:
Number
- DVec4.a¶
- Type:
Number
- DVec4.s¶
- Type:
Number
- DVec4.t¶
- Type:
Number
- DVec4.p¶
- Type:
Number
- DVec4.q¶
- Type:
Number
- DVec4.add(v)¶
- Arguments:
- Return type:
- DVec4.add(n)
- Arguments:
n (
Number())
- Return type:
- DVec4.div(v)¶
- Arguments:
- Return type:
- DVec4.div(n)
- Arguments:
n (
Number())
- Return type:
- DVec4.dot(v)¶
- Arguments:
- Return type:
Number
- DVec4.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- DVec4.length()¶
- Return type:
Number
Returns length of the vector.
- DVec4.length2()¶
- Return type:
Number
Returns squared length of the vector.
- DVec4.mul(v)¶
- Arguments:
- Return type:
- DVec4.mul(n)
- Arguments:
n (
Number())
- Return type:
- DVec4.neg()¶
- Return type:
- DVec4.normalize()¶
- Return type:
- DVec4.reflect(normal)¶
- Arguments:
normal (
whale-core.DVec4())
- Return type:
- DVec4.sub(v)¶
- Arguments:
- Return type:
- DVec4.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.Event(event)¶
- Arguments:
event (
whale-core.KeyPress())
- class whale-core.Event(event)
- Arguments:
event (
whale-core.MouseMove())
- class whale-core.Event(event)
- Arguments:
event (
whale-core.MouseButton())
- class whale-core.Event(event)
- Arguments:
event (
whale-core.MouseWheel())
- class whale-core.Event(event)
- Arguments:
event (
whale-core.QuitEvent())
- Event.type¶
- Type:
Number
- Event.keyPress¶
- Type:
- Event.mouseMove¶
- Type:
- Event.mouseButton¶
- Type:
- Event.mouseWheel¶
- Type:
- Event.Type¶
- Type:
Object
- Event.Type.KEY_PRESS
- Event.Type.MOUSE_MOVE
- Event.Type.MOUSE_BUTTON
- Event.Type.MOUSE_WHEEL
- Event.Type.QUIT
- Event.Type.NULL
- class whale-core.File()¶
Represents a file.
- File.read()¶
- Return type:
Reads file contents to a buffer.
- File.write(buffer)¶
- Arguments:
buffer (
whale-core.Buffer())
- Return type:
Number
- Returns:
Number of written bytes.
Writes contents of a buffer to the file.
- File.write(buffer, count)
- Arguments:
buffer (
whale-core.Buffer())count (
Number()) – Number of bytes to write.
- Return type:
Number
- Returns:
Number of written bytes.
Writes contents of a buffer to the file.
- File.Mode¶
- Type:
Object
- File.Mode.READ
- File.Mode.WRITE
- File.Mode.APPEND
- File.Mode.BINARY
- File.Mode.TEXT
- class whale-core.Font()¶
Represents a font.
- Font.addChar(code, page, uv, size, offset, xAdvance)¶
- Arguments:
code (
Number()) – Unicode character code.page (
Number()) – Font page number.uv (
whale-core.Rect2()) – UV coordinates of a character glyph on the font page.size (
whale-core.IVec2()) – Font size (in pixels).offset (
whale-core.IVec2()) – Offset to the current position when drawing a character (in pixels).xAdvance (
Number()) – Distance the current X position will be advanced after drawing a character (in pixels).
- Font.addPage(image)¶
- Arguments:
image (
whale-core.Image()) – Add page with font glyphs.
- Font.addKerningPair(first, second, offset)¶
- Arguments:
first (
Number()) – Unicode character code of the first character.second (
Number()) – Unicode character code of the second character.offset (
Number()) – Offset between the characters.
- Font.lineHeight¶
- Type:
Number
Height of font line.
- class whale-core.FrameBuffer(texture)¶
- Arguments:
texture (
whale-core.Texture())
Represents an OpenGL frame buffer.
- class whale-core.Image(imageInfo, buffer)¶
- Arguments:
imageInfo (
whale-core.ImageInfo())buffer (
whale-core.Buffer()) – Raw image data.
Represents an image.
- Image.pixel(position)¶
- Arguments:
position (
whale-core.UVec2()) – Pixel coordinates (in pixels).
- Return type:
Returns a color of an image pixel at the specified coordinates.
- class whale-core.ImageInfo(format, width, height)¶
- Arguments:
format (
whale-core.ImageInfo.Format())width (
Number()) – Width in pixels.height (
Number()) – Height in pixels.
Represents information about an image.
- ImageInfo.Format¶
- Type:
Object
- ImageInfo.Format.RGB
- ImageInfo.Format.RGBA
- class whale-core.IVec1()¶
- class whale-core.IVec1(v)
- Arguments:
- class whale-core.IVec1(v)
- Arguments:
- class whale-core.IVec1(v)
- Arguments:
- class whale-core.IVec1(v)
- Arguments:
- class whale-core.IVec1(x)
- Arguments:
x (
Number())
Represents a 1D vector.
- IVec1.x¶
- Type:
Number
- IVec1.add(v)¶
- Arguments:
- Return type:
- IVec1.add(n)
- Arguments:
n (
Number())
- Return type:
- IVec1.div(v)¶
- Arguments:
- Return type:
- IVec1.div(n)
- Arguments:
n (
Number())
- Return type:
- IVec1.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- IVec1.mul(v)¶
- Arguments:
- Return type:
- IVec1.mul(n)
- Arguments:
n (
Number())
- Return type:
- IVec1.neg()¶
- Return type:
- IVec1.sub(v)¶
- Arguments:
- Return type:
- IVec1.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.IVec2()¶
- class whale-core.IVec2(v)
- Arguments:
- class whale-core.IVec2(v)
- Arguments:
- class whale-core.IVec2(v)
- Arguments:
- class whale-core.IVec2(v)
- Arguments:
- class whale-core.IVec2(x)
- Arguments:
x (
Number())
- class whale-core.IVec2(x, y)
- Arguments:
x (
Number())y (
Number())
Represents a 2D vector.
- IVec2.x¶
- Type:
Number
- IVec2.y¶
- Type:
Number
- IVec2.s¶
- Type:
Number
- IVec2.t¶
- Type:
Number
- IVec2.add(v)¶
- Arguments:
- Return type:
- IVec2.add(n)
- Arguments:
n (
Number())
- Return type:
- IVec2.div(v)¶
- Arguments:
- Return type:
- IVec2.div(n)
- Arguments:
n (
Number())
- Return type:
- IVec2.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- IVec2.mul(v)¶
- Arguments:
- Return type:
- IVec2.mul(n)
- Arguments:
n (
Number())
- Return type:
- IVec2.neg()¶
- Return type:
- IVec2.sub(v)¶
- Arguments:
- Return type:
- IVec2.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.IVec3()¶
- class whale-core.IVec3(v)
- Arguments:
- class whale-core.IVec3(v)
- Arguments:
- class whale-core.IVec3(v)
- Arguments:
- class whale-core.IVec3(v)
- Arguments:
- class whale-core.IVec3(x)
- Arguments:
x (
Number())
- class whale-core.IVec3(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.IVec3(x, y, z)
- Arguments:
x (
Number())y (
Number())z (
Number())
Represents a 3D vector.
- IVec3.x¶
- Type:
Number
- IVec3.y¶
- Type:
Number
- IVec3.z¶
- Type:
Number
- IVec3.r¶
- Type:
Number
- IVec3.g¶
- Type:
Number
- IVec3.b¶
- Type:
Number
- IVec3.s¶
- Type:
Number
- IVec3.t¶
- Type:
Number
- IVec3.p¶
- Type:
Number
- IVec3.add(v)¶
- Arguments:
- Return type:
- IVec3.add(n)
- Arguments:
n (
Number())
- Return type:
- IVec3.div(v)¶
- Arguments:
- Return type:
- IVec3.div(n)
- Arguments:
n (
Number())
- Return type:
- IVec3.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- IVec3.mul(v)¶
- Arguments:
- Return type:
- IVec3.mul(n)
- Arguments:
n (
Number())
- Return type:
- IVec3.neg()¶
- Return type:
- IVec3.sub(v)¶
- Arguments:
- Return type:
- IVec3.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.IVec4()¶
- class whale-core.IVec4(v)
- Arguments:
- class whale-core.IVec4(v)
- Arguments:
- class whale-core.IVec4(v)
- Arguments:
- class whale-core.IVec4(v)
- Arguments:
- class whale-core.IVec4(x)
- Arguments:
x (
Number())
- class whale-core.IVec4(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.IVec4(x, y, z)
- Arguments:
x (
Number())y (
Number())z (
Number())
- class whale-core.IVec4(x, y, z, w)
- Arguments:
x (
Number())y (
Number())z (
Number())w (
Number())
Represents a 4D vector.
- IVec4.x¶
- Type:
Number
- IVec4.y¶
- Type:
Number
- IVec4.z¶
- Type:
Number
- IVec4.w¶
- Type:
Number
- IVec4.r¶
- Type:
Number
- IVec4.g¶
- Type:
Number
- IVec4.b¶
- Type:
Number
- IVec4.a¶
- Type:
Number
- IVec4.s¶
- Type:
Number
- IVec4.t¶
- Type:
Number
- IVec4.p¶
- Type:
Number
- IVec4.q¶
- Type:
Number
- IVec4.add(v)¶
- Arguments:
- Return type:
- IVec4.add(n)
- Arguments:
n (
Number())
- Return type:
- IVec4.div(v)¶
- Arguments:
- Return type:
- IVec4.div(n)
- Arguments:
n (
Number())
- Return type:
- IVec4.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- IVec4.mul(v)¶
- Arguments:
- Return type:
- IVec4.mul(n)
- Arguments:
n (
Number())
- Return type:
- IVec4.neg()¶
- Return type:
- IVec4.sub(v)¶
- Arguments:
- Return type:
- IVec4.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.KeyPress(state, code, modifier)¶
- Arguments:
state (
whale-core.KeyPress.State())code (
whale-core.KeyPress.Code())modifier (
whale-core.KeyPress.Modifier())
Represents key press event.
- KeyPress.state¶
- KeyPress.code¶
- KeyPress.modifier¶
- KeyPress.State¶
- Type:
Object
- KeyPress.State.UP
- KeyPress.State.DOWN
- KeyPress.Code¶
- Type:
Object
- KeyPress.Code.ENTER
- KeyPress.Code.ESCAPE
- KeyPress.Code.BACKSPACE
- KeyPress.Code.TAB
- KeyPress.Code.SPACE
- KeyPress.Code.EXCLAMATION
- KeyPress.Code.DOUBLE_QUOTE
- KeyPress.Code.HASH
- KeyPress.Code.PERCENT
- KeyPress.Code.DOLLAR
- KeyPress.Code.AMPERSAND
- KeyPress.Code.QUOTE
- KeyPress.Code.LEFT_PARENTHESIS
- KeyPress.Code.RIGHT_PARENTHESIS
- KeyPress.Code.ASTERISK
- KeyPress.Code.PLUS
- KeyPress.Code.COMMA
- KeyPress.Code.MINUS
- KeyPress.Code.PERIOD
- KeyPress.Code.SLASH
- KeyPress.Code.ZERO
- KeyPress.Code.ONE
- KeyPress.Code.TWO
- KeyPress.Code.THREE
- KeyPress.Code.FOUR
- KeyPress.Code.FIVE
- KeyPress.Code.SIX
- KeyPress.Code.SEVEN
- KeyPress.Code.EIGHT
- KeyPress.Code.NINE
- KeyPress.Code.COLON
- KeyPress.Code.SEMICOLON
- KeyPress.Code.LESS
- KeyPress.Code.EQUALS
- KeyPress.Code.GREATER
- KeyPress.Code.QUESTION
- KeyPress.Code.AT
- KeyPress.Code.LEFT_BRACKET
- KeyPress.Code.BACKSLASH
- KeyPress.Code.RIGHT_BRACKET
- KeyPress.Code.CARET
- KeyPress.Code.UNDERSCORE
- KeyPress.Code.BACKQUOTE
- KeyPress.Code.A
- KeyPress.Code.B
- KeyPress.Code.C
- KeyPress.Code.D
- KeyPress.Code.E
- KeyPress.Code.F
- KeyPress.Code.G
- KeyPress.Code.H
- KeyPress.Code.I
- KeyPress.Code.J
- KeyPress.Code.K
- KeyPress.Code.L
- KeyPress.Code.M
- KeyPress.Code.N
- KeyPress.Code.O
- KeyPress.Code.P
- KeyPress.Code.Q
- KeyPress.Code.R
- KeyPress.Code.S
- KeyPress.Code.T
- KeyPress.Code.U
- KeyPress.Code.V
- KeyPress.Code.W
- KeyPress.Code.X
- KeyPress.Code.Y
- KeyPress.Code.Z
- KeyPress.Modifier¶
- Type:
Object
- KeyPress.Modifier.NONE
- KeyPress.Modifier.SHIFT_LEFT
- KeyPress.Modifier.SHIFT_RIGHT
- KeyPress.Modifier.SHIFT
- KeyPress.Modifier.CTRL_LEFT
- KeyPress.Modifier.CTRL_RIGHT
- KeyPress.Modifier.CTRL
- KeyPress.Modifier.ALT_LEFT
- KeyPress.Modifier.ALT_RIGHT
- KeyPress.Modifier.ALT
- KeyPress.Modifier.NUM_LOCK
- KeyPress.Modifier.CAPS_LOCK
- class whale-core.LocalFileSystem()¶
- class whale-core.LocalFileSystem(rootPath)
- Arguments:
rootPath (
String()) – Path to the root directory.
Represents the local file system.
By default, root of the local file system is located in the project directory.
- LocalFileSystem.openFile(path)¶
- Arguments:
path (
String())
- Return type:
Opens a file in binary read mode.
- LocalFileSystem.openFile(path, fileMode)
- Arguments:
path (
String())fileMode (
whale-core.File.Mode())
- Return type:
Opens a file in the specified mode.
- LocalFileSystem.openDirectory(path)¶
- Arguments:
path (
String())
- Return type:
whale-core.Directory()
Opens a directory.
- LocalFileSystem.isFile(path)¶
- Arguments:
path (
String())
- Return type:
Boolean
Tells if a given path points to a file.
- LocalFileSystem.isDirectory(path)¶
- Arguments:
path (
String())
- Return type:
Boolean
Tells if a given path points to a directory.
- class whale-core.Mat2()¶
- class whale-core.Mat2(diagonal)
- Arguments:
diagonal (
Number()) – Value of the main diagonal.
Represents a 2x2 matrix.
By default, it creates a zero-initialized matrix.
- Mat2.mul(m)¶
- Arguments:
- Return type:
- Mat2.mul(v)
- Arguments:
- Return type:
- Mat2.mul(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.Mat3()¶
- class whale-core.Mat3(diagonal)
- Arguments:
diagonal (
Number()) – Value of the main diagonal.
Represents a 3x3 matrix.
By default, it creates a zero-initialized matrix.
- Mat3.mul(m)¶
- Arguments:
- Return type:
- Mat3.mul(v)
- Arguments:
- Return type:
- Mat3.mul(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.Mat4()¶
- class whale-core.Mat4(diagonal)
- Arguments:
diagonal (
Number()) – Value of the main diagonal.
Represents a 4x4 matrix.
By default, it creates a zero-initialized matrix.
- Mat4.mul(m)¶
- Arguments:
- Return type:
- Mat4.mul(v)
- Arguments:
- Return type:
- Mat4.mul(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.MouseButton(id, state)¶
- Arguments:
Represents a mouse button event.
- MouseButton.id¶
- MouseButton.state¶
- MouseButton.Id¶
- Type:
Object
- MouseButton.Id.LEFT
- MouseButton.Id.MIDDLE
- MouseButton.Id.RIGHT
- MouseButton.Id.X1
- MouseButton.Id.X2
- MouseButton.State¶
- Type:
Object
- MouseButton.State.UP
- MouseButton.State.DOWN
- class whale-core.MouseMove(position, relativePosition)¶
- Arguments:
position (
whale-core.UVec2())relativePosition (
whale-core.IVec2())
Represents a mouse move event.
- MouseMove.position¶
- Type:
- MouseMove.relativePosition¶
- Type:
- class whale-core.MouseWheel(x, y)¶
- Arguments:
x (
Number())y (
Number())
Represents a mouse wheel event.
- MouseWheel.x¶
- Type:
Number
- MouseWheel.y¶
- Type:
Number
- class whale-core.Program(shaderA, shaderB)¶
- Arguments:
shaderA (
whale-core.Shader())shaderB (
whale-core.Shader())
Represents an OpenGL program.
It links two supplied shaders.
- class whale-core.QuitEvent()¶
Represents quit event.
- class whale-core.Rect2()¶
- class whale-core.Rect2(a, b)
- Arguments:
Represents a 2D rectangle defined by two points.
- Rect2.a¶
- Type:
- Rect2.b¶
- Type:
- class whale-core.Rect3()¶
- class whale-core.Rect3(a, b)
- Arguments:
Represents a 3D rectangle defined by two points.
- Rect3.a¶
- Type:
- Rect3.b¶
- Type:
- class whale-core.Rect4()¶
- class whale-core.Rect4(a, b)
- Arguments:
Represents a 4D rectangle defined by two points.
- Rect4.a¶
- Type:
- Rect4.b¶
- Type:
- class whale-core.RenderContext(window)¶
- Arguments:
window (
whale-core.Window())
Represents an OpenGL render context.
- RenderContext.window()¶
- Return type:
- RenderContext.use(bufferObject)¶
- Arguments:
bufferObject (
whale-core.BufferObject())
Use specified OpenGL buffer object.
- RenderContext.use(frameBuffer)
- Arguments:
frameBuffer (
whale-core.FrameBuffer())
Use specified OpenGL frame buffer.
- RenderContext.use(program)
- Arguments:
program (
whale-core.Program())
Use specified OpenGL program.
- RenderContext.use(attrList)
- Arguments:
attrList (
whale-core.VertexAttrList())
Use specified OpenGL vertex attribute list.
- RenderContext.use(uniformSet)
- Arguments:
uniformSet (
whale-core.UniformSet())
Use specified OpenGL uniform set.
- RenderContext.useDefaultFrameBuffer()¶
- RenderContext.blending(enabled)¶
- Arguments:
enabled (
Boolean())
Enables or disables OpenGL blending.
- RenderContext.blendingMode(source, destination)¶
- Arguments:
destination (
whale-core.RenderContext.BlendingMode())
Sets OpenGL blending mode.
- RenderContext.BlendingMode¶
- Type:
Object
- RenderContext.BlendingMode.ZERO
- RenderContext.BlendingMode.ONE
- RenderContext.BlendingMode.SOURCE_COLOR
- RenderContext.BlendingMode.ONE_MINUS_SOURCE_COLOR
- RenderContext.BlendingMode.DESTINATION_COLOR
- RenderContext.BlendingMode.ONE_MINUS_DESTINATION_COLOR
- RenderContext.BlendingMode.SOURCE_ALPHA
- RenderContext.BlendingMode.ONE_MINUS_SOURCE_ALPHA
- RenderContext.BlendingMode.DESTINATION_ALPHA
- RenderContext.BlendingMode.ONE_MINUS_DESTINATION_ALPHA
- RenderContext.BlendingMode.CONSTANT_COLOR
- RenderContext.BlendingMode.ONE_MINUS_CONSTANT_COLOR
- RenderContext.BlendingMode.CONSTANT_ALPHA
- RenderContext.BlendingMode.ONE_MINUS_CONSTANT_ALPHA
- RenderContext.BlendingMode.SOURCE_ALPHA_SATURATE
- RenderContext.draw(primitiveType, indexType, primitiveCount)¶
- Arguments:
primitiveType (
whale-core.RenderContext.PrimitiveType())indexType (
whale-core.RenderContext.IndexType())primitiveCount (
Number())
- RenderContext.clear(color)¶
- Arguments:
color (
whale-core.Vec4())
- RenderContext.PrimitiveType¶
- Type:
Object
- RenderContext.PrimitiveType.POINTS
- RenderContext.PrimitiveType.LINE_STRIP
- RenderContext.PrimitiveType.LINE_LOOP
- RenderContext.PrimitiveType.LINES
- RenderContext.PrimitiveType.TRIANGLE_STRIP
- RenderContext.PrimitiveType.TRIANGLE_FAN
- RenderContext.PrimitiveType.TRIANGLES
- RenderContext.IndexType¶
- Type:
Object
- RenderContext.IndexType.UNSIGNED_BYTE
- RenderContext.IndexType.UNSIGNED_SHORT
- class whale-core.Shader(type, source)¶
- Arguments:
type (
whale-core.Shader.Type())source (
String())
- class whale-core.Shader(type, source)
- Arguments:
type (
whale-core.Shader.Type())source (
whale-core.Buffer())
Represents an OpenGL shader.
- Shader.Type¶
- Type:
Object
- Shader.Type.VERTEX
- Shader.Type.FRAGMENT
- class whale-core.Sprite(sprite)¶
- Arguments:
sprite (
whale-core.Sprite())
- class whale-core.Sprite(texture, transform, size)
- Arguments:
texture (
whale-core.Texture())transform (
whale-core.Mat3())size (
whale-core.Vec2())
Represents a canvas sprite.
- Sprite.texture¶
- Type:
- Sprite.uv¶
- Type:
- Sprite.color¶
- Type:
- Sprite.size¶
- Type:
- Sprite.transform¶
- Type:
- class whale-core.SpriteSheet(spriteMap, texture)¶
- Arguments:
spriteMap (
whale-core.Buffer())texture (
whale-core.Texture())
Represents a sprite sheet.
- SpriteSheet.sprite(name)¶
- Arguments:
name (
String())
- Return type:
- class whale-core.Texture(image)¶
- Arguments:
image (
whale-core.Image())
- class whale-core.Texture(imageInfo)
- Arguments:
imageInfo (
whale-core.ImageInfo())
Represents an OpenGL texture.
- class whale-core.Uniform(n)¶
- Arguments:
n (
Number())
- class whale-core.Uniform(v)
- Arguments:
- class whale-core.Uniform(v)
- Arguments:
- class whale-core.Uniform(v)
- Arguments:
- class whale-core.Uniform(m)
- Arguments:
- class whale-core.Uniform(m)
- Arguments:
- class whale-core.Uniform(m)
- Arguments:
- class whale-core.Uniform(texture)
- Arguments:
texture (
whale-core.Texture())
Represents an OpenGL uniform.
- class whale-core.UniformSet()¶
Represents an OpenGL uniform set.
- UniformSet.set(name, uniform)¶
- Arguments:
name (
String())uniform (
whale-core.Uniform())
- class whale-core.UVec1()¶
- class whale-core.UVec1(v)
- Arguments:
- class whale-core.UVec1(v)
- Arguments:
- class whale-core.UVec1(v)
- Arguments:
whale-core.IVec1
- class whale-core.UVec1(v)
- Arguments:
- class whale-core.UVec1(x)
- Arguments:
x (
Number())
Represents a 1D vector.
- UVec1.x¶
- Type:
Number
- UVec1.add(v)¶
- Arguments:
- Return type:
- UVec1.add(n)
- Arguments:
n (
Number())
- Return type:
- UVec1.div(v)¶
- Arguments:
- Return type:
- UVec1.div(n)
- Arguments:
n (
Number())
- Return type:
- UVec1.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- UVec1.mul(v)¶
- Arguments:
- Return type:
- UVec1.mul(n)
- Arguments:
n (
Number())
- Return type:
- UVec1.neg()¶
- Return type:
- UVec1.sub(v)¶
- Arguments:
- Return type:
- UVec1.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.UVec2()¶
- class whale-core.UVec2(v)
- Arguments:
- class whale-core.UVec2(v)
- Arguments:
- class whale-core.UVec2(v)
- Arguments:
- class whale-core.UVec2(v)
- Arguments:
- class whale-core.UVec2(x)
- Arguments:
x (
Number())
- class whale-core.UVec2(x, y)
- Arguments:
x (
Number())y (
Number())
Represents a 2D vector.
- UVec2.x¶
- Type:
Number
- UVec2.y¶
- Type:
Number
- UVec2.s¶
- Type:
Number
- UVec2.t¶
- Type:
Number
- UVec2.add(v)¶
- Arguments:
- Return type:
- UVec2.add(n)
- Arguments:
n (
Number())
- Return type:
- UVec2.div(v)¶
- Arguments:
- Return type:
- UVec2.div(n)
- Arguments:
n (
Number())
- Return type:
- UVec2.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- UVec2.mul(v)¶
- Arguments:
- Return type:
- UVec2.mul(n)
- Arguments:
n (
Number())
- Return type:
- UVec2.neg()¶
- Return type:
- UVec2.sub(v)¶
- Arguments:
- Return type:
- UVec2.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.UVec3()¶
- class whale-core.UVec3(v)
- Arguments:
- class whale-core.UVec3(v)
- Arguments:
- class whale-core.UVec3(v)
- Arguments:
- class whale-core.UVec3(v)
- Arguments:
- class whale-core.UVec3(x)
- Arguments:
x (
Number())
- class whale-core.UVec3(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.UVec3(x, y, z)
- Arguments:
x (
Number())y (
Number())z (
Number())
Represents a 3D vector.
- UVec3.x¶
- Type:
Number
- UVec3.y¶
- Type:
Number
- UVec3.z¶
- Type:
Number
- UVec3.r¶
- Type:
Number
- UVec3.g¶
- Type:
Number
- UVec3.b¶
- Type:
Number
- UVec3.s¶
- Type:
Number
- UVec3.t¶
- Type:
Number
- UVec3.p¶
- Type:
Number
- UVec3.add(v)¶
- Arguments:
- Return type:
- UVec3.add(n)
- Arguments:
n (
Number())
- Return type:
- UVec3.div(v)¶
- Arguments:
- Return type:
- UVec3.div(n)
- Arguments:
n (
Number())
- Return type:
- UVec3.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- UVec3.mul(v)¶
- Arguments:
- Return type:
- UVec3.mul(n)
- Arguments:
n (
Number())
- Return type:
- UVec3.neg()¶
- Return type:
- UVec3.sub(v)¶
- Arguments:
- Return type:
- UVec3.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.UVec4()¶
- class whale-core.UVec4(v)
- Arguments:
- class whale-core.UVec4(v)
- Arguments:
- class whale-core.UVec4(v)
- Arguments:
- class whale-core.UVec4(v)
- Arguments:
- class whale-core.UVec4(x)
- Arguments:
x (
Number())
- class whale-core.UVec4(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.UVec4(x, y, z)
- Arguments:
x (
Number())y (
Number())z (
Number())
- class whale-core.UVec4(x, y, z, w)
- Arguments:
x (
Number())y (
Number())z (
Number())w (
Number())
Represents a 4D vector.
- UVec4.x¶
- Type:
Number
- UVec4.y¶
- Type:
Number
- UVec4.z¶
- Type:
Number
- UVec4.w¶
- Type:
Number
- UVec4.r¶
- Type:
Number
- UVec4.g¶
- Type:
Number
- UVec4.b¶
- Type:
Number
- UVec4.a¶
- Type:
Number
- UVec4.s¶
- Type:
Number
- UVec4.t¶
- Type:
Number
- UVec4.p¶
- Type:
Number
- UVec4.q¶
- Type:
Number
- UVec4.add(v)¶
- Arguments:
- Return type:
- UVec4.add(n)
- Arguments:
n (
Number())
- Return type:
- UVec4.div(v)¶
- Arguments:
- Return type:
- UVec4.div(n)
- Arguments:
n (
Number())
- Return type:
- UVec4.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- UVec4.mul(v)¶
- Arguments:
- Return type:
- UVec4.mul(n)
- Arguments:
n (
Number())
- Return type:
- UVec4.neg()¶
- Return type:
- UVec4.sub(v)¶
- Arguments:
- Return type:
- UVec4.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.Vec1()¶
- class whale-core.Vec1(v)
- Arguments:
- class whale-core.Vec1(v)
- Arguments:
- class whale-core.Vec1(v)
- Arguments:
- class whale-core.Vec1(v)
- Arguments:
- class whale-core.Vec1(x)
- Arguments:
x (
Number())
Represents a 1D vector.
- Vec1.x¶
- Type:
Number
- Vec1.add(v)¶
- Arguments:
- Return type:
- Vec1.add(n)
- Arguments:
n (
Number())
- Return type:
- Vec1.div(v)¶
- Arguments:
- Return type:
- Vec1.div(n)
- Arguments:
n (
Number())
- Return type:
- Vec1.dot(v)¶
- Arguments:
- Return type:
Number
- Vec1.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- Vec1.length()¶
- Return type:
Number
Returns length of the vector.
- Vec1.length2()¶
- Return type:
Number
Returns squared length of the vector.
- Vec1.mul(v)¶
- Arguments:
- Return type:
- Vec1.mul(n)
- Arguments:
n (
Number())
- Return type:
- Vec1.neg()¶
- Return type:
- Vec1.normalize()¶
- Return type:
- Vec1.reflect(normal)¶
- Arguments:
normal (
whale-core.Vec1())
- Return type:
- Vec1.sub(v)¶
- Arguments:
- Return type:
- Vec1.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.Vec2()¶
- class whale-core.Vec2(v)
- Arguments:
- class whale-core.Vec2(v)
- Arguments:
- class whale-core.Vec2(v)
- Arguments:
- class whale-core.Vec2(v)
- Arguments:
- class whale-core.Vec2(x)
- Arguments:
x (
Number())
- class whale-core.Vec2(x, y)
- Arguments:
x (
Number())y (
Number())
- Vec2.x¶
- Type:
Number
- Vec2.y¶
- Type:
Number
- Vec2.s¶
- Type:
Number
- Vec2.t¶
- Type:
Number
- Vec2.add(v)¶
- Arguments:
- Return type:
- Vec2.add(n)
- Arguments:
n (
Number())
- Return type:
- Vec2.div(v)¶
- Arguments:
- Return type:
- Vec2.div(n)
- Arguments:
n (
Number())
- Return type:
- Vec2.dot(v)¶
- Arguments:
- Return type:
Number
- Vec2.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- Vec2.length()¶
- Return type:
Number
Returns length of the vector.
- Vec2.length2()¶
- Return type:
Number
Returns squared length of the vector.
- Vec2.mul(v)¶
- Arguments:
- Return type:
- Vec2.mul(n)
- Arguments:
n (
Number())
- Return type:
- Vec2.neg()¶
- Return type:
- Vec2.normalize()¶
- Return type:
- Vec2.reflect(normal)¶
- Arguments:
normal (
whale-core.Vec2())
- Return type:
- Vec2.sub(v)¶
- Arguments:
- Return type:
- Vec2.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.Vec3()¶
- class whale-core.Vec3(v)
- Arguments:
- class whale-core.Vec3(v)
- Arguments:
- class whale-core.Vec3(v)
- Arguments:
- class whale-core.Vec3(v)
- Arguments:
- class whale-core.Vec3(x)
- Arguments:
x (
Number())
- class whale-core.Vec3(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.Vec3(x, y, z)
- Arguments:
x (
Number())y (
Number())z (
Number())
Represents a 3D vector.
- Vec3.x¶
- Type:
Number
- Vec3.y¶
- Type:
Number
- Vec3.z¶
- Type:
Number
- Vec3.r¶
- Type:
Number
- Vec3.g¶
- Type:
Number
- Vec3.b¶
- Type:
Number
- Vec3.s¶
- Type:
Number
- Vec3.t¶
- Type:
Number
- Vec3.p¶
- Type:
Number
- Vec3.add(v)¶
- Arguments:
- Return type:
- Vec3.add(n)
- Arguments:
n (
Number())
- Return type:
- Vec3.div(v)¶
- Arguments:
- Return type:
- Vec3.div(n)
- Arguments:
n (
Number())
- Return type:
- Vec3.dot(v)¶
- Arguments:
- Return type:
Number
- Vec3.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- Vec3.length()¶
- Return type:
Number
Returns length of the vector.
- Vec3.length2()¶
- Return type:
Number
Returns squared length of the vector.
- Vec3.mul(v)¶
- Arguments:
- Return type:
- Vec3.mul(n)
- Arguments:
n (
Number())
- Return type:
- Vec3.neg()¶
- Return type:
- Vec3.normalize()¶
- Return type:
- Vec3.reflect(normal)¶
- Arguments:
normal (
whale-core.Vec3())
- Return type:
- Vec3.sub(v)¶
- Arguments:
- Return type:
- Vec3.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.Vec4()¶
- class whale-core.Vec4(v)
- Arguments:
- class whale-core.Vec4(v)
- Arguments:
- class whale-core.Vec4(v)
- Arguments:
- class whale-core.Vec4(v)
- Arguments:
- class whale-core.Vec4(x)
- Arguments:
x (
Number())
- class whale-core.Vec4(x, y)
- Arguments:
x (
Number())y (
Number())
- class whale-core.Vec4(x, y, z)
- Arguments:
x (
Number())y (
Number())z (
Number())
- class whale-core.Vec4(x, y, z, w)
- Arguments:
x (
Number())y (
Number())z (
Number())w (
Number())
Represents a 4D vector.
- Vec4.x¶
- Type:
Number
- Vec4.y¶
- Type:
Number
- Vec4.z¶
- Type:
Number
- Vec4.w¶
- Type:
Number
- Vec4.r¶
- Type:
Number
- Vec4.g¶
- Type:
Number
- Vec4.b¶
- Type:
Number
- Vec4.a¶
- Type:
Number
- Vec4.s¶
- Type:
Number
- Vec4.t¶
- Type:
Number
- Vec4.p¶
- Type:
Number
- Vec4.q¶
- Type:
Number
- Vec4.add(v)¶
- Arguments:
- Return type:
- Vec4.add(n)
- Arguments:
n (
Number())
- Return type:
- Vec4.div(v)¶
- Arguments:
- Return type:
- Vec4.div(n)
- Arguments:
n (
Number())
- Return type:
- Vec4.dot(v)¶
- Arguments:
- Return type:
Number
- Vec4.get(index)¶
- Arguments:
index (
Number())
- Return type:
Number
Returns a vector component under a given index.
- Vec4.length()¶
- Return type:
Number
Returns length of the vector.
- Vec4.length2()¶
- Return type:
Number
Returns squared length of the vector.
- Vec4.mul(v)¶
- Arguments:
- Return type:
- Vec4.mul(n)
- Arguments:
n (
Number())
- Return type:
- Vec4.neg()¶
- Return type:
- Vec4.normalize()¶
- Return type:
- Vec4.reflect(normal)¶
- Arguments:
normal (
whale-core.Vec4())
- Return type:
- Vec4.sub(v)¶
- Arguments:
- Return type:
- Vec4.sub(n)
- Arguments:
n (
Number())
- Return type:
- class whale-core.VertexAttr(name, type)¶
- Arguments:
name (
String())type (
whale-core.VertexAttr.Type())
Represent an OpenGL vertex attribute.
- VertexAttr.Type¶
- Type:
Object
- VertexAttr.Type.FLOAT
- VertexAttr.Type.VEC2
- VertexAttr.Type.VEC3
- VertexAttr.Type.VEC4
- VertexAttr.Type.MAT2
- VertexAttr.Type.MAT3
- VertexAttr.Type.MAT4
- class whale-core.VertexAttrList()¶
Represents an OpenGL vertex attribute list.
- VertexAttrList.push(vertexAttr)¶
- Arguments:
vertexAttr (
whale-core.VertexAttr())
- class whale-core.Window(name, position, size, options)¶
- Arguments:
name (
String())position (
whale-core.IVec2())size (
whale-core.IVec2())options (
whale-core.Window.Options())
Represents a SDL window.
- Window.redraw()¶
- Window.relativeMouseMode(enabled)¶
- Arguments:
enabled (
Boolean())
- Window.title¶
- Type:
String
- Window.size¶
- Type:
- Window.Options¶
- Type:
Object
- Window.Options.FULLSCREEN
- Window.Options.OPENGL
- Window.Options.SHOWN
- Window.Options.HIDDEN
- Window.Options.BORDERLESS
- Window.Options.RESIZABLE
- Window.Options.MINIMIZED
- Window.Options.MAXIMIZED
- Window.Options.INPUT_GRABBED
- Window.Options.INPUT_FOCUS
- Window.Options.MOUSE_FOCUS
- Window.Options.MOUSE_CAPTURE
- whale-core.ceil(n)¶
- Arguments:
n (
Number())
- Return type:
Number
- whale-core.ceil(v)
- Arguments:
- Return type:
Computes the least integer value not less than the parameter.
- whale-core.delay(time)¶
- Arguments:
time (
Number()) – Time in ms.
- whale-core.loadImage(buffer)¶
- Arguments:
buffer (
whale-core.Buffer()) – Buffer with contents of an image file.
- Return type:
Loads an image from a buffer. Automatically detects image format.
Currently, only PNG files are supported.
- whale-core.loadJPEG(buffer)¶
- Arguments:
buffer (
whale-core.Buffer()) – Buffer with contents of a JPEG file.
- Return type:
Loads a JPEG image from a buffer.
Currently unsupported (it will always fail with an error).
- whale-core.loadPNG(buffer)¶
- Arguments:
buffer (
whale-core.Buffer()) – Buffer with contents of a PNG file.
- Return type:
Loads a PNG image from a buffer.
- whale-core.print(text)¶
- Arguments:
text (
String())
Prints text to stdout.
- whale-core.print_error(text)¶
- Arguments:
text (
String())
Prints text to stderr.
- whale-core.max(a, b)¶
- Arguments:
a (
Number())b (
Number())
- Return type:
Number
- whale-core.max(a, b)
- Arguments:
- Return type:
- whale-core.max(a, b)
- Arguments:
- Return type:
- whale-core.max(a, b)
- Arguments:
- Return type:
Returns the larger one of two values.
For vectors, it returns a vector with each component being the larger value of corresponding input components.
- whale-core.min(a, b)¶
- Arguments:
a (
Number())b (
Number())
- Return type:
Number
- whale-core.min(a, b)
- Arguments:
- Return type:
- whale-core.min(a, b)
- Arguments:
- Return type:
- whale-core.min(a, b)
- Arguments:
- Return type:
Returns the smaller one of two values.
For vectors, it returns a vector with each component being smaller value of corresponding input components.
- whale-core.ortho(left, right, bottom, top, near, far)¶
- Arguments:
left (
Number())right (
Number())bottom (
Number())top (
Number())near (
Number())far (
Number())
- Return type:
Constructs orthogonal projection matrix.
- whale-core.pollEvent()¶
- Return type:
Polls a window event.
- whale-core.rotate(angle)¶
- Arguments:
angle (
Number()) – Angle in radians.
- Return type:
Constructs a 2D rotation matrix.
- whale-core.rotate(axis, angle)
- Arguments:
axis (
whale-core.Vec3())angle (
Number()) – Angle in radians.
- Return type:
Constructs a 3D rotation matrix.
- whale-core.scale(factor)¶
- Arguments:
factor (
whale-core.Vec2()) – Scale factor in both axes.
- Return type:
Constructs a 2D scaling matrix.
- whale-core.ticks()¶
- Return type:
Number
Returns the number of milliseconds that have elapsed since the SDL library initialization.
- whale-core.translate(offset)¶
- Arguments:
offset (
whale-core.Vec2())
- Return type:
Constructs a 2D translation matrix.
- whale-core.translate(offset)
- Arguments:
offset (
whale-core.Vec3())
- Return type:
Constructs a 3D translation matrix.
- whale-core.fs¶
-
Object representing local file system.