Visionaire spezifisch
Ereignisbehandlung
animationStarted
animationStopped
textStarted
textStopped
mainLoop
mouseEvent
keyEvent
engineEvent
| Name | Param2 (string) |
|---|---|
| ComposedFileMissing | path |
Consoles:
| Name | Param2 (string) |
|---|---|
| SaveSyncFailed | file;reason |
| SaveSyncSuccess | file |
Xbox1:
| Name | Param2 (string) |
|---|---|
| UserRemoved | id |
| UserAdded | id |
| UserDisplayInfoChanged | id |
| OnlineStateChanged | state |
| SignInCompleted | id |
| SignOutCompleted | id |
| SignOutStarted | id |
Hooks
The engine allows certain parts to be hooked and behaviour changed.
Hooks can be set by registerHookFunction.
- **setTextPosition**: set position for a text (ActiveText -> bool)
- **getActionText**: set action text (mousepos -> string)
- **getCharacterAnimationIndex**: set action text (mousepos -> string)
- **textRender**
- **textText**
- **renderObject**
vispath
local sprite = graphics.loadFromFile("vispath:test.png")
-- result
local sprite = graphics.loadFromFile("test.png#000#00000#")
If a game is exported, all paths are extended with container numbers:
file.png#containernumber#filenumber#
For these paths to be replaced and exported in your scripts they need to be prepended by "vispath:".
Shaders
-- using without shader toolkit
local shaderId = shaderCompile(Shaders.ShaderName.Compiled)
Objects.Objekt0.ShaderSet = shaderId
function mLoop()
graphics.shaderUniform(shaderId,"time",shader_iTime)
end
registerEventHandler("mainLoop", "mLoop")
-- using with shader toolkit
local name = "ShaderName"
shader_effects[name] = { shader = Shaders.ShaderName.Compiled }
shaderAddEffect(name)
shaderRemoveEffect( name)
game.CurrentScene.Objects.Objekt0.ShaderSet = shader_effects[name].num.num
shader_effects[ name].num.speed = 0.2
bind(name, "time", field("shader_iTime"))
-- using as fullscreen effect
local name = "ShaderName"
shader_effects[name] = { shader = Shaders.ShaderName.Compiled }
shaderAddEffect(name)
shader_effects[ name].num.speed = 0.2
bind(name, "time", field("shader_iTime"))
-- setting uniforms
graphics.shaderUniform(shaderId, "mat4", {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0})
graphics.shaderUniform(shaderId, "mat3", {0,0,0, 0,0,0, 0,0,0})
graphics.shaderUniform(shaderId, "vec4", {0,0,0,0})
graphics.shaderUniform(shaderId, "vec3", {0,0,0})
graphics.shaderUniform(shaderId, "vec2", {0,0})
graphics.shaderUniform(shaderId, "float", 0)
graphics.shaderUniform(shaderId, "_i_int", 0)
graphics.shaderUniform(shaderId, "_t_texture", "vispath:data.png")
Visionaire Studio offers a simple shader cross compiler that works with OpenGL ES 2.0 syntax. These shaders are compiled to GLSL, HLSL for DX9 and DX11. If you're on a Mac, these shaders are only compiled for GLSL.
Shaders can be used in conjunction with the shadertoolkit or on its own and applied on to objects, characters or buttons. It's also possible to assign the same shader to multiple objects.
Not all functions travel well between HLSL and GLSL. If you want to use the shader for objects you need to keep the attribute layout and names (vertex in: vec2 position, vec2 uv). Also the matrix will be set into mat4 mvp_mat and the texture in sampler2D texel.
ShaderUniform is used to set textures and values. You can set integers by prefixing the names with _i_. Textures are set by prefixing _t_. DO NOT prefix your variables in the shader, _t_texture will look for texture.
Tweening
startTween(field, from, to, duration, easing[, repeat, reverse])
startObjectTween(obj, field, from, to, time, easing[, repeat, reverse])
obj:to(time, table, easing[, repeat, reverse])
setDelay(time, function)
startObjectTween(game,VGameScrollPosition,game:getPoint(VGameScrollPosition),{x=100,y=0},3000,easeBackInOut)
startTween("q", q, 3, 3000, easeBackInOut)
game:to(3000, { ScrollPosition = {x = 100, y = 0} }, easeBackInOut)
setDelay(3000, function()
game:to(3000, { ScrollPosition = {x = 0, y = 0} }, easeBackInOut)
end)
Tweening simplifies simple animations for your game. This can currently only be done with lua. The tween updates the value every frame for the duration of the effect.
Tweens work on lua fields and objects for 3 field types: t_int, t_float, t_point.
Tweens allow different types of easing:
- Back
- Bounce
- Circ
- Cubic
- Elastic
- Linear
- None
- Quad
- Quart
- Quint
- Sine
All types can be set to In, Out or InOut. These are exported as constants in lua: Easing.
Tweens can also be set to repeat and to reverse repeat.
Tweens are overwritten if they are set again.
Previews for easing types can found here: http://easings.net/de
Savegames
Settings and config.ini
Multilanguage
Lautstärke
messages.log
-->