Permalink
Browse files

director fix

  • Loading branch information...
1 parent 287b8b8 commit fa4cc8e0b765cea1299edb0ea2432c45c8f33171 @MattiaFortunati MattiaFortunati committed May 22, 2012
Showing with 86 additions and 7 deletions.
  1. +2 −2 rapanui-samples/director/rn-director-basic.lua
  2. +4 −4 rapanui-sdk/RNDirector.lua
  3. +80 −1 rapanui-sdk/RNFactory.lua
@@ -41,7 +41,7 @@ director:setTime(1000)
--FADE IN TEST
-director:showScene("rapanui-samples/director/scene1","fade")
+--director:showScene("rapanui-samples/director/scene1","fade")
--FADE OUT TEST
@@ -55,7 +55,7 @@ director:showScene("rapanui-samples/director/scene1","fade")
--SLIDE TO LEFT IN TEST
---director:showScene("rapanui-samples/director/scene1", "slidetoleft")
+director:showScene("rapanui-samples/director/scene1", "slidetoleft")
--SLIDE TO LEFT OUT TEST
@@ -134,7 +134,7 @@ end
function RNDirector:slideout(xx, yy)
--start slide
- if CURRENT_SCENE_GROUP ~= nill then
+ if CURRENT_SCENE_GROUP ~= nil then
for i = 1, table.getn(CURRENT_SCENE_GROUP.displayObjects), 1 do
if i == table.getn(CURRENT_SCENE_GROUP.displayObjects) then --call transition end callback only for last element
trn:run(CURRENT_SCENE_GROUP.displayObjects[i], { type = "move", x = CURRENT_SCENE_GROUP.displayObjects[i].x - xx, y = CURRENT_SCENE_GROUP.displayObjects[i].y - yy, time = TIME, onComplete = slideEnd })
@@ -169,8 +169,8 @@ function slideEnd()
end
if NEXT_SCENE ~= nil then
- NEXT_SCENE_GROUP.x = 0
- NEXT_SCENE_GROUP.y = 0
+ --NEXT_SCENE_GROUP.x = 0
+ --NEXT_SCENE_GROUP.y = 0
CURRENT_SCENE_GROUP = NEXT_SCENE_GROUP
CURRENT_SCENE = NEXT_SCENE
end
@@ -220,7 +220,7 @@ end
-- fade effect
function RNDirector:fade()
- if CURRENT_SCENE_GROUP ~= nill then --if it's first call we don't have a CURRENT_SCENE or CURRENT_SCENE_GROUP
+ if CURRENT_SCENE_GROUP ~= nil then --if it's first call we don't have a CURRENT_SCENE or CURRENT_SCENE_GROUP
for i = 1, table.getn(CURRENT_SCENE_GROUP.displayObjects), 1 do
if i == table.getn(CURRENT_SCENE_GROUP.displayObjects) then
if NEXT_SCENE ~= nil then
View
@@ -151,7 +151,6 @@ function RNFactory.createImage(image, params)
o.x = o.originalWidth / 2 + left
o.y = o.originalHeight / 2 + top
- local parentGroup = RNFactory.mainGroup
RNFactory.screen:addRNObject(o)
@@ -205,6 +204,41 @@ function RNFactory.createImageFromMoaiImage(moaiImage, params)
return image
end
+function RNFactory.createImage2(image, sizex, sizey)
+ local o = RNObject:new()
+ local o, deck = o:initWithImage2(image, sizex, sizey)
+
+
+ local parentGroup = RNFactory.mainGroup
+
+ RNFactory.screen:addRNObject(o)
+
+ if parentGroup ~= nil then
+ parentGroup:insert(o)
+ end
+
+
+ return o, deck
+end
+
+function RNFactory.createAnim2(image, sizex, sizey, tilex, tiley, posx, posy, scalex, scaley)
+ local o = RNObject:new()
+ local o, deck = o:initWithAnim2(image, sizex, sizey, tilex, tiley, scalex, scaley)
+
+ o.x = posx
+ o.y = posy
+
+ local parentGroup = RNFactory.mainGroup
+
+ RNFactory.screen:addRNObject(o)
+
+ if parentGroup ~= nil then
+ parentGroup:insert(o)
+ end
+
+
+ return o, deck
+end
function RNFactory.createMoaiImage(filename)
local image = MOAIImage.new()
@@ -353,6 +387,51 @@ function RNFactory.createText(text, params)
end
+function RNFactory.createTextOld(text, params)
+
+ local top, left, size, font, height, width, alignment
+
+ font = "arial-rounded"
+ size = 15
+ alignment = MOAITextBox.CENTER_JUSTIFY
+ --LEFT_JUSTIFY, CENTER_JUSTIFY or RIGHT_JUSTIFY.
+
+ if (params ~= nil) then
+ if (params.top ~= nil) then
+ top = params.top
+ end
+
+ if (params.left ~= nil) then
+ left = params.left
+ end
+
+ if (params.font ~= nil) then
+ font = params.font
+ end
+
+ if (params.size ~= nil) then
+ size = params.size
+ end
+
+ if (params.height ~= nil) then
+ height = params.height
+ end
+
+ if (params.width ~= nil) then
+ width = params.width
+ end
+
+ if (params.alignment ~= nil) then
+ alignment = params.alignment
+ end
+ end
+
+ local RNText = RNText:new()
+ RNText:initWithText(text, font, size, left, top, width, height, alignment)
+ RNFactory.screen:addRNObject(RNText)
+ RNFactory.mainGroup:insert(RNText)
+ return RNText
+end
function RNFactory.createRect(x, y, width, height, params)
local parentGroup, top, left

0 comments on commit fa4cc8e

Please sign in to comment.