SFML community forums

Help => Graphics => Topic started by: Doodlemeat on March 07, 2014, 11:14:37 pm

Title: Diagonal views
Post by: Doodlemeat on March 07, 2014, 11:14:37 pm
Hello SFML users;

I have a question about views;
As far as I can see, SFML only supports AABB views(rectuanglar views);

But I want to have a viewport with a diagonal segment. Exactly like this image:
(http://i.imgur.com/jjdi0aa.png)

Is this possible in SFML?
Title: Re: Diagonal views
Post by: eXpl0it3r on March 08, 2014, 12:06:43 am
Everything is possible somehow, but it sure is not possible with the standard SFML view port. ;)

One way would be to render the full rectangle image to a render texture and the blend over with a transparent layer and then render them to the window.
Title: Re: Diagonal views
Post by: Mutoh on March 10, 2014, 12:57:59 am
This is what I thought at first glance (no code):

* Have two RenderTextures, two Views and two Sprites for each player.
* Both Views, which you will use to follow the players, should have the same rotation.
* The Sprites should have their textures' set to the RenderTextures' textures.
* Place one of the Sprites right below the other (sprite2.setPosition(0, sprite1.getGlobalBounds().height))

* Have a third RenderTexture (or draw straight to your window) and a third View.
* This third View should have the same rotation of the previous Views.
* Position the third View to the middle of the two sprites (view3.setCenter(sprite1.getGlobalBounds().width / 2.f, sprite2.getPosition().y))
* Don't forget to set our third RenderTexture's view to this third View.

* Then you have renderTexture1 draw player 1, renderTexture2 draw player 2, and renderTexture3 draw renderTexture1 and 2 through sprite1 and sprite2.

 ;)
Title: Re: Diagonal views
Post by: Hapax on March 13, 2014, 07:08:13 pm
Have you seen this post (http://en.sfml-dev.org/forums/index.php?topic=14654.0)? ;)