Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nolanvance

Pages: [1]
1
Window / Re: Getting screen boundaries
« on: February 22, 2013, 09:19:49 pm »
I've been using this function to keep aspect ratio when changing resolution.

 
        window.create(sf::VideoMode(resX,resY),"asdasda",sf::Style::Fullscreen);
       
        int newH = (width*resY)/resX;
        int displace = (newH - height)/(-2);

        v1 = sf::View(sf::FloatRect(0,displace,width,newH));
        v1.setCenter(width/2,height/2);

        window.setView(v1);
       
        height = resY;
        width = resX;

 

2
Window / Re: Getting screen boundaries
« on: February 21, 2013, 01:20:57 am »
yeah man I tried that but it just spits out the same number.  :(

I am also using 2.0 rc

3
Window / Re: Getting screen boundaries
« on: February 20, 2013, 10:12:46 pm »
sf::Vector2f top;
top = sf::Vector2f(0,tools->ReturnView().getSize().y*.65);

if(players[0].ReturnSprite().getPosition().y <= top.y)
        players[0].StopMovement(true);
 

Let me revise, I want to convert players coordinates to the screen coordinates (like mouse::getPosition())

For example my screen is 1200, and I want to not 65% of the screen to be off limits to the player.

top.y is = 540 which is right , but the players coordinates at the same place is equal to  abou -290

4
Window / Getting screen boundaries
« on: February 20, 2013, 09:28:13 pm »
I've searched the forums for a couple of days but came up short..

Basically I'm just trying to get the screen boundaries so I can make my character stay in the window.

I'm having issues with the coordinate system. My scene coordinates are way off. (0,0) is towards the bottom left of the screen but the views coordinates are set at width/2 and height/2. This is throwing my calculations way off.

I guess my question is why are my scene coordinates wrong?

Pages: [1]
anything