drawer_properties.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 "drawer_properties.hpp"
  17. DrawerProperties* DrawerProperties::current_ = 0;
  18. class DrawerPropertiesImpl
  19. {
  20. public:
  21. CL_Color color;
  22. float base_size;
  23. float spacing;
  24. Brush brush;
  25. };
  26. DrawerProperties*
  27. DrawerProperties::current()
  28. {
  29. if (!current_)
  30. return (current_ = new DrawerProperties());
  31. else
  32. return current_;
  33. }
  34. DrawerProperties::DrawerProperties()
  35. : impl(new DrawerPropertiesImpl())
  36. {
  37. impl->color = CL_Color(255, 255, 255, 255);
  38. impl->base_size = 1.0f;
  39. impl->base_size = 1.0f;
  40. impl->spacing = 15.0f;
  41. }
  42. void
  43. DrawerProperties::set_spacing(float spacing_)
  44. {
  45. impl->spacing = spacing_;
  46. }
  47. float
  48. DrawerProperties::get_spacing() const
  49. {
  50. return impl->spacing;
  51. }
  52. void
  53. DrawerProperties::set_size(float s)
  54. {
  55. impl->base_size = s;
  56. }
  57. float
  58. DrawerProperties::get_size() const
  59. {
  60. return impl->base_size;
  61. }
  62. void
  63. DrawerProperties::set_color(const CL_Color& color_)
  64. {
  65. impl->color = color_;
  66. }
  67. CL_Color
  68. DrawerProperties::get_color() const
  69. {
  70. return impl->color;
  71. }
  72. void
  73. DrawerProperties::set_brush(const Brush& brush)
  74. {
  75. impl->brush = brush;
  76. }
  77. Brush
  78. DrawerProperties::get_brush() const
  79. {
  80. return impl->brush;
  81. }
  82. /* EOF */