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.


Topics - sherlok

Pages: [1]
1
Graphics / Shape vs. Window coordinates
« on: October 09, 2009, 10:15:36 pm »
I did some searching and didn't see anything that directly addressed this  - if I missed something obvious, sorry I'm new.

Basically I'm simply drawing a sprite on the screen (moving it around). However I'm noticing it's position looks off (I know I'm definitely missing something).

So I create a window
Code: [Select]
Win.Create(sf::VideoMode(600, 800, 32), "Test");

Then I basically loop and draw my shape:

Code: [Select]

//In the constructor
circle = sf::Shape::Circle(posX, posY, 5, sf::Color(255, 0, 0, 255));

//In my draw function
//...do some position calculations:
circle.SetPosition(posX, posY);


The problem here, is if I set the posX, posY to 0,0 - then it drops the sprite in the top left as expected.

However putting it at 600,800 moves it off the screen.

In fact, drawing it at 300,400 puts it at the bottom right of my window.

Now I wouldn't be so weirded out about this if it didn't display a 600x800 background image entirely. So I'd expect the coordinates to line up.

I was just wondering why? Can this be fixed with a view? If I move the view out so that 600x800 is indeed the bottom right, won't that mess up my background image (since it fits teh window perfectly now)?

Pages: [1]