请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

mikaelkindborg/mobilelua: Lua for Mobile Devices

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

mikaelkindborg/mobilelua

开源软件地址(OpenSource Url):

https://github.com/mikaelkindborg/mobilelua

开源编程语言(OpenSource Language):

C 72.9%

开源软件介绍(OpenSource Introduction):

MobileLua

Update October 8, 2013

I no longer actively develop MobileLua. I will keep this repositry here, because it contains code that could be useful for future implementations of Lua on mobile devices.

Description

MobileLua is a port of Lua to MoSync, a C/C++ cross-platform development system for mobile devices. This enables Lua to be used on a wide range of mobile devices.

News (old)

MobileLua now wraps all functions and constants in the "mosync" namespace.

For example, when you previously wrote:

Screen:SetColor(255, 255, 255)

You now write:

mosync.Screen:SetColor(255, 255, 255)

The downloadable files for the LuaLive editor and client have been updated to use the new MobileLua version.

Note: The code for the old version of MobileLua that does not have the "mosync" namespace is available in branch "VersionOne".

Error handling

MoSync does not yet support exceptions or setjmp/longjmp, so Lua error handling is replaced with return in case of errors and check for error status. This is not implemented for all error conditions, so for some errors you can get incomplete error information, or in the worst case the program may hang or crash.

Example code

The following is a very simple paint application. Supports multi-touch.

-- Fill screen with background color.
mosync.Screen:SetColor(255, 255, 255)
mosync.Screen:Fill()
mosync.Screen:Update()

-- Function that paints a "brush stamp" on the screen.
function Paint(x, y, touchId)
  if touchId == 0 then 
    mosync.Screen:SetColor(0, 0, 0) 
  else
    mosync.Screen:SetColor(0, 200, 0) 
  end    
  mosync.Screen:FillRect(x - 20, y - 20, 40, 40)
  mosync.Screen:Update()
end    

-- Bind the Paint function to touch events.
mosync.EventMonitor:OnTouchDown(Paint)
mosync.EventMonitor:OnTouchDrag(Paint)

Contact

[email protected]
[email protected]

License

Unless stated otherwise, the MIT license is used for the source code.

Each source file should contain a license header.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap