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

Author Topic: more visible view values, or matrix exposure.  (Read 2925 times)

0 Members and 1 Guest are viewing this topic.

NinjaFighter

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://www.sebagames.wordpress.com
more visible view values, or matrix exposure.
« on: April 10, 2011, 06:18:53 am »
I can't figure a cool way to atach sprites, because the View transformation it's a bit differente from sprite transformation. For example, I want to draw a shadow for a game character made with various parts (just like classic konami game's bosses)... then y trying to scale the view, using as center the center/bottom point of the character, and scale it only in the Y axis with a -0.5f value. But there's no a easy way to do this, because there's no Zoom method with a Vector2 parameter.

I want to do something like this:
Code: [Select]

view.Center = boss.StandPoint;
view.Scale(boss.Direction,-0.5f);


I'm explaining right?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
more visible view values, or matrix exposure.
« Reply #1 on: April 10, 2011, 09:58:46 am »
View::Zoom is just a shortcut for View::SetSize.

So:
Code: [Select]
view.SetSize(view.GetSize().x, view.GetSize().y * -0.5f);
Laurent Gomila - SFML developer

NinjaFighter

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://www.sebagames.wordpress.com
more visible view values, or matrix exposure.
« Reply #2 on: April 10, 2011, 07:52:18 pm »
Ok, I already did, but I don't want resolve by using View.Size, because this affects rotations too... (for a single sprite shadow's cases it's fine) But, if I rotate the view and change the size... the size has been changed exactly as if I had not change rotation before.
For displayAttachment this looks a bit complicated, because I want to modify the view like a matrix (for display attaching purposes), so I want to do some like this:
Code: [Select]

matrix = matrix.CreateTranslation(new Vector2(100f,120f));
matrix = matrix.CreateRotation(MathBasics.TWO_PI * 0.1f);
matrix = matrix.CreateScale(0.5f,2f);
Draw();


But the result to modify views, it's like do that:
Code: [Select]

matrix = matrix.CreateScale(0.5f,2f);
matrix = matrix.CreateTranslation(new Vector2(100f,120f));
matrix = matrix.CreateRotation(MathBasics.TWO_PI * 0.1f);
Draw();


Really, this request is because I have a DisplayObject hierarchi system, so I need to figure how to work with matrix more directly. :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
more visible view values, or matrix exposure.
« Reply #3 on: April 10, 2011, 09:38:49 pm »
There's no way to do what you want.
Laurent Gomila - SFML developer

NinjaFighter

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://www.sebagames.wordpress.com
more visible view values, or matrix exposure.
« Reply #4 on: April 10, 2011, 10:11:42 pm »
There are plans to expose matrix or something that permitt to do these thing in the future? This is a very useful feature in various ways, and could be sad to have to implement a renderer via openGl only for this. Lately there are various games that've currently using cut-out animation, and for this technique is strictly necessary to work with matrix or similar.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
more visible view values, or matrix exposure.
« Reply #5 on: April 10, 2011, 10:37:41 pm »
Quote
There are plans to expose matrix or something that permitt to do these thing in the future?

No, sorry.
Laurent Gomila - SFML developer

NinjaFighter

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://www.sebagames.wordpress.com
more visible view values, or matrix exposure.
« Reply #6 on: April 10, 2011, 11:29:52 pm »
oh... what a pity...  :cry:
anyway, thanks for don't do a void promise.  :)
Otherwise, I'm currently using my own api with a abstract layer, so I can implement this via Tao.OpenGl directly instead Sfml's sprites when I need to using cutout animation or various sprite attachment.