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

Author Topic: Dynamic texture  (Read 1943 times)

0 Members and 1 Guest are viewing this topic.

zoran404

  • Newbie
  • *
  • Posts: 41
    • View Profile
Dynamic texture
« on: March 18, 2013, 09:50:18 pm »
I have an image, the game map.
I have to use different part of the map as the player moves. And my idea is to use texture that would contain different part of the image.
But, since I'm new to sfml, I don't know how to set the texture to a certain part of the image and how to change the viewed part later on.
So, any ideas?
I know I can just set TextureRect for each element, but I don't want that.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Dynamic texture
« Reply #1 on: March 18, 2013, 10:16:03 pm »
Quote
I know I can just set TextureRect for each element, but I don't want that.
Why? If it's not what you want, then I don't understand your problem.
Laurent Gomila - SFML developer

zoran404

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Dynamic texture
« Reply #2 on: March 18, 2013, 10:45:18 pm »
Map image is realy big, so I want only the needed part it in the texture.
The other way requires the whole picture to be in the texture and texture has relatively small max size.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Dynamic texture
« Reply #3 on: March 18, 2013, 10:48:52 pm »
All Texture's loadFrom.. have second parameter that can be int rect so you can load only apart of image.
Back to C++ gamedev with SFML in May 2023

 

anything