zori_style.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #include <allegro5/allegro_color.h>
  2. #include "zori.h"
  3. #include "zori_style.h"
  4. static struct zori_style * the_default_style = NULL;
  5. /** Initialize the global default style. */
  6. zori_id zori_initialize_default_style(void) {
  7. the_default_style = calloc(1, sizeof(*the_default_style));
  8. if (!the_default_style) return ZORI_ID_ENOMEM;
  9. the_default_style->text.font = al_create_builtin_font();
  10. the_default_style->text.color = al_color_name("white");
  11. the_default_style->text.font_flags= ALLEGRO_ALIGN_LEFT;
  12. the_default_style->border.color = al_color_name("white");
  13. the_default_style->back.color = al_color_name("green");
  14. the_default_style->fore.color = al_color_name("white");
  15. the_default_style->mark.color = al_color_name("lightgreen");
  16. the_default_style->hover.color = al_color_name("yellowgreen");
  17. return ZORI_ID_OK;
  18. }
  19. /** Returns the golbal default style */
  20. struct zori_style * zori_get_default_style() {
  21. return the_default_style;
  22. }
  23. /** Destroys the global default style. */
  24. void zori_destroy_default_style(void) {
  25. free(the_default_style);
  26. the_default_style = NULL;
  27. }