@Cursor.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. class Cursor
  4. {
  5. bool onViewport ()C; // if the cursor is on one of the editing world viewports
  6. bool valid ()C; // if the cursor points to a valid location , this should be tested before using the cursor positions
  7. bool onHeightmap()C; // if cursor is on a heightmap
  8. C Vec2 & screenPos ()C; // get cursor screen position
  9. C Vec & pos ()C; // get cursor world position , this can be used only after testing the 'valid' method
  10. C VecI2& area ()C; // get area world coordinates , this can be used only after testing the 'valid' method
  11. C VecI2& xz ()C; // get coordinates according to current grid, this can be used only after testing the 'valid' method
  12. C Edge2& edge ()C; // get 2D edge on the ground surface, where one point has the position of the cursor in previous frame, while other point has current cursor position, this can be used only after testing the 'valid' method
  13. bool on()C; // if cursor is on
  14. bool pd()C; // if cursor is pushed
  15. bool rs()C; // if cursor is released
  16. bool db()C; // if cursor is double clicked
  17. bool notFirstEdit()C;
  18. Touch* touch()C; // get touch linked with this cursor
  19. Edit::Viewport4::View* view()C;
  20. void update(C Vec2 &screen_pos, GuiObj*go, bool on, bool db, WorldView &we);
  21. void removed(Obj &obj);
  22. //private:
  23. bool _valid, _on_heightmap;
  24. byte _state;
  25. uint _touch_id;
  26. flt _brush_height, _brush_height_help;
  27. Vec2 _screen_pos;
  28. Vec _pos, _pos_prev;
  29. VecI2 _area, _xz;
  30. Edge2 _edge;
  31. Obj *_obj;
  32. Edit::Viewport4::View *_view;
  33. RayTest _ray_test;
  34. public:
  35. Cursor();
  36. };
  37. /******************************************************************************/
  38. /******************************************************************************/
  39. /******************************************************************************/