Core_API_Changes - Xrysnow/LuaSTG-x GitHub Wiki
Core API changes
Most APIs is compatible with LuaSTGPlus.
In following forms:
=>Lua
means the implementation is moved to Lua
Dep
means it's deprecated (but still accessable)
New
means it's added by LuaSTG-x
N/A
means not accessable
- empty means no change
Frame functions
SetFPS
SetVsync
can be used at runtime.
Function |
Status |
ChangeVideoMode |
=>Lua |
DoFile |
|
ExtractRes |
=>Lua |
GetFPS |
|
LoadPack |
=>Lua |
Print |
|
SetFPS |
|
SetResolution |
=>Lua |
SetSplash |
=>Lua |
SetTitle |
=>Lua |
SetVsync |
|
SetWindowed |
=>Lua, Dep |
ShowSplashWindow |
Dep |
SystemLog |
|
UnloadPack |
=>Lua |
Graph functions
PostEffectCapture
/PostEffectApply
are deprecated. They need to create temperary RenderTarget
s due to implementation. The engine provides one temperary RenderTarget
so that you can invoke them only once per frame. Please use CreateRenderTarget
/PushRenderTarget
/PopRenderTarget
instead.
- New:
CreateShaderProgramFromPath
/CreateShaderProgramFromString
. They can compile GLSL shader and return cocos::backend::Program
object. When falied to compile, they will return nil
and write information to log.
Function |
Status |
BeginScene |
|
CreateGLProgramFromPath |
New |
CreateGLProgramFromString |
New |
EndScene |
|
PopRenderTarget |
=>Lua |
PostEffect |
=>Lua |
PostEffectApply |
=>Lua, Dep |
PostEffectCapture |
=>Lua, Dep |
PushRenderTarget |
=>Lua |
RenderClear |
|
SetFog |
|
SetOrtho |
|
SetPerspective |
|
SetViewport |
|
Input functions
GetLastChar
is not accessable.
- Key code is different (see
src/keycode.lua
). This will not affect usage.
- Controller input system is different. It's done by the engine and will not affect usage.
- Controller keys are not mapped to key code but affect
GetKeyState
/GetLastKey
directly.
Function |
Status |
GetKeyState |
|
GetLastChar |
N/A |
GetLastKey |
|
GetMousePosition |
|
GetMouseState |
|
Object functions
- New:
RegisterClass
. Used internally.
CollisionCheck
now accepts game object.
- New:
CollisionCheck3D
.
Del
/Kill
now accept group number or game object array.
- New:
BindNode
. Used to bind cocos::Node
object to game object.
Render functions
- New:
RenderSector
. Used to draw HP bar of boss.
- New:
DrawCollider
. Used internally, see src/core/corefunc.lua
.
Function |
Status |
DrawGroupCollider |
New |
Render |
=>Lua |
Render4V |
=>Lua |
RenderRect |
=>Lua |
RenderSector |
New |
RenderTexture |
|
Resource functions
LoadFont
only supports HGE fonts now. HGE fonts will be converted to BMFont fromat and have some limitations.
- Parameter of
LoadTTF
changes from name, path, width, height
to name, path, size
.
LoadFX
only accepts GLSL shaders now. It supports both fragment and vertex shaders (doc at doc/lstg/resource.lua
). Default boss distortion effect is already provided. Note that coordinates of DX and OGL arg different.
- New:
GetImageScale
.
- Dep:
IsRenderTarget
.
- All resource functions are moved to Lua.
Sound functions
- When play by stream, it will not be very accurate when set/get the playback position.
- All sound functions are moved to Lua.
Text functions
- All text functions are moved to Lua.
- New:
CalcTextSize
. Used to calculate text size.
Misc functions
Execute
is deleted. Please use os.execute
.
Others
json
/cjson
are now implemented by Lua.
lfs
is not recommended to use. Functions from plus
or cc.FileUtils
are easier to use.
- Components of color object can be set/get directly by
a
/r
/g
/b
properties.