API-Namen, Parameter und Code stehen in ihrer englischen Originalform.
graphics
graphics
Methoden
loadFromFile(path)
loadMemoryJPG(bytes)
loadMemoryPNG(bytes)
loadMemoryWEBP(bytes)
drawFont(text, x, y, alpha)
drawSprite(sprite, alpha, tint)
drawSpriteWithNineRect(sprite, destRect, nineRect, color, alpha)
drawBox(x, y, w, h, color, alpha)
drawLine(x, y, x2, y2, color, alpha)
drawAnimation(ActiveAnimation, alpha, tint)
isUpsideDown()
clear()
setupOffsets(attribId, size, stride, offset, elementSize)
drawIndexed(offset, count)
createIndexBuffer(dynamic, size)
createBuffer(dynamic, size)
createFramebuffer(width, height)
bindCurrentTexture(slot)
bindFramebuffer()
addDrawFunc(name, position)
removeDrawFunc(name)
shaderUniform(shader, uniformName, value)
shaderCallback(shader, luafunc)
shaderDrawCallback(shader, luafunc)
shaderUse(shader)
shaderAttrib(shader, attrib)
lightmapCallback(callback)
performLinebreaks(text)
fontDimension(text)
fontLineHeight()
fontColor()
noise(pos1, pos2)
noise2(pos1, pos2, pos3, pos4)
movieOpen(file)
unlockAspectRatio()
lockAspectRatio()
evalTween(from, to, completition, easing)
clipboard()
setScrollPosition(x, y)
getScrollPosition()
instantiateAnimation(animation, reverse, size)
getCurrentSpritePath(obj)
getAnimationSize(obj)
getAnimationInnerSize(obj)
getCharacterTextPosition(character)
getMatrix1Properties()
createBox2DDebugRender()
setDebugRenderOffset(x, y)
orthogonal(left, right, bottom, top)
transferMode(src, dst, alpha_src, alpha_dst)
openedVideos()
createTextScrollPane()
setSpineTime()
setSpineSlot()
getParticles(object)
registerRenderHook(object, hook)
Felder
fontShader int
defaultShader int
matrix1 int
matrix2 int
textMatrix int
invMatrix1 int
fontShaderIndizes int[]
clipboard string
font TVisObj
loadFromFile(path)
local sprite = graphics.loadFromFile("vispath:test.png")
| Parameter |
Type |
Description |
| path |
string |
->vispath |
| Return Type |
Description |
| Sprite |
|
| nil |
if not found |
loadMemoryJPG(bytes)
local f = io.open("test.jpg", "rb")
local content = f:read("*all")
f:close()
local sprite = graphics.loadMemoryJPG(content)
| Parameter |
Type |
Description |
| bytes |
string |
|
| Return Type |
Description |
| Sprite |
|
loadMemoryPNG(bytes)
local f = io.open("test.png", "rb")
local content = f:read("*all")
f:close()
local sprite = graphics.loadMemoryPNG(content)
| Parameter |
Type |
Description |
| bytes |
string |
|
| Return Type |
Description |
| Sprite |
|
loadMemoryWEBP(bytes)
local f = io.open("test.webp", "rb")
local content = f:read("*all")
f:close()
local sprite = graphics.loadMemoryWEBP(content)
| Parameter |
Type |
Description |
| bytes |
string |
|
| Return Type |
Description |
| Sprite |
|
drawFont(text, x, y, alpha)
graphics.font =
graphics.drawFont
| Parameter |
Type |
Description |
| text |
string |
|
| x |
int |
|
| y |
int |
|
| alpha |
float |
|
drawSprite(sprite, alpha, tint)
| Parameter |
Type |
Description |
| sprite |
Sprite |
|
| alpha |
float |
|
| tint |
int |
|
drawSpriteWithNineRect(sprite, destRect, nineRect, color, alpha)
| Parameter |
Type |
Description |
| sprite |
Sprite |
|
| destRect |
rect |
|
| nineRect |
rect |
|
| color |
int |
|
| alpha |
float |
|
drawBox(x, y, w, h, color, alpha)
| Parameter |
Type |
Description |
| x |
int |
|
| y |
int |
|
| w |
int |
|
| h |
int |
|
| color |
int |
|
| alpha |
float |
|
drawLine(x, y, x2, y2, color, alpha)
| Parameter |
Type |
Description |
| x |
int |
|
| y |
int |
|
| x2 |
int |
|
| y2 |
int |
|
| color |
int |
|
| alpha |
float |
|
drawAnimation(ActiveAnimation, alpha, tint)
| Parameter |
Type |
Description |
| ActiveAnimation |
TVisObj |
|
| alpha |
float |
|
| tint |
int |
|
isUpsideDown()
true for DirectX and GNM, (0,0) is upper left instead bottom left
clear()
clear current framebuffer
setupOffsets(attribId, size, stride, offset, elementSize)
graphics.setupOffsets(graphics.shaderAttrib(shader, "position"), 2, 20, 0)
| Parameter |
Type |
Description |
| attribId |
int |
|
| size |
int |
count of components |
| stride |
int |
|
| offset |
int |
|
| elementSize |
int |
default 4 |
drawIndexed(offset, count)
| Parameter |
Type |
Description |
| offset |
int |
|
| count |
int |
|
createIndexBuffer(dynamic, size)
| Parameter |
Type |
Description |
| dynamic |
bool |
|
| size |
int |
in bytes |
createBuffer(dynamic, size)
| Parameter |
Type |
Description |
| dynamic |
bool |
|
| size |
int |
in bytes |
createFramebuffer(width, height)
| Parameter |
Type |
Description |
| width |
int |
|
| height |
int |
|
bindCurrentTexture(slot)
| Parameter |
Type |
Description |
| slot |
int |
|
bindFramebuffer()
reset/bind framebuffer for the scene
addDrawFunc(name, position)
graphics.addDrawFunc("draw()", 0)
function draw()
end
-1 before scene
0 after scene
1 after interfaces
| Parameter |
Type |
Description |
| name |
string |
|
| position |
int |
default 0 |
removeDrawFunc(name)
| Parameter |
Type |
Description |
| name |
string |
|
-> Shader Uniforms
| Parameter |
Type |
Description |
| shader |
int |
|
| uniformName |
string |
|
| value |
variant |
|
shaderCallback(shader, luafunc)
graphics.shaderCallback(shaderId, "callback")
function callback(object)
print(object.name)
end
| Parameter |
Type |
Description |
| shader |
int |
|
| luafunc |
string |
|
shaderDrawCallback(shader, luafunc)
graphics.shaderDrawCallback(shaderId, "drawCallback")
function drawCallback(data)
end
Calls the draw function instead of internal drawing.
Data contains the coordinates.
| Parameter |
Type |
Description |
| shader |
int |
|
| luafunc |
string |
|
shaderUse(shader)
bind shader and bind textures
| Parameter |
Type |
Description |
| shader |
int |
|
shaderAttrib(shader, attrib)
| Parameter |
Type |
Description |
| shader |
int |
|
| attrib |
string |
|
| Return Type |
Description |
| int |
attribId |
lightmapCallback(callback)
graphics.lightmapCallback("lightmapModify")
function lightmapModify(character, r,g,b)
local tempR = r
r = b
b = tempR
return r,g,b
end
set lightmap callback -> see example
| Parameter |
Type |
Description |
| callback |
string |
|
performLinebreaks(text)
break text into lines
| Parameter |
Type |
Description |
| text |
string |
|
| Return Type |
Description |
| table |
lines |
fontDimension(text)
get the dimension of the text with the current font
| Parameter |
Type |
Description |
| text |
string |
|
fontLineHeight()
get the font line height for the current font
| Return Type |
Description |
| int |
h |
fontColor()
get the font color for the current font
| Return Type |
Description |
| int |
r |
| int |
g |
| int |
b |
noise(pos1, pos2)
simplex perlin noise
| Parameter |
Type |
Description |
| pos1 |
float |
|
| pos2 |
float |
default 0 |
| Return Type |
Description |
| float |
noise |
noise2(pos1, pos2, pos3, pos4)
perlin noise with up to 4 components
| Parameter |
Type |
Description |
| pos1 |
float |
|
| pos2 |
float |
|
| pos3 |
float |
|
| pos4 |
float |
|
| Return Type |
Description |
| float |
noise |
movieOpen(file)
| Parameter |
Type |
Description |
| file |
string |
->vispath |
| Return Type |
Description |
| TMovie |
|
unlockAspectRatio()
unlocks aspect ratio and makes filling the screen possible
lockAspectRatio()
resets aspect ratio
evalTween(from, to, completition, easing)
| Parameter |
Type |
Description |
| from |
float |
|
| to |
float |
|
| completition |
float |
0-1 |
| easing |
int |
->easing |
| Return Type |
Description |
| float |
result |
clipboard()
| Return Type |
Description |
| string |
|
| Parameter |
Type |
Description |
| x |
float |
|
| y |
float |
|
| Return Type |
Description |
| float |
x |
| float |
y |
instantiateAnimation(animation, reverse, size)
| Parameter |
Type |
Description |
| animation |
TVisObj |
|
| reverse |
bool |
|
| size |
int |
default 100 |
| Return Type |
Description |
| TVisObj |
animation |
getCurrentSpritePath(obj)
| Parameter |
Type |
Description |
| obj |
TVisObj |
character, animation or activeanimation |
| Return Type |
Description |
| string |
path |
getAnimationSize(obj)
sprite rect for current sprite
| Parameter |
Type |
Description |
| obj |
TVisObj |
character, animation or activeanimation |
| Return Type |
Description |
| point |
size |
getAnimationInnerSize(obj)
cropped sprite rect (transparent pixels removed)
| Parameter |
Type |
Description |
| obj |
TVisObj |
character, animation or activeanimation |
| Return Type |
Description |
| rect |
size |
getCharacterTextPosition(character)
| Parameter |
Type |
Description |
| character |
TVisObj |
|
| Return Type |
Description |
| point |
position |
| nil |
|
getMatrix1Properties()
| Return Type |
Description |
| float |
scaleX |
| float |
scaleY |
| float |
tX |
| float |
tY |
createBox2DDebugRender()
| Return Type |
Description |
| b2Draw |
|
setDebugRenderOffset(x, y)
| Parameter |
Type |
Description |
| x |
int |
|
| y |
int |
|
orthogonal(left, right, bottom, top)
Leave left at -1 for getting current matrix.
| Parameter |
Type |
Description |
| left |
int |
|
| right |
int |
|
| bottom |
int |
|
| top |
int |
|
| Return Type |
Description |
| table |
matrix |
transferMode(src, dst, alpha_src, alpha_dst)
| Parameter |
Type |
Description |
| src |
int |
|
| dst |
int |
|
| alpha_src |
int |
|
| alpha_dst |
int |
|
openedVideos()
createTextScrollPane()
setSpineTime()
setSpineSlot()
getParticles(object)
| Parameter |
Type |
Description |
| object |
TVisObj |
|
| Return Type |
Description |
| Particles |
|
registerRenderHook(object, hook)
| Parameter |
Type |
Description |
| object |
TVisObj |
|
| hook |
string |
|
Sprite
Felder
position point
rotation float
scale float
scaleX float
scaleY float
shaderSet int
rotationCenter point
matrixId int
size readonly int
width readonly int
height readonly int
Verwendet in:
graphics.loadFromFile
graphics.loadMemoryJPG
graphics.loadMemoryPNG
graphics.loadMemoryWEBP
graphics.drawSprite
graphics.drawSpriteWithNineRect
TMovie
Methoden
draw(x, y, w, h)
finish()
seek(time)
getDuration()
getTime()
pause()
resume()
Felder
width int
height int
draw(x, y, w, h)
| Parameter |
Type |
Description |
| x |
float |
default -1 for centered |
| y |
float |
|
| w |
float |
default -1 use movie size, -2 fit in screen |
| h |
float |
|
| Return Type |
Description |
| bool |
finished |
finish()
clean up video
seek(time)
| Parameter |
Type |
Description |
| time |
float |
in seconds with fractional part |
getDuration()
| Return Type |
Description |
| float |
time in seconds with fractional part |
getTime()
| Return Type |
Description |
| float |
time in seconds with fractional part |
pause()
resume()
Verwendet in:
graphics.movieOpen
TFramebuffer
Methoden
bind()
bind()
Verwendet in:
graphics.createFramebuffer
TBuffer
Methoden
bind()
update(values)
bind()
update(values)
| Parameter |
Type |
Description |
| values |
table |
ints for index buffer or floats for vertices buffer |
Verwendet in:
graphics.createIndexBuffer
graphics.createBuffer
TextScrollPane
Methoden
show()
destroy()
addText(text, font, color, offsetX, offsetY, bulletPointImage, imageOffset)
Felder
bg path
scroll path
scrollUp path
scrollDown path
scrollHover path
scrollUpHover path
scrollDownHover path
padding int
scrollPosition int
rect rect
bg9R rect
scroll9R rect
alwaysShowScrollbar bool
button TVisObj
show()
destroy()
addText(text, font, color, offsetX, offsetY, bulletPointImage, imageOffset)
| Parameter |
Type |
Description |
| text |
TVisObj |
|
| font |
TVisObj |
|
| color |
int |
|
| offsetX |
int |
|
| offsetY |
int |
|
| bulletPointImage |
path |
|
| imageOffset |
point |
|
Verwendet in:
graphics.createTextScrollPane