label_settings.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. real_t paragraph_spacing = 0;
  39. Ref<Font> font;
  40. int font_size = Font::DEFAULT_FONT_SIZE;
  41. Color font_color = Color(1, 1, 1);
  42. int outline_size = 0;
  43. Color outline_color = Color(1, 1, 1);
  44. int shadow_size = 1;
  45. Color shadow_color = Color(0, 0, 0, 0);
  46. Vector2 shadow_offset = Vector2(1, 1);
  47. void _font_changed();
  48. protected:
  49. static void _bind_methods();
  50. public:
  51. void set_line_spacing(real_t p_spacing);
  52. real_t get_line_spacing() const;
  53. void set_paragraph_spacing(real_t p_spacing);
  54. real_t get_paragraph_spacing() const;
  55. void set_font(const Ref<Font> &p_font);
  56. Ref<Font> get_font() const;
  57. void set_font_size(int p_size);
  58. int get_font_size() const;
  59. void set_font_color(const Color &p_color);
  60. Color get_font_color() const;
  61. void set_outline_size(int p_size);
  62. int get_outline_size() const;
  63. void set_outline_color(const Color &p_color);
  64. Color get_outline_color() const;
  65. void set_shadow_size(int p_size);
  66. int get_shadow_size() const;
  67. void set_shadow_color(const Color &p_color);
  68. Color get_shadow_color() const;
  69. void set_shadow_offset(const Vector2 &p_offset);
  70. Vector2 get_shadow_offset() const;
  71. };
  72. #endif // LABEL_SETTINGS_H