Hi I have added multi select by dragging a rectangle on the rendering window in my work.
Method
It’s pretty simple with the built in function like GetMousePosition and WorldToScreenPoint.
But WorldToScreenPoint returns 0…1, while GetMousePosition return relative windows coordinate respect to the resolution. We need to convert one unit into the other to use it.
Suggestion for improvement
- Suggestion to add an overwrite WorldToScreenPoint function that return a relative mouse coordinate. This way I don’t need to get graphic object and calling graphic.GetWidth() and graphic.GetHeight() to convert them into the same unit.
My Question
How to draw and simple 2D rectangle on screen space.
Is there a 2D line or rectangle primitive that preserved line width regardless of zoom scale (e.g. like the 3d debug drawer.)
Or is there a simple way of doing it? Please guide or show me a simple solution.
Thanks,