forked from moai/moai-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
38 lines (29 loc) · 1017 Bytes
/
Copy pathmain.lua
File metadata and controls
38 lines (29 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
----------------------------------------------------------------
-- Copyright (c) 2010-2017 Zipline Games, Inc.
-- All Rights Reserved.
-- http://getmoai.com
----------------------------------------------------------------
MOAISim.openWindow ( "test", 320, 480 )
viewport = MOAIViewport.new ()
viewport:setSize ( 320, 480 )
viewport:setScale ( 320, -480 )
layer = MOAIPartitionViewLayer.new ()
layer:setViewport ( viewport )
layer:pushRenderPass ()
gfxQuad = MOAIGfxQuad2D.new ()
gfxQuad:setTexture ( "moai.png" )
gfxQuad:setRect ( -128, -128, 128, 128 )
gfxQuad:setUVRect ( 0, 0, 1, 1 )
prop = MOAIProp.new ()
prop:setDeck ( gfxQuad )
prop:setPartition ( layer )
local action = prop:moveRot ( 360, 5, MOAIEaseType.SMOOTH )
----------------------------------------------------------------
function onMouseLeftEvent ( down )
if down then
local done = action:isDone ()
action:toggleDirection ()
if done then action:start () end
end
end
MOAIInputMgr.device.mouseLeft:setCallback ( onMouseLeftEvent )