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

Author Topic: Tilemap Clipping  (Read 1576 times)

0 Members and 1 Guest are viewing this topic.

Makuto

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Au 79 Games
    • Email
Tilemap Clipping
« on: December 08, 2011, 04:23:41 am »
Hi, I just finished coding a simple tile map outputting system and was pondering over the problem of clipping the sprites at the top and left edges of the window.  I was planning on having smooth(ish) scrolling where the tiles move over as little as 1 pixel even though they are 64X64 or 32X32.  I am aware that if the origin is negative the image isn't displayed.  What would the best way be to handle the clipping of the tiles?  Would sf::View work well?
EDIT: Actually, I guess images ARE still displayed even if the origin is negative.  I guess I don't really need to worry about the clipping anymore :)
Macoy Madson-Au 79 Games
Check out my work at http://augames.f11.us/
Most of my SFML-related code is here: https://github.com/makuto/personal/tree/master/gameDev/resources/base2.0
I try to KIS(S), do you?

nitrix

  • Newbie
  • *
  • Posts: 27
    • View Profile
Tilemap Clipping
« Reply #1 on: December 08, 2011, 05:27:17 am »
As soon as you're moving a map, apparently what you want is a Camera implementation using sf::View.

What I'm doing at the moment, I draw tiles (32x32 pixels) in chunks of 50x50.

I always draw them at the same position, but I move the sf::View around when the player moves.

That way, it's fairly simple to keep track/render everything, AND, when I know a chunk is too far away to be drawn on the screen, I unload it :)

 

anything