scegra.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #ifndef scegra_H_INCLUDED
  2. #define scegra_H_INCLUDED
  3. #include "eruta.h"
  4. typedef struct Scegra_ Scegra;
  5. typedef struct ScegraNode_ ScegraNode;
  6. typedef struct ScegraStyle_ ScegraStyle;
  7. typedef struct ScegraPoints_ ScegraPoints;
  8. typedef void ScegraDraw (ScegraNode * node);
  9. typedef void ScegraUpdate(ScegraNode * node, double dt);
  10. typedef void ScegraDone (ScegraNode * node);
  11. #define SCEGRA_VERTEX_MAX 32
  12. /* A very simple scene graph, mainly for drawing the UI that will be managed from
  13. * the scripting side of things. Only one "global" scene graph is supported.
  14. */
  15. void scegra_init();
  16. void scegra_done();
  17. void scegra_update(double dt);
  18. void scegra_draw();
  19. /* Struct: ScegraStyle
  20. * Describes the style of a Scene graph node.
  21. */
  22. struct ScegraStyle_ {
  23. ALLEGRO_COLOR color;
  24. ALLEGRO_COLOR background_color;
  25. ALLEGRO_COLOR border_color;
  26. /* This is a store_xxx id of the background bitmap to show or negative if none. */
  27. int background_image_id;
  28. /* Border thickness, 0 or negative if none. */
  29. float border_thickness;
  30. /* This is a store_xxx id of the font to use or negative if none. */
  31. int font_id;
  32. ALLEGRO_LINE_JOIN line_join_style;
  33. float line_miter_limit;
  34. /* Flags to use when drawing text. */
  35. int text_flags;
  36. /* Flags to use when drawing images. */
  37. int image_flags;
  38. /* Margin between box and contents. */
  39. float margin;
  40. };
  41. ScegraStyle * scegrastyle_initempty(ScegraStyle * self);
  42. int scegra_make_box(int id, BeVec pos, BeVec siz, BeVec round, ScegraStyle style);
  43. int scegra_z(int index);
  44. int scegra_z_(int index, int z);
  45. int scegra_make_text(int id, BeVec pos, BeVec siz, const char * text, ScegraStyle style);
  46. int scegra_make_longtext(int id, BeVec pos, BeVec siz, char * text, ScegraStyle style);
  47. int scegra_make_image(int id, BeVec pos, BeVec siz,int image_id, ScegraStyle style);
  48. int scegra_visible_(int index, int is_visible);
  49. int scegra_image_id_(int index, int rindex);
  50. int scegra_font_id_(int index, int rindex);
  51. int scegra_background_image_id_(int index,int rindex);
  52. int scegra_speed_(int index, float x, float y);
  53. int scegra_size_(int index, float w, float h);
  54. int scegra_position_(int index, float x, float y);
  55. int scegra_border_thickness_(int index, float t);
  56. int scegra_background_color_(int index, int r, int g, int b, int a);
  57. int scegra_border_color_(int index, int r, int g, int b, int a);
  58. int scegra_color_(int index, int r, int g, int b, int a);
  59. int scegra_z_(int index, int z);
  60. int scegra_margin_(int index, float m);
  61. int scegra_speed(int index, float * x, float * y);
  62. int scegra_size(int index, float * w, float * h);
  63. int scegra_position(int index, float *x, float * y);
  64. int scegra_border_thickness(int index, float * t);
  65. int scegra_background_color(int index, int * r, int * g,int * b,int * a);
  66. int scegra_border_color(int index,int * r,int * g,int * b, int * a);
  67. int scegra_color(int index, int * r, int * g, int * b,int * a);
  68. int scegra_image_bitmap_size(int index, int * w, int * h);
  69. int scegra_margin(int index, float * m);
  70. int scegra_make_image(int id, BeVec pos, BeVec siz, int image_id, ScegraStyle style);
  71. int scegra_make_text(int id, BeVec pos, BeVec siz, const char *text, ScegraStyle style);
  72. int scegra_make_box(int id, BeVec pos, BeVec siz, BeVec round, ScegraStyle style);
  73. int scegra_disable_node(int index);
  74. int scegra_get_id(int index);
  75. ScegraNode *scegra_get_node(int index);
  76. int scegra_out_of_bounds(int index);
  77. void scegra_draw();
  78. void scegra_update(double dt);
  79. void scegra_init();
  80. int scegra_nodes_max();
  81. int scegra_id_in_use_p(int index);
  82. int scegra_get_free_id(int minimum);
  83. ScegraStyle *scegrastyle_initempty(ScegraStyle *self);
  84. void scegra_draw_image(ScegraNode *self);
  85. void scegra_draw_text(ScegraNode *self);
  86. void scegra_draw_longtext(ScegraNode *self);
  87. void scegra_draw_box(ScegraNode *self);
  88. void scegra_update_generic(ScegraNode *self, double dt);
  89. int scegra_angle_(int index, float angle);
  90. int scegra_make_box_style_from(int id, BeVec pos, BeVec siz, BeVec round, int sindex);
  91. int scegra_make_text_style_from(int id, BeVec pos, BeVec siz, const char * text, int sindex);
  92. int scegra_make_longtext_style_from(int id, BeVec pos, BeVec siz, const char * text, int sindex);
  93. int scegra_make_image_style_from(int id, BeVec pos, BeVec siz, int image_id, int sindex);
  94. int scegra_image_flags_(int index, int flags);
  95. int scegra_text_flags_(int index, int flags);
  96. int scegra_text_(int index, const char * text);
  97. int scegra_line_stop_(int index, int stop);
  98. int scegra_line_start_(int index, int start);
  99. int scegra_delay_(int index, double delay);
  100. int scegra_line_stop(int index);
  101. int scegra_line_start(int index);
  102. double scegra_delay(int index);
  103. int scegra_page_lines_(int index, int lines);
  104. int scegra_page_lines(int index);
  105. int scegra_paused_(int index, int paused);
  106. int scegra_paused(int index);
  107. int scegra_page(int index);
  108. int scegra_page_(int index, int page);
  109. int scegra_next_page(int index);
  110. int scegra_previous_page(int index);
  111. int scegra_last_page(int index);
  112. int scegra_at_end(int index);
  113. int scegra_show_system_mouse_cursor(int show);
  114. #endif