objmap_object.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. // Flexlay - A Generic 2D Game Editor
  2. // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #include "objmap_object_impl.hpp"
  17. ObjMapObject::ObjMapObject()
  18. {
  19. }
  20. ObjMapObject::ObjMapObject(const std::shared_ptr<ObjMapObjectImpl>& impl_)
  21. : impl(impl_)
  22. {
  23. }
  24. CL_Pointf
  25. ObjMapObject::get_pos() const
  26. {
  27. if (impl.get())
  28. return impl->pos;
  29. else
  30. return CL_Pointf();
  31. }
  32. void
  33. ObjMapObject::set_pos(const CL_Pointf& p)
  34. {
  35. if (impl.get())
  36. {
  37. impl->pos = p;
  38. }
  39. }
  40. MetaData
  41. ObjMapObject::get_metadata() const
  42. {
  43. if (impl.get())
  44. return impl->data;
  45. else
  46. return MetaData();
  47. }
  48. void
  49. ObjMapObject::set_metadata(const MetaData& data_)
  50. {
  51. if (impl.get())
  52. impl->data = data_;
  53. }
  54. void
  55. ObjMapObject::draw(CL_GraphicContext* gc)
  56. {
  57. if (impl.get())
  58. impl->draw(gc);
  59. }
  60. CL_Rectf
  61. ObjMapObject::get_bound_rect() const
  62. {
  63. if (impl.get())
  64. return impl->get_bound_rect();
  65. else
  66. return CL_Rect();
  67. }
  68. bool
  69. ObjMapObject::is_null() const
  70. {
  71. return !impl.get();
  72. }
  73. bool
  74. ObjMapObject::operator==(const ObjMapObject& obj) const
  75. {
  76. return impl.get() == obj.impl.get();
  77. }
  78. bool
  79. ObjMapObject::operator<(const ObjMapObject& obj) const
  80. {
  81. return impl.get() < obj.impl.get();
  82. }
  83. CL_Signal_v1<ObjMapObject>&
  84. ObjMapObject::sig_select()
  85. {
  86. return impl->on_select;
  87. }
  88. CL_Signal_v1<ObjMapObject>&
  89. ObjMapObject::sig_deselect()
  90. {
  91. return impl->on_deselect;
  92. }
  93. CL_Signal_v1<ObjMapObject>&
  94. ObjMapObject::sig_move()
  95. {
  96. return impl->on_move;
  97. }
  98. void
  99. ObjMapObject::add_control_points()
  100. {
  101. impl->add_control_points();
  102. }
  103. void
  104. ObjMapObject::update_control_points()
  105. {
  106. impl->update_control_points();
  107. }
  108. /* EOF */