label_settings.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**************************************************************************/
  2. /* label_settings.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef LABEL_SETTINGS_H
  31. #define LABEL_SETTINGS_H
  32. #include "core/io/resource.h"
  33. #include "font.h"
  34. /*************************************************************************/
  35. class LabelSettings : public Resource {
  36. GDCLASS(LabelSettings, Resource);
  37. real_t line_spacing = 3;
  38. Ref<Font> font;
  39. int font_size = Font::DEFAULT_FONT_SIZE;
  40. Color font_color = Color(1, 1, 1);
  41. int outline_size = 0;
  42. Color outline_color = Color(1, 1, 1);
  43. int shadow_size = 1;
  44. Color shadow_color = Color(0, 0, 0, 0);
  45. Vector2 shadow_offset = Vector2(1, 1);
  46. void _font_changed();
  47. protected:
  48. static void _bind_methods();
  49. public:
  50. void set_line_spacing(real_t p_spacing);
  51. real_t get_line_spacing() const;
  52. void set_font(const Ref<Font> &p_font);
  53. Ref<Font> get_font() const;
  54. void set_font_size(int p_size);
  55. int get_font_size() const;
  56. void set_font_color(const Color &p_color);
  57. Color get_font_color() const;
  58. void set_outline_size(int p_size);
  59. int get_outline_size() const;
  60. void set_outline_color(const Color &p_color);
  61. Color get_outline_color() const;
  62. void set_shadow_size(int p_size);
  63. int get_shadow_size() const;
  64. void set_shadow_color(const Color &p_color);
  65. Color get_shadow_color() const;
  66. void set_shadow_offset(const Vector2 &p_offset);
  67. Vector2 get_shadow_offset() const;
  68. };
  69. #endif // LABEL_SETTINGS_H