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

Author Topic: Drawing stuff  (Read 2337 times)

0 Members and 2 Guests are viewing this topic.

dleanjeanz

  • Newbie
  • *
  • Posts: 11
    • View Profile
Drawing stuff
« on: May 11, 2014, 11:35:31 am »
How do you draw an isosceles triangle with the vertex angle of some specific angle (like 85º, 80º or 70º)?
What is the highest anti-aliasing level?

New question:
How do you put sf::CircleShape into a sf::Sprite?

To put something into a sf::Sprite, I have to use a texture. And to put something in the texture, I have to load an image. I have no idea how to do this.
« Last Edit: May 14, 2014, 05:48:01 pm by dleanjeanz »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Drawing stuff
« Reply #1 on: May 11, 2014, 12:06:24 pm »
What SFML needs are the positions of the vertices, so you need to do some trigonometry to figure out where you want the vertices to be given those conditions.  The exact code you want probably only requires a couple of sin()/cos() calls.

The maximum available anti-aliasing level is determined by the hardware.  I believe typical values are 2, 4 and 6, but I don't know how high it goes these days.
Edit: After some quick googling I found mentions of 16 and 32, so I guess the maximum is pretty high.  I doubt most games would benefit from 32xAA though.
« Last Edit: May 11, 2014, 12:11:09 pm by Ixrec »

dleanjeanz

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Drawing stuff
« Reply #2 on: May 11, 2014, 12:40:55 pm »
Would you mind drawing an isosceles triangle with an initial vertex point? I don't know anything about the er... trigonometry. Thanks. :D

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Drawing stuff
« Reply #3 on: May 11, 2014, 01:40:43 pm »
I think this covers all the trigonometry you'll need for dealing with simple triangles: http://www.dummies.com/how-to/content/trigonometry-for-dummies-cheat-sheet.html  The Laws of Sines/Cosines are the most useful for this particular question.

And no, I'm not going to write the code for you.  You have to learn how to figure these things out for yourself =)
« Last Edit: May 11, 2014, 01:47:44 pm by Ixrec »

dleanjeanz

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Drawing stuff
« Reply #4 on: May 18, 2014, 06:18:11 pm »
Hey, is it possible to make a rectangle shaped texture/image become parallelogram shaped?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Drawing stuff
« Reply #5 on: May 18, 2014, 06:38:49 pm »
Sure.  If you draw it with a sf::VertexArray rather than an sf::Sprite, you can use any vertices you like, which will allow you to "twist" the rectangular texture into a parallelogram or any other quadrilateral.

Make sure you read the tutorial on vertex arrays since they're a little bit more work than sprites.

dleanjeanz

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Drawing stuff
« Reply #6 on: May 19, 2014, 06:40:10 am »
OK. Thanks

 

anything