Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement view bounds for RenderPixi #31

Merged
merged 3 commits into from
Jul 12, 2014

Conversation

mrspeaker
Copy link
Contributor

To control the view port you need to have all sprites in a container, and the container can be moved. So I added a render.container that replaces render.stage where appropriate. I think this is pretty much the correct way to do things, and I need it for my current project - so feel free to close this off if it's not what you had in mind.

Also, for not drawing off-screen sprites in pixi you either need to manually add and remove the sprites - or you can set the visible flag. I've taken that approach:

body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds);

This stops off-screen sprites being rendered, but it still goes through the grouping process in Render.body. I think that ok too though.

@liabru
Copy link
Owner

liabru commented Jun 21, 2014

Looks good, but I found an issue with this when on the Views demo.

If you scroll the mouse wheel when using the canvas renderer, the view zooms in relative to the centre of the view port as expected.

With this pixi version, it seems to render off center and the mouse constraint doesn't seem to be in the right location either when dragging bodies.

I'll look into it but can't find an obvious reason so far, I'm guessing its to do with the transforms in pixi being different to canvas?

Also where does this reset the transforms?

@mrspeaker
Copy link
Contributor Author

Hey - sorry, been AFI (away from internet!) for a week... I'll have a look at this this week and report back! I don't need mouse stuff for my project, so I had ignored it... but I'll need touch stuff anyway which should be about the same.

@liabru
Copy link
Owner

liabru commented Jul 10, 2014

Hey @mrspeaker, did you get any further with this? If you're too busy I'll see if I can get it working myself

liabru added a commit that referenced this pull request Jul 12, 2014
added view bounds for RenderPixi
@liabru liabru merged commit 6652bb4 into liabru:master Jul 12, 2014
@liabru
Copy link
Owner

liabru commented Jul 12, 2014

I figured out the scaling issue, see c1964e2 for my fix.
Thanks again for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants