此操作将删除页面 "Lua API Reference"
,请三思而后行。
Right now API Reference is described as list of available functions and theirs signatures.
Ok, so for example lets take hello(world: string = "lua") -> nil
It's a definition of hello
function which takes 1 arguments, argument is named world
which has type string
and has default value lua
, and also returns nil
Also you could check config structure(aka conf/settings.conf) or if you ready to code here is an example
:warning: If something is not described here it's likely either internal thing or not yet added into this wiki as this wiki is written by human. ALL available API can be found on https://underlevel.ddns.net/git/quantumde1/Himmel_Engine/src/master/source/scripts/lua.d#L661
:warning: also i want to mention that all function which load something from files load files relative to engine binary, if not specified full path.
loadFont(font: string) -> nil
Loads and replaces current font with new one which loads from font
argument.
loadBackground(filename: string, index: integer) -> nil
Configures background texture from filename, index needed when drawing.
drawBackground(x: integer, y: integer, scale: number, index: integer) -> nil
Draws background with specified index.
stopDrawBackground(index: integer) -> nil
Stops drawing of background with specified index.
unloadBackground(index: integer) -> nil
Unloads background with specified index.
loadCharacter(filename: string, index: integer) -> nil
Configures character texture from filename, index needed when drawing.
drawCharacter(x: integer, y: integer, scale: number, index: integer) -> nil
Draws character with specified index, scale, Y and X coordinates.
stopDrawCharacter(index: integer) -> nil
Stops drawing of character with specified index.
unloadCharacter(index: integer) -> nil
Unloads character texture with specified index.
moveCamera(x: number, y: number, zoom: number, speed: number) -> nil
Moves camera to specified coordinates with specified speed. Speed is big float value, i guess from 100 and to 5000 would work.
restoreCamera() -> nil
Excepted to return camera to position before moving. Works, but not smooth.
isCameraMoving() -> boolean
Returns true if camera moving, false if not.
playVideo(filename: string) -> nil
Plays video on top of anything other.
loadAnimationUI(folder: string, filename: string, speed: number) -> nil
Loads animation from PNG textures from folder. Format is: filename-xxx.png
playAnimationUI() -> nil
Plays loaded animation.
stopAnimationUI() -> nil
Stops loaded animation.
unloadAnimationUI() -> nil
unload loaded animation.
dialogBox(pages: table, possibleReplies: table, askPageIndex: integer = -1, textSpeed: integer = 0.06) -> nil
Creates dialog box with pages provided from pages
argument, if page index is askPageIndex user will be asked to select one from possibleReplies
, if askPageIndex = -1 user wont be asked and possibleReplies will be ignored though. Text speed is provided in textSpeed
argument and can be between 0.10 and 1.00.
getAnswerValue() -> integer
This returns index of reply of last dialog.
isDialogExecuted() -> boolean
Returns true if dialog is still shown or false if not.
setDialogBoxBackground(path: string) -> nil
Sets another picture as dialog background.
setDialogEndIndicator(path: string) -> nil
Sets another picture as dialog end indicator.
loadMusic(filename: string) -> nil
Loads music from file.
playMusic() -> nil
Plays previously loaded music.
stopMusic() -> nil
Stop music which is currently loaded.
unloadMusic() -> nil
Unloads currently loaded music.
playSfx(filename: string) -> nil
Loads and plays SFX.
stopSfx() -> nil
Stops currently playing SFX.
setGameState(state: integer) -> nil
Set game state. May be: 1 - MainMenu 2 - InGame 3 - Exit
EventLoop() -> nil
This is function which is defined by YOU. It's called every update, i.e. every frame.
loadScript(script: string) -> nil
Loads script provided in script
argument and transfers execution flow to it. It's also unloads all previously loaded background and characters.
getTime() -> number
Returns number which is an UNIX timestamp in seconds.
getDeltaTime() -> number
Returns number which is a delta time between frames.
getScreenHeight() -> integer
Returns height of current screen.
getScreenWidth() -> integer
Returns width of current screen.
isKeyPressed(key: integer) -> boolean
Returns true
if key
is pressed, otherwise false
. For key reference take look at https://github.com/raysan5/raylib/blob/714de02a884983adc801e734e044d72ad86af815/src/raylib.h#L577
isKeyDown(key: integer) -> boolean
Returns true if key down, otherwise false
isMouseButtonPressed(button: integer) -> boolean
Returns true
if key
is pressed, otherwise false
.
loadTexture(filename: string) -> Texture
Loads texture into variable, e.g local x = loadTexture("X.png")
drawTexture(texture: Texture, x: int, y: int, scale: number, color: {r = integer, g = integer, b = integer, a = integer})
Draws texture. Color is optional. Alpha in color optional too.
drawTextureEx(texture: Texture, x: int, y: int, rotation: number, scale: number, color: {r = integer, g = integer, b = integer, a = integer}
Draws texture. Color is optional. Alpha in color optional too.
measureTextY(string: string) -> integer
Returns how much pixels stirng uses in Y
measureTextX(string: string) -> integer
Returns how much pixels stirng uses in X
unloadTexture(texture: Texture) -> nil
Unloads texture.
getTextureHeight(texture: Texture) -> integer
Returns height of image.
getTextureWidth(texture: Texture) -> integer
Returns width of image.
此操作将删除页面 "Lua API Reference"
,请三思而后行。