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

Rotate viewport #109

Open
justgage opened this issue Dec 28, 2013 · 7 comments
Open

Rotate viewport #109

justgage opened this issue Dec 28, 2013 · 7 comments

Comments

@justgage
Copy link

I'm not sure how hard this would be but I think it would be awesome to be able to rotate view-ports.

@hornta
Copy link

hornta commented Jan 1, 2014

Will you provice and example of using a rotated viewport? Maybe a minimap which centers on you?

@ippa
Copy link
Owner

ippa commented Jan 1, 2014

Do you have a special usecase in mind? Code-wise it probably shouldn't be much work due to the flexibility of the canvas. It would be like 1 line to add here:

https://github.com/ippa/jaws/blob/master/src/viewport.js#L152

I would suggest adding it to your local jaws.js for the time being to get a feel for if we really want it there.. you could of course do your context.rotate before whatever canva draw-call in your game code too.. Also I'm a bit busy with clientwork for 2-3 weeks now.

@justgage
Copy link
Author

justgage commented Jan 1, 2014

I think it would be good in many situations such as if you had a racing game that you wanted to view to rotate to face whichever way the car is going, a space game like they need to be fed -> http://gmc.yoyogames.com/index.php?showtopic=469713 (where the view would rotate with it the player) I think there's tons of really cool things you could do with it.

@ippa
Copy link
Owner

ippa commented Jan 2, 2014

mm.. good examples. One thing with rotation is that you also need an anchorpoint. In jaws.Sprite you have setAnchor("center|top_left|bottom_center|etc..."). Thinking if something similar makes sense for the viewport or you usually want more exact control when rotating it.

@justgage
Copy link
Author

justgage commented Jan 2, 2014

More control is always better but I would say that the default would be center.

@ippa
Copy link
Owner

ippa commented Jan 3, 2014

Looking more into this I think it might not be as straightforward as I first thought. If we put rotate in Viewport.apply basically everything will be rotated (of course not a HUD/opther thigns outside of viewport.apply()). I'm not sure this will lead to the desired behavior, rotating enemies, player, backgrounds around a single point...?

I suggest you test some with a game you're developing to understand what we really want here. Right now I don't have the time to dive deep into this. I would suggest starting by implementing this.angle in Viewport just as Sprite does it.. (as suggested above). It might be what you want but I'm not sure.

@justgage
Copy link
Author

justgage commented Jan 3, 2014

I'll have to look into it when I have time.

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

No branches or pull requests

3 participants