Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Snapshots created with half the size passed to newSnapshot
Started by Squadventure Games Mar 31 2014 05:40 AM

5 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

Squadventure Games

[GLOBAL: userInfoPane.html]
Squadventure Games
  • Contributor

  • 104 posts
  • Corona SDK

Hello,

 

I'm trying to create a full-screen snapshot like this:

 

local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight)
snapshot.anchorX = 0
snapshot.anchorY = 0
snapshot.x = 0
snapshot.y = 0

 

But the content of the snapshot is only visible in the top-left quadrant of the screen. I have to do this to make it actually full-screen:

 

local snapshot = display.newSnapshot(display.contentWidth * 2, display.contentHeight * 2)

 

Why is that?

 

Note: I'm also running Graphics 1.0 compatibility mode.

 

Thanks,

George

 

EDIT: I'm on build 2014.2162.



[TOPIC: post.html]
#2

Squadventure Games

[GLOBAL: userInfoPane.html]
Squadventure Games
  • Contributor

  • 104 posts
  • Corona SDK

I've migrated my project to Graphics 2.0, and the positioning behavior of snapshots is still very strange. Has anybody else had any problems with snapshots in this regard?



[TOPIC: post.html]
#3

Squadventure Games

[GLOBAL: userInfoPane.html]
Squadventure Games
  • Contributor

  • 104 posts
  • Corona SDK

I should mention that I'm doing this in my main.lua:

 

display.setDefault("anchorX", 0)
display.setDefault("anchorY", 0)
 

 

Because my project depends on this. If I don't set these, it seems to be working correctly. But I'm setting the anchor on the snapshot though. Why should this affect the snapshot at all?


[TOPIC: post.html]
#4

Squadventure Games

[GLOBAL: userInfoPane.html]
Squadventure Games
  • Contributor

  • 104 posts
  • Corona SDK

I've removed the setDefault calls and I'm now creating by snapshot this way:

 

 

function ui.newFullSnapshot()
    local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight)
    snapshot.anchorX, snapshot.anchorY = 0, 0
    snapshot.x, snapshot.y = 0, 0
    
    --I tried this too, nothing
    --snapshot.group.anchorChildren = true
    --snapshot.group.anchorX, snapshot.group.anchorY = 0, 0
    --snapshot.group.x, snapshot.group.y = 0, 0
  
    return snapshot
end

 

Can someone please tell me *why* this snapshot is drawn in the bottom-right quadrant of the screen, instead of the whole screen? This is driving me nuts!
 
I've attached a sample app that shows this behavior. Can someone please look at it?

Attached Files



[TOPIC: post.html]
#5

Squadventure Games

[GLOBAL: userInfoPane.html]
Squadventure Games
  • Contributor

  • 104 posts
  • Corona SDK

OK, if I modify the attached code to this:

 

local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight)
snapshot.anchorX, snapshot.anchorY = 0, 0
snapshot.x, snapshot.y = 0, 0

local background = display.newImageRect("background.jpg", display.contentWidth, display.contentHeight)
background.anchorX, background.anchorY = 0,0
background.x, background.y = -display.contentWidth/2, -display.contentHeight/2
snapshot.group:insert(background)

I get the result that I want. So, does this mean that a snapshot's origin is always its center, regardless of the anchorX / anchorY properties?



[TOPIC: post.html]
#6

jeremytm

[GLOBAL: userInfoPane.html]
jeremytm
  • Observer

  • 8 posts
  • Corona SDK

Yep, you're right.

 

And coupled with this bug, http://forums.coronalabs.com/topic/50862-groups-within-groups-within-snapshots/ means that full screen snapshots where groups are involved are not a fun time.




[topic_controls]
[/topic_controls]