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

Author Topic: Scaled Tiles  (Read 2494 times)

0 Members and 2 Guests are viewing this topic.

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Scaled Tiles
« on: January 01, 2010, 03:31:55 pm »
What will be best way to solve my problem? I tried

Code: [Select]

float Scale = Tileset.GetHeight() * 1.0f /Field_Size ;
sf::IntRect Rect((Element_Type*Tileset.GetHeight()) * Scale, 0, (Tileset.GetHeight()) * Scale, (Tileset.GetHeight())*Scale);
Tileset_Sprite.SetScale(Scale,Scale);Tileset_Sprite.SetSubRect(Rect);Tileset_Sprite.SetPosition(Field_Pos_X, Field_Pos_Y);
Render->Draw(Tileset_Sprite);


But it don't works.

Maybe is possible to make sprite from part of another sprite, but I don't found it. Any suggestions?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Scaled Tiles
« Reply #1 on: January 01, 2010, 04:51:12 pm »
What do you exactly want to achieve? Express it in words, not code.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Scaled Tiles
« Reply #2 on: January 01, 2010, 05:26:44 pm »
I want get scaled tile on my screen.

Edit. I forgot Imag.Copy. Sorry for making problems.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Scaled Tiles
« Reply #3 on: January 01, 2010, 06:46:54 pm »
To scale a sprite just use SetScale.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Scaled Tiles
« Reply #4 on: January 02, 2010, 12:54:01 am »
Quote from: "ShadowDancer"
Edit. I forgot Imag.Copy. Sorry for making problems.
What does sf::Image::Copy() have to do with this issue? You needn't edit the source image to scale your tiles, but the sprite.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: