+ | _app : _Application |
程序开始时自动创建。脚本中应该使用此对象。 |
+ | console : _Console |
应用程序自带的控制台。默认不显示。
|
+ | cursor : string |
应用程序的光标。预加载的系统光标有arrow/cross/wait/help/no/size/sizenwse/sizenesw/sizewe/sizens/sizeall。用户也可以通过_loadCursor来加载自定义的光标。
|
+ | screenReportName : string |
屏幕报表名称。
|
+ | speed : number |
控制应用程序的运行速度。用于加速或减速程序的运行,表示应用程序是正常速度的倍率。默认是1.0。
|
+ | title : string |
应用程序的标题。
|
+ | elapse: number |
帧间隔。
|
+ | function _Application() : _Application |
脚本中不应当使用这个构造函数,他有一个单例_app,这个单例在程序启动时自动创建。 |
+ | function loadCursor(curFile : string, type : string) |
预加载光标文件。
|
+ | function onActive(active : function) |
设置窗口激活或挂起时的回调函数。
|
+ | function onChar(char : function) |
设置键盘输入字符时的回调函数。
|
+ | function onClientMsg(clientMsg: function) |
设置微端发消息给lua的回调函数, 目前只在微端刷新时使用
|
+ | function onCloseWindow(closewin : function) |
设置窗口被关闭时的回调函数。
|
+ | function onDrag(drag : function) |
设置拖动文件到程序时的回调函数。
|
+ | function onElapse(elapse : function) |
设置当前帧数的回调。
|
+ | function onExit(exit : function) |
设置程序退出的回调函数。
|
+ | function onGamepadButton(keyDown : function) |
设置ios手柄接口的回调函数。可用键值分别为 : _System.KeyGPA 为A键, _System.KeyGPB 为B键, _System.KeyGPX 为X键, _System.KeyGPY 为Y键, _System.KeyGPShoulderL 为L1键, _System.KeyGPShoulderR 为R1键, _System.KeyGPTriggerL 为L2键, _System.KeyGPTriggerR 为R2键, _System.KeyGPPaused为中间的menu键.
|
+ | function onGamepadConnect(connect : function) |
设置iOS手柄的回调函数。
|
+ | function onGamepadDirection(keyDown : function) |
设置ios手柄摇杆接口的回调函数。可用的键值分别为 : _System.KeyGPThumbL 为左摇杆 _System.KeyGPThumbR 为右摇杆 _System.KeyGPDpad 为方向键
|
+ | function onIdle(idle : function) |
设置程序每帧的回调函数。
|
+ | function onIMEString(input : function) |
设置输入字符串时的回调函数。
|
+ | function onKeyboardString(keyboardString: function) |
设置移动版输入框的回调函数。
|
+ | function onKeyDown(keyDown : function) |
设置键盘按键按下时的回调函数。
|
+ | function onKeyUp(keyUp : function) |
设置键盘按键抬起时的回调函数。
|
+ | function onMouseDbclick(dClick : function) |
设置鼠标双击时的回调函数。
|
+ | function onMouseDown(mouseDown : function) |
设置鼠标按下时的回调函数。
|
+ | function onMouseMove(mouseMove : function) |
设置鼠标移动的回调函数。
|
+ | function onMouseUp(mouseUp : function) |
设置鼠标抬起时的回调函数。
|
+ | function onMouseWheel(mouseWheel : function) |
设置鼠标滚轮滚动时的回调函数。
|
+ | function onNetChange( netchange : function ) |
网络状态改变时的回调函数,目前只在移动版上有效。
|
+ | function onNotify(notify: function) |
设置移动版应用被消息通知拉起的回调函数。
|
+ | function onResize(resize : function) |
设置窗口大小改变时的回调函数。
|
+ | function onRotation(rotation : function) |
设置移动设备屏幕翻转时的回调函数。该函数只有接口,还没有真正实现。
|
+ | function onShake(shake : function) |
设置移动版shake的回调。
|
+ | function onTouchBegin(touchBegin : function) |
设置触摸屏上触摸开始的回调函数。
|
+ | function onTouchEnd(touchEnd : function) |
设置手指离开触摸屏的回调函数。
|
+ | function onTouchMove(touchMove : function) |
设置手指在触摸屏上移动的回调函数。
|
+ | function onTouchZoom(touchZoom : function) |
设置两只手指在触摸屏上做靠近拉远动作的回调函数。
|
_sys:addPath('res')_app:onActive(function(a) print('Active is', a) end)_app:onResize(function(w, h) print('Resize', w, h) end)_app:onExit(function() print('Exit') end)_app:onMouseMove(function(x, y) print('MouseMove', x, y) end)_app:onMouseDown(function(x, y) print('MouseDown', x, y) end)_app:onMouseUp(function(x, y) print('MouseUp', x, y) end)_app:onMouseDbclick(function(x, y) print('MouseDbclick', x, y) end)_app:onMouseWheel(function(f) print('MouseWheel', f) end)_app:onKeyDown(function(u) print('KeyDown', u) end)_app:onKeyUp(function(u) print('KeyUp', u) end)_app:onChar(function(u) print('Char', u) end)_app:onTouchMove(function(x, y) print('TouchMove', x, y) end)_app:onTouchBegin(function(x, y) print('TouchBegin', x, y) end)_app:onTouchEnd(function(x, y) print('TouchEnd', x, y) end)_app:onTouchZoom(function(x) print('TouchZoom', x) end)_app:onIdle(function(e) _rd:drawAxis(30) end)_app:loadCursor('arrow.cur', 'arrow')_app.cursor = 'arrow'_app:onDrag(function(f) for i, v in ipairs(f) do print('Drag', v) endend)