Drawning lines?

edited April 2012 in Help request
I want to draw a line under the mouse when the button is pressed.
The code of tracking the mouse and saving the points is already done, now I need to draw the lines...
Is there any easy way to draw a line from one point to another or do I need to draw a picture and scale it to simulate a line?

Comments

  • edited April 2012
    Use orxDisplay_DrawLine to achieve that. You can read a bit about using it and other draw functions in these topics:

    https://forum.orx-project.org/discussion/3759
    https://forum.orx-project.org/discussion/3374#Comment_3421
  • edited April 2012
    Small (obvious) precision: this only exists in the svn version, not in the 1.3rc0 release. :)
  • edited May 2012
    Well, I am using a LOT (up to thousands) of objects (1 pixel red dots). Since they all use the same texture, I believe they won't be really heavy... am I wrong on assuming this?
  • edited May 2012
    The drawing part won't be heavy no, but the sorting/culling one will be as we have to iterate through the whole collection and that is going to be costly.

    What is the intent of having those thousands of red dots? If you really need that many dots, I'd recommend using only a single object and then either using an appropriate shader or overriding its rendering (by listening or the orxRENDER_EVENT_OBJECT_START) and issuing yourself the thousands draw calls using the orxDisplay interface.
  • edited May 2012
    to move the character you click over it and draw a path for him to walk. I want the path to be visually displayed, so I am using the red dots to show on screen the path drawn.
  • edited May 2012
    In that case I'd recommend having a single "path" object and issuing a orxDisplay_DrawPolyLine() call.

    Also you might want to consider using catmull-rom splines for a smoother path (there are functions for that in the orxMath module I believe).
Sign In or Register to comment.