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

Author Topic: Scale 9 Image in SFML?  (Read 1187 times)

0 Members and 1 Guest are viewing this topic.

smartly

  • Newbie
  • *
  • Posts: 10
    • View Profile
Scale 9 Image in SFML?
« on: November 12, 2014, 04:50:32 am »
like CCScale9Sprite in cocos2d-x.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Scale 9 Image in SFML?
« Reply #1 on: November 12, 2014, 07:44:44 am »
http://en.sfml-dev.org/forums/index.php?topic=5559.msg36367#msg36367

It's a bit rude to provide just an image without problem description and let us guess. In case of a feature request, you're also in the wrong forum...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Scale 9 Image in SFML?
« Reply #2 on: November 12, 2014, 08:41:57 am »
Although he's completely right, I believe I understand what Scale9 sprites are supposed to do, so...

This sort of stretching logic is at a much higher level than SFML's scope, so it wouldn't be appropriate to put anything like it in SFML itself.  However, it should be fairly simple to write a Scale9Sprite class that contains a texture, the margin sizes and the drawing size, and internally uses a vertex array to draw the appropriate subregions of the texture at the appropriate subregions of where it's being drawn.  This would be a good project to put on the wiki.

 

anything