Guest User

Untitled

a guest
Dec 5th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.16 KB | None | 0 0
  1. collections {
  2.  
  3. color_classes {
  4. color_class {
  5. name: "button_bg,1";
  6. color: 200 200 200 255;
  7. }
  8. color_class {
  9. name: "button_bg,2";
  10. color: 200 200 200 255;
  11. }
  12. color_class {
  13. name: "button_bg,3";
  14. color: 200 200 200 255;
  15. }
  16. color_class {
  17. name: "button_bg,4";
  18. color: 200 200 200 255;
  19. }
  20. }
  21.  
  22. group {
  23. name: "example/main";
  24. min: 400 400;
  25.  
  26. parts {
  27. part {
  28. name: "bg";
  29. type: RECT;
  30. mouse_events: 0;
  31. description {
  32. state: "default" 0.0;
  33. }
  34. }
  35.  
  36. part {
  37. name: "title";
  38. type: TEXT;
  39. mouse_events: 0;
  40. description {
  41. state: "default" 0.0;
  42. color: 0 0 0 255;
  43. rel1 {
  44. relative: 0.0 0.0;
  45. offset: 0 0;
  46. to: "bg";
  47. }
  48. rel2 {
  49. relative: 1.0 0.2;
  50. offset: -1 -1;
  51. to: "bg";
  52. }
  53. text {
  54. text: "Dynamic Multiseat Example";
  55. size: 16;
  56. font: "sans";
  57. min: 1 1;
  58. }
  59. }
  60. }
  61.  
  62. part {
  63. name: "buttons";
  64. type: RECT;
  65. mouse_events: 0;
  66. description {
  67. state: "default" 0.0;
  68. rel1.relative: 0.2 0.3;
  69. rel2.relative: 0.8 0.9;
  70. color: 255 255 255 0;
  71. }
  72. }
  73.  
  74. part {
  75. name: "button_bg,1";
  76. type: RECT;
  77. mouse_events: 1;
  78. description {
  79. state: "default" 0.0;
  80. rel1 {
  81. to: "buttons";
  82. relative: 0.1 0.1;
  83. }
  84. rel2 {
  85. to: "buttons";
  86. relative: 0.45 0.45;
  87. }
  88. color_class: "button_bg,1";
  89. }
  90. }
  91.  
  92. part {
  93. name: "button1";
  94. type: RECT;
  95. mouse_events: 0;
  96. description {
  97. state: "default" 0.0;
  98. rel1 {
  99. to: "button_bg,1";
  100. offset: 10 10;
  101. }
  102. rel2 {
  103. to: "button_bg,1";
  104. offset: -11 -11;
  105. }
  106. color: 200 200 200 255;
  107. }
  108. }
  109.  
  110. part {
  111. name: "button_bg,2";
  112. type: RECT;
  113. mouse_events: 1;
  114. description {
  115. state: "default" 0.0;
  116. rel1 {
  117. to: "buttons";
  118. relative: 0.55 0.1;
  119. }
  120. rel2 {
  121. to: "buttons";
  122. relative: 0.9 0.45;
  123. }
  124. color_class: "button_bg,2";
  125. }
  126. }
  127.  
  128. part {
  129. name: "button2";
  130. type: RECT;
  131. mouse_events: 0;
  132. description {
  133. state: "default" 0.0;
  134. rel1 {
  135. to: "button_bg,2";
  136. offset: 10 10;
  137. }
  138. rel2 {
  139. to: "button_bg,2";
  140. offset: -11 -11;
  141. }
  142. color: 200 200 200 255;
  143. }
  144. }
  145.  
  146. part {
  147. name: "button_bg,3";
  148. type: RECT;
  149. mouse_events: 1;
  150. description {
  151. state: "default" 0.0;
  152. rel1 {
  153. to: "buttons";
  154. relative: 0.1 0.55;
  155. }
  156. rel2 {
  157. to: "buttons";
  158. relative: 0.45 0.9;
  159. }
  160. color_class: "button_bg,3";
  161. }
  162. }
  163.  
  164. part {
  165. name: "button3";
  166. type: RECT;
  167. mouse_events: 0;
  168. description {
  169. state: "default" 0.0;
  170. rel1 {
  171. to: "button_bg,3";
  172. offset: 10 10;
  173. }
  174. rel2 {
  175. to: "button_bg,3";
  176. offset: -11 -11;
  177. }
  178. color: 200 200 200 255;
  179. }
  180. }
  181.  
  182. part {
  183. name: "button_bg,4";
  184. type: RECT;
  185. mouse_events: 1;
  186. description {
  187. state: "default" 0.0;
  188. rel1 {
  189. to: "buttons";
  190. relative: 0.55 0.55;
  191. }
  192. rel2 {
  193. to: "buttons";
  194. relative: 0.9 0.9;
  195. }
  196. color_class: "button_bg,4";
  197. }
  198. }
  199.  
  200. part {
  201. name: "button4";
  202. type: RECT;
  203. mouse_events: 0;
  204. description {
  205. state: "default" 0.0;
  206. rel1 {
  207. to: "button_bg,4";
  208. offset: 10 10;
  209. }
  210. rel2 {
  211. to: "button_bg,4";
  212. offset: -11 -11;
  213. }
  214. color: 200 200 200 255;
  215. }
  216. }
  217. }
  218.  
  219. script {
  220. public red;
  221. public green;
  222. public blue;
  223. public seat_count;
  224. }
  225.  
  226. programs {
  227. program {
  228. name: "load";
  229. signal: "load";
  230. source: "";
  231. script {
  232. emit("Ahoy", "");
  233. }
  234. }
  235.  
  236. program {
  237. name: "seat,added";
  238. signal: "seat,added,*";
  239. source: "";
  240. script {
  241. new seat_name[128];
  242. new buf[256];
  243. new r, g, b;
  244.  
  245. r = rand() * 255 / 65535;
  246. append_int(red, r);
  247. g = rand() * 255 / 65535;
  248. append_int(green, g);
  249. b = rand() * 255 / 65535;
  250. append_int(blue, b);
  251.  
  252. set_int(seat_count, get_int(seat_count) + 1);
  253.  
  254. strncpy(seat_name, sig[strlen("seat,added,")],
  255. strchr(sig[strlen("seat,added,")], ","));
  256. snprintf(buf, 128, "seat,color,%s,r=%i,g=%i,b=%i", seat_name,
  257. r, g, b);
  258. emit(buf, "theme");
  259. }
  260. }
  261.  
  262. program {
  263. name: "button,in";
  264. signal: "mouse,in,*";
  265. source: "button_bg,*";
  266. script {
  267. new idx, r, g, b;
  268.  
  269. idx = atoi(sig[strlen("mouse,in,seat")]) - 1;
  270. r = fetch_int(red, idx);
  271. g = fetch_int(green, idx);
  272. b = fetch_int(blue, idx);
  273.  
  274. set_color_class(src, r, g, b, 255);
  275. }
  276. }
  277.  
  278. program {
  279. name: "button,out";
  280. signal: "mouse,out,*";
  281. source: "button_bg,*";
  282. script {
  283. set_color_class(src, 200, 200, 200, 255);
  284. }
  285. }
  286. }
  287. }
  288. }
Advertisement
Add Comment
Please, Sign In to add comment