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

Change rendering start position #1247

Open
nyovaya opened this issue Oct 16, 2018 · 10 comments
Open

Change rendering start position #1247

nyovaya opened this issue Oct 16, 2018 · 10 comments

Comments

@nyovaya
Copy link

nyovaya commented Oct 16, 2018

I think it would be senseful to allow setting the coordinate from where the renderer start drawing to the window. This could be useful in bigger scenes.

@bvssvni
Copy link
Member

bvssvni commented Oct 17, 2018

You can do this by transforming the coordinate system. See https://docs.rs/piston2d-graphics/0.26.0/graphics/trait.Transformed.html

Are you thinking about an easier way to do this?

@nyovaya
Copy link
Author

nyovaya commented Oct 17, 2018

@bvssni do I need to implement it myself for window? Or how do I use it?

@bvssvni
Copy link
Member

bvssvni commented Oct 19, 2018

let d = c.trans(x, y);

@nyovaya
Copy link
Author

nyovaya commented Oct 19, 2018

@bvssvni wouldn't that mean I need to use this function for every object I am going to draw?

@bvssvni
Copy link
Member

bvssvni commented Oct 19, 2018

No, you just use d instead of c as Context.

@nyovaya
Copy link
Author

nyovaya commented Oct 19, 2018

when using trans() is feels like the direction is inverted - the objects move up if its < 0 and down if its > 0 - is that so?

@bvssvni
Copy link
Member

bvssvni commented Oct 19, 2018

The y-axis is down by default. This is common in 2D graphical systems. You can change this too, using scale(1, -1), but then you need to move it down trans(0, -y) to the place you want origo.

@nyovaya
Copy link
Author

nyovaya commented Oct 19, 2018

I know that the y-axis goes down in 2D but if I increase y then y goes down should then the object not be renderer like cut off at the top and not move down? And only move down if decrease y?

@bvssvni
Copy link
Member

bvssvni commented Oct 19, 2018

This depends on whether you scale before or after.

@nyovaya
Copy link
Author

nyovaya commented Oct 19, 2018

I didnt use scaling.
trans() seems more like it causes the objects to "move" instead of changing the position from where the rendering starts.

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

No branches or pull requests

2 participants