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

Author Topic: [C++ Class] DrawableLineShape  (Read 27923 times)

0 Members and 1 Guest are viewing this topic.

quasius

  • Full Member
  • ***
  • Posts: 166
    • View Profile
[C++ Class] DrawableLineShape
« on: August 24, 2008, 06:28:56 am »
I've decided to start contributing classes I've made to work with SFML that are clean enough / don't rely on modified SFML / etc. for public release.  I'll have others, but the first one is a drawable-derived class for shapes composed of lines.  While this same effect can be achieved with multiple sf::Shape primitives, my class is specifically designed for this task and is thus much faster (and I think simpler) making use of both GL_LINES and display lists.
Read the comment on top of the header for quick info on how to make a shape.  It's pretty simple.  You define vertices and then connect them however you want with line segments.  The shapes can then be modified dynamically by adding/removing/moving points and line segments.
It should work fine, but let me know if you encounter any problems.
It's released under the same license as SFML, zlib/png and is located under "sources" in the wiki.

I'll probably be releasing an animated sprite class later.  (It works, but isn't ready for public release.)
I also have an extension for SFML to add alpha texture objects that can then be used to make blended/overlayed/shadowed sprites, etc.  But I'm not as sure about releasing that since it requires modding SFML and is not quite as "just-drop-it-in" as the others.

@Laurent:  This is my first time editing a wiki, so if you end up with a log that said someone did like 10 edits before getting it right...  um sorry.  :oops:


Edit:  Here's a screenshot demo.  Both the map border and terrain tile selection boxes are easily done with this class.


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[C++ Class] DrawableLineShape
« Reply #1 on: August 24, 2008, 10:00:38 am »
Thank you :)

Not bad for a first entry in the wiki; I just edited it to make a single entry in the main menu instead of having 2 direct links to the source code ;)
Laurent Gomila - SFML developer