drawable.html 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <!-- This file is generated by Nim. -->
  5. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <!-- Favicon -->
  10. <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
  11. <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
  12. <!-- Google fonts -->
  13. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  14. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  15. <!-- CSS -->
  16. <title>nodesnim/graphics/drawable</title>
  17. <link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
  18. <script type="text/javascript" src="dochack.js"></script>
  19. <script type="text/javascript">
  20. function main() {
  21. var pragmaDots = document.getElementsByClassName("pragmadots");
  22. for (var i = 0; i < pragmaDots.length; i++) {
  23. pragmaDots[i].onclick = function(event) {
  24. // Hide tease
  25. event.target.parentNode.style.display = "none";
  26. // Show actual
  27. event.target.parentNode.nextElementSibling.style.display = "inline";
  28. }
  29. }
  30. const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
  31. function switchTheme(e) {
  32. if (e.target.checked) {
  33. document.documentElement.setAttribute('data-theme', 'dark');
  34. localStorage.setItem('theme', 'dark');
  35. } else {
  36. document.documentElement.setAttribute('data-theme', 'light');
  37. localStorage.setItem('theme', 'light');
  38. }
  39. }
  40. toggleSwitch.addEventListener('change', switchTheme, false);
  41. if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
  42. document.documentElement.setAttribute('data-theme', "dark");
  43. toggleSwitch.checked = true;
  44. } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) {
  45. document.documentElement.setAttribute('data-theme', "light");
  46. toggleSwitch.checked = false;
  47. } else {
  48. const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
  49. if (currentTheme) {
  50. document.documentElement.setAttribute('data-theme', currentTheme);
  51. if (currentTheme === 'dark') {
  52. toggleSwitch.checked = true;
  53. }
  54. }
  55. }
  56. }
  57. </script>
  58. </head>
  59. <body onload="main()">
  60. <div class="document" id="documentId">
  61. <div class="container">
  62. <h1 class="title">nodesnim/graphics/drawable</h1>
  63. <div class="row">
  64. <div class="three columns">
  65. <div class="theme-switch-wrapper">
  66. <label class="theme-switch" for="checkbox">
  67. <input type="checkbox" id="checkbox" />
  68. <div class="slider round"></div>
  69. </label>
  70. &nbsp;&nbsp;&nbsp; <em>Dark Mode</em>
  71. </div>
  72. <div id="global-links">
  73. <ul class="simple">
  74. </ul>
  75. </div>
  76. <div id="searchInputDiv">
  77. Search: <input type="text" id="searchInput"
  78. onkeyup="search()" />
  79. </div>
  80. <div>
  81. Group by:
  82. <select onchange="groupBy(this.value)">
  83. <option value="section">Section</option>
  84. <option value="type">Type</option>
  85. </select>
  86. </div>
  87. <ul class="simple simple-toc" id="toc-list">
  88. <li>
  89. <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
  90. <ul class="simple simple-toc-section">
  91. </ul>
  92. </li>
  93. <li>
  94. <a class="reference reference-toplevel" href="#7" id="57">Types</a>
  95. <ul class="simple simple-toc-section">
  96. <li><a class="reference" href="#DrawableObj"
  97. title="DrawableObj = object of RootObj
  98. shadow*: bool
  99. border_width*: float
  100. border_detail*: array[4, int] ## left-top, right-top, right-bottom, left-bottom
  101. border_radius*: array[4, float] ## left-top, right-top, right-bottom, left-bottom
  102. shadow_offset*: Vector2Obj
  103. border_color*: ColorRef
  104. shadow_color*: ColorRef
  105. background_color*: ColorRef
  106. texture*: GlTextureObj"><wbr />Drawable<wbr />Obj<span class="attachedType"></span></a></li>
  107. <li><a class="reference" href="#DrawableRef"
  108. title="DrawableRef = ref DrawableObj"><wbr />Drawable<wbr />Ref<span class="attachedType"></span></a></li>
  109. </ul>
  110. </li>
  111. <li>
  112. <a class="reference reference-toplevel" href="#12" id="62">Procs</a>
  113. <ul class="simple simple-toc-section">
  114. <li><a class="reference" href="#Drawable"
  115. title="Drawable(): DrawableRef"><wbr />Drawable<span class="attachedType">DrawableRef</span></a></li>
  116. </ul>
  117. </li>
  118. <li>
  119. <a class="reference reference-toplevel" href="#14" id="64">Methods</a>
  120. <ul class="simple simple-toc-section">
  121. <li><a class="reference" href="#enableShadow.e%2CDrawableRef%2Cbool"
  122. title="enableShadow(self: DrawableRef; val: bool = true)"><wbr />enable<wbr />Shadow<span class="attachedType">DrawableRef</span></a></li>
  123. <li><a class="reference" href="#draw.e%2CDrawableRef%2Cfloat%2Cfloat%2Cfloat%2Cfloat"
  124. title="draw(self: DrawableRef; x1, y1, width, height: float)"><wbr />draw<span class="attachedType">DrawableRef</span></a></li>
  125. <li><a class="reference" href="#getColor.e%2CDrawableRef"
  126. title="getColor(self: DrawableRef): ColorRef"><wbr />get<wbr />Color<span class="attachedType">DrawableRef</span></a></li>
  127. <li><a class="reference" href="#loadTexture.e%2CDrawableRef%2Cstring"
  128. title="loadTexture(self: DrawableRef; path: string)"><wbr />load<wbr />Texture<span class="attachedType">DrawableRef</span></a></li>
  129. <li><a class="reference" href="#setBorderColor.e%2CDrawableRef%2CColorRef"
  130. title="setBorderColor(self: DrawableRef; color: ColorRef)"><wbr />set<wbr />Border<wbr />Color<span class="attachedType">DrawableRef</span></a></li>
  131. <li><a class="reference" href="#setBorderWidth.e%2CDrawableRef%2Cfloat"
  132. title="setBorderWidth(self: DrawableRef; width: float)"><wbr />set<wbr />Border<wbr />Width<span class="attachedType">DrawableRef</span></a></li>
  133. <li><a class="reference" href="#setColor.e%2CDrawableRef%2CColorRef"
  134. title="setColor(self: DrawableRef; color: ColorRef)"><wbr />set<wbr />Color<span class="attachedType">DrawableRef</span></a></li>
  135. <li><a class="reference" href="#setCornerRadius.e%2CDrawableRef%2Cfloat"
  136. title="setCornerRadius(self: DrawableRef; radius: float)"><wbr />set<wbr />Corner<wbr />Radius<span class="attachedType">DrawableRef</span></a></li>
  137. <li><a class="reference" href="#setCornerRadius.e%2CDrawableRef%2Cfloat%2Cfloat%2Cfloat%2Cfloat"
  138. title="setCornerRadius(self: DrawableRef; r1, r2, r3, r4: float)"><wbr />set<wbr />Corner<wbr />Radius<span class="attachedType">DrawableRef</span></a></li>
  139. <li><a class="reference" href="#setCornerDetail.e%2CDrawableRef%2Cint"
  140. title="setCornerDetail(self: DrawableRef; detail: int)"><wbr />set<wbr />Corner<wbr />Detail<span class="attachedType">DrawableRef</span></a></li>
  141. <li><a class="reference" href="#setCornerDetail.e%2CDrawableRef%2Cint%2Cint%2Cint%2Cint"
  142. title="setCornerDetail(self: DrawableRef; d1, d2, d3, d4: int)"><wbr />set<wbr />Corner<wbr />Detail<span class="attachedType">DrawableRef</span></a></li>
  143. <li><a class="reference" href="#setTexture.e%2CDrawableRef%2CGlTextureObj"
  144. title="setTexture(self: DrawableRef; texture: GlTextureObj)"><wbr />set<wbr />Texture<span class="attachedType">DrawableRef</span></a></li>
  145. <li><a class="reference" href="#setShadowColor.e%2CDrawableRef%2CColorRef"
  146. title="setShadowColor(self: DrawableRef; clr: ColorRef)"><wbr />set<wbr />Shadow<wbr />Color<span class="attachedType">DrawableRef</span></a></li>
  147. <li><a class="reference" href="#setShadowOffset.e%2CDrawableRef%2CVector2Obj"
  148. title="setShadowOffset(self: DrawableRef; offset: Vector2Obj)"><wbr />set<wbr />Shadow<wbr />Offset<span class="attachedType">DrawableRef</span></a></li>
  149. <li><a class="reference" href="#setStyle.e%2CDrawableRef%2CStyleSheetRef"
  150. title="setStyle(self: DrawableRef; s: StyleSheetRef)"><wbr />set<wbr />Style<span class="attachedType">DrawableRef</span></a></li>
  151. </ul>
  152. </li>
  153. <li>
  154. <a class="reference reference-toplevel" href="#18" id="68">Templates</a>
  155. <ul class="simple simple-toc-section">
  156. <li><a class="reference" href="#drawablepattern.t%2Cuntyped"
  157. title="drawablepattern(`type`: untyped): untyped"><wbr />drawablepattern<span class="attachedType"></span></a></li>
  158. <li><a class="reference" href="#vd.t"
  159. title="vd()"><wbr />vd<span class="attachedType"></span></a></li>
  160. <li><a class="reference" href="#recalc.t%2Cbool"
  161. title="recalc(shadow: bool = false)"><wbr />recalc<span class="attachedType"></span></a></li>
  162. <li><a class="reference" href="#draw_template.t%2Cuntyped%2Cuntyped%2Cuntyped%2Cuntyped"
  163. title="draw_template(drawtype, color, function, secondfunc: untyped): untyped"><wbr />draw_<wbr />template<span class="attachedType"></span></a></li>
  164. <li><a class="reference" href="#draw_texture_template.t%2Cuntyped%2Cuntyped%2Cuntyped%2Cuntyped"
  165. title="draw_texture_template(drawtype, color, function, secondfunc: untyped): untyped"><wbr />draw_<wbr />texture_<wbr />template<span class="attachedType"></span></a></li>
  166. </ul>
  167. </li>
  168. </ul>
  169. </div>
  170. <div class="nine columns" id="content">
  171. <div id="tocRoot"></div>
  172. <p class="module-desc"></p>
  173. <div class="section" id="6">
  174. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  175. <dl class="item">
  176. <a class="reference external" href="../thirdparty/opengl.html">../thirdparty/opengl</a>, <a class="reference external" href="../core/color.html">../core/color</a>, <a class="reference external" href="../core/stylesheet.html">../core/stylesheet</a>, <a class="reference external" href="../core/image.html">../core/image</a>, <a class="reference external" href="../core/vector2.html">../core/vector2</a>, <a class="reference external" href="../core/tools.html">../core/tools</a>
  177. </dl></div>
  178. <div class="section" id="7">
  179. <h1><a class="toc-backref" href="#7">Types</a></h1>
  180. <dl class="item">
  181. <a id="DrawableObj"></a>
  182. <dt><pre><a href="drawable.html#DrawableObj"><span class="Identifier">DrawableObj</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
  183. <span class="Identifier">shadow</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
  184. <span class="Identifier">border_width</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">float</span>
  185. <span class="Identifier">border_detail</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">4</span><span class="Other">,</span> <span class="Identifier">int</span><span class="Other">]</span> <span class="Comment">## left-top, right-top, right-bottom, left-bottom</span>
  186. <span class="Identifier">border_radius</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">4</span><span class="Other">,</span> <span class="Identifier">float</span><span class="Other">]</span> <span class="Comment">## left-top, right-top, right-bottom, left-bottom</span>
  187. <span class="Identifier">shadow_offset</span><span class="Operator">*</span><span class="Other">:</span> <a href="../core/vector2.html#Vector2Obj"><span class="Identifier">Vector2Obj</span></a>
  188. <span class="Identifier">border_color</span><span class="Operator">*</span><span class="Other">:</span> <a href="../core/color.html#ColorRef"><span class="Identifier">ColorRef</span></a>
  189. <span class="Identifier">shadow_color</span><span class="Operator">*</span><span class="Other">:</span> <a href="../core/color.html#ColorRef"><span class="Identifier">ColorRef</span></a>
  190. <span class="Identifier">background_color</span><span class="Operator">*</span><span class="Other">:</span> <a href="../core/color.html#ColorRef"><span class="Identifier">ColorRef</span></a>
  191. <span class="Identifier">texture</span><span class="Operator">*</span><span class="Other">:</span> <a href="../core/image.html#GlTextureObj"><span class="Identifier">GlTextureObj</span></a>
  192. </pre></dt>
  193. <dd>
  194. </dd>
  195. <a id="DrawableRef"></a>
  196. <dt><pre><a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <a href="drawable.html#DrawableObj"><span class="Identifier">DrawableObj</span></a></pre></dt>
  197. <dd>
  198. </dd>
  199. </dl></div>
  200. <div class="section" id="12">
  201. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  202. <dl class="item">
  203. <a id="Drawable"></a>
  204. <dt><pre><span class="Keyword">proc</span> <a href="#Drawable"><span class="Identifier">Drawable</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  205. <dd>
  206. </dd>
  207. </dl></div>
  208. <div class="section" id="14">
  209. <h1><a class="toc-backref" href="#14">Methods</a></h1>
  210. <dl class="item">
  211. <a id="enableShadow.e,DrawableRef,bool"></a>
  212. <dt><pre><span class="Keyword">method</span> <a href="#enableShadow.e%2CDrawableRef%2Cbool"><span class="Identifier">enableShadow</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  213. <dd>
  214. Enables shadow, when <tt class="docutils literal"><span class="pre">val</span></tt> is true.
  215. </dd>
  216. <a id="draw.e,DrawableRef,float,float,float,float"></a>
  217. <dt><pre><span class="Keyword">method</span> <a href="#draw.e%2CDrawableRef%2Cfloat%2Cfloat%2Cfloat%2Cfloat"><span class="Identifier">draw</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">x1</span><span class="Other">,</span> <span class="Identifier">y1</span><span class="Other">,</span> <span class="Identifier">width</span><span class="Other">,</span> <span class="Identifier">height</span><span class="Other">:</span> <span class="Identifier">float</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">GLerror</span><span class="Other">]</span><span class="Other">,</span>
  218. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  219. <dd>
  220. </dd>
  221. <a id="getColor.e,DrawableRef"></a>
  222. <dt><pre><span class="Keyword">method</span> <a href="#getColor.e%2CDrawableRef"><span class="Identifier">getColor</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../core/color.html#ColorRef"><span class="Identifier">ColorRef</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  223. <dd>
  224. Returns background color.
  225. </dd>
  226. <a id="loadTexture.e,DrawableRef,string"></a>
  227. <dt><pre><span class="Keyword">method</span> <a href="#loadTexture.e%2CDrawableRef%2Cstring"><span class="Identifier">loadTexture</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">path</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span>
  228. <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ResourceError</span><span class="Other">,</span> <span class="Identifier">GLerror</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  229. <dd>
  230. <p>Loads texture from the file.</p>
  231. <p>Arguments:</p>
  232. <ul class="simple"><li><tt class="docutils literal"><span class="pre">path</span></tt> is an image path.</li>
  233. </ul>
  234. </dd>
  235. <a id="setBorderColor.e,DrawableRef,ColorRef"></a>
  236. <dt><pre><span class="Keyword">method</span> <a href="#setBorderColor.e%2CDrawableRef%2CColorRef"><span class="Identifier">setBorderColor</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">color</span><span class="Other">:</span> <a href="../core/color.html#ColorRef"><span class="Identifier">ColorRef</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  237. <dd>
  238. Changes border color.
  239. </dd>
  240. <a id="setBorderWidth.e,DrawableRef,float"></a>
  241. <dt><pre><span class="Keyword">method</span> <a href="#setBorderWidth.e%2CDrawableRef%2Cfloat"><span class="Identifier">setBorderWidth</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">width</span><span class="Other">:</span> <span class="Identifier">float</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  242. <dd>
  243. Changes border width.
  244. </dd>
  245. <a id="setColor.e,DrawableRef,ColorRef"></a>
  246. <dt><pre><span class="Keyword">method</span> <a href="#setColor.e%2CDrawableRef%2CColorRef"><span class="Identifier">setColor</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">color</span><span class="Other">:</span> <a href="../core/color.html#ColorRef"><span class="Identifier">ColorRef</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  247. <dd>
  248. Changes background color.
  249. </dd>
  250. <a id="setCornerRadius.e,DrawableRef,float"></a>
  251. <dt><pre><span class="Keyword">method</span> <a href="#setCornerRadius.e%2CDrawableRef%2Cfloat"><span class="Identifier">setCornerRadius</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">radius</span><span class="Other">:</span> <span class="Identifier">float</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  252. <dd>
  253. <p>Changes corners radius.</p>
  254. <p>Arguments:</p>
  255. <ul class="simple"><li><tt class="docutils literal"><span class="pre">radius</span></tt> is a new corner radius.</li>
  256. </ul>
  257. </dd>
  258. <a id="setCornerRadius.e,DrawableRef,float,float,float,float"></a>
  259. <dt><pre><span class="Keyword">method</span> <a href="#setCornerRadius.e%2CDrawableRef%2Cfloat%2Cfloat%2Cfloat%2Cfloat"><span class="Identifier">setCornerRadius</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">r1</span><span class="Other">,</span> <span class="Identifier">r2</span><span class="Other">,</span> <span class="Identifier">r3</span><span class="Other">,</span> <span class="Identifier">r4</span><span class="Other">:</span> <span class="Identifier">float</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  260. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  261. <dd>
  262. <p>Changes corners radius.</p>
  263. <p>Arguments:</p>
  264. <ul class="simple"><li><tt class="docutils literal"><span class="pre">r1</span></tt> is a new left-top radius.</li>
  265. <li><tt class="docutils literal"><span class="pre">r2</span></tt> is a new right-top radius.</li>
  266. <li><tt class="docutils literal"><span class="pre">r3</span></tt> is a new right-bottm radius.</li>
  267. <li><tt class="docutils literal"><span class="pre">r4</span></tt> is a new left-bottm radius.</li>
  268. </ul>
  269. </dd>
  270. <a id="setCornerDetail.e,DrawableRef,int"></a>
  271. <dt><pre><span class="Keyword">method</span> <a href="#setCornerDetail.e%2CDrawableRef%2Cint"><span class="Identifier">setCornerDetail</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">detail</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  272. <dd>
  273. <p>Changes corners details.</p>
  274. <p>Arguments:</p>
  275. <ul class="simple"><li><tt class="docutils literal"><span class="pre">detail</span></tt> is a new corner detail.</li>
  276. </ul>
  277. </dd>
  278. <a id="setCornerDetail.e,DrawableRef,int,int,int,int"></a>
  279. <dt><pre><span class="Keyword">method</span> <a href="#setCornerDetail.e%2CDrawableRef%2Cint%2Cint%2Cint%2Cint"><span class="Identifier">setCornerDetail</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">d1</span><span class="Other">,</span> <span class="Identifier">d2</span><span class="Other">,</span> <span class="Identifier">d3</span><span class="Other">,</span> <span class="Identifier">d4</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  280. <dd>
  281. <p>Changes corners details.</p>
  282. <p>Arguments:</p>
  283. <ul class="simple"><li><tt class="docutils literal"><span class="pre">d1</span></tt> is a new left-top detail.</li>
  284. <li><tt class="docutils literal"><span class="pre">d2</span></tt> is a new right-top detail.</li>
  285. <li><tt class="docutils literal"><span class="pre">d3</span></tt> is a new right-bottm detail.</li>
  286. <li><tt class="docutils literal"><span class="pre">d4</span></tt> is a new left-bottm detail.</li>
  287. </ul>
  288. </dd>
  289. <a id="setTexture.e,DrawableRef,GlTextureObj"></a>
  290. <dt><pre><span class="Keyword">method</span> <a href="#setTexture.e%2CDrawableRef%2CGlTextureObj"><span class="Identifier">setTexture</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">texture</span><span class="Other">:</span> <a href="../core/image.html#GlTextureObj"><span class="Identifier">GlTextureObj</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  291. <dd>
  292. Changes drawable texture.
  293. </dd>
  294. <a id="setShadowColor.e,DrawableRef,ColorRef"></a>
  295. <dt><pre><span class="Keyword">method</span> <a href="#setShadowColor.e%2CDrawableRef%2CColorRef"><span class="Identifier">setShadowColor</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">clr</span><span class="Other">:</span> <a href="../core/color.html#ColorRef"><span class="Identifier">ColorRef</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  296. <dd>
  297. </dd>
  298. <a id="setShadowOffset.e,DrawableRef,Vector2Obj"></a>
  299. <dt><pre><span class="Keyword">method</span> <a href="#setShadowOffset.e%2CDrawableRef%2CVector2Obj"><span class="Identifier">setShadowOffset</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">offset</span><span class="Other">:</span> <a href="../core/vector2.html#Vector2Obj"><span class="Identifier">Vector2Obj</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  300. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  301. <dd>
  302. Changes shadow offset.
  303. </dd>
  304. <a id="setStyle.e,DrawableRef,StyleSheetRef"></a>
  305. <dt><pre><span class="Keyword">method</span> <a href="#setStyle.e%2CDrawableRef%2CStyleSheetRef"><span class="Identifier">setStyle</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="drawable.html#DrawableRef"><span class="Identifier">DrawableRef</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="../core/stylesheet.html#StyleSheetRef"><span class="Identifier">StyleSheetRef</span></a><span class="Other">)</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">base</span><span class="Other">,</span>
  306. <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">RegexError</span><span class="Other">,</span> <span class="Identifier">ResourceError</span><span class="Other">,</span> <span class="Identifier">GLerror</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span><span class="Other">.}</span></span></pre></dt>
  307. <dd>
  308. <p>Sets new stylesheet.</p>
  309. <p>Styles:</p>
  310. <ul class="simple"><li><tt class="docutils literal"><span class="pre">background-color</span></tt> - <tt class="docutils literal"><span class="pre">rgb(1, 1, 1)</span></tt>; <tt class="docutils literal"><span class="pre">rgba(1, 1, 1, 1)</span></tt>; <tt class="docutils literal"><span class="pre">#ffef</span></tt>.</li>
  311. <li><tt class="docutils literal"><span class="pre">background-image</span></tt> - <tt class="docutils literal"><span class="pre">&quot;assets/image.jpg&quot;. - `background</span></tt> - the same as <tt class="docutils literal"><span class="pre">background-image</span></tt> and <tt class="docutils literal"><span class="pre">background-color</span></tt>.</li>
  312. <li><tt class="docutils literal"><span class="pre">border-color</span></tt> - the same as <tt class="docutils literal"><span class="pre">background-color</span></tt>.</li>
  313. <li><tt class="docutils literal"><span class="pre">border-width</span></tt> - <tt class="docutils literal"><span class="pre">0</span></tt>; <tt class="docutils literal"><span class="pre">8</span></tt>.</li>
  314. <li><tt class="docutils literal"><span class="pre">border-detail</span></tt> - corners details. <tt class="docutils literal"><span class="pre">8</span></tt>; <tt class="docutils literal"><span class="pre">8 8 8 8</span></tt>.</li>
  315. <li><tt class="docutils literal"><span class="pre">border-radius</span></tt> - corners radius. same as <tt class="docutils literal"><span class="pre">border-detail</span></tt>.</li>
  316. <li><tt class="docutils literal"><span class="pre">border</span></tt> - corners radius and border color. <tt class="docutils literal"><span class="pre">8 #ffef</span></tt>.</li>
  317. <li><tt class="docutils literal"><span class="pre">shadow</span></tt> - enables shadow. <tt class="docutils literal"><span class="pre">true</span></tt>; <tt class="docutils literal"><span class="pre">yes</span></tt>; <tt class="docutils literal"><span class="pre">on</span></tt>; <tt class="docutils literal"><span class="pre">off</span></tt>; <tt class="docutils literal"><span class="pre">no</span></tt>; <tt class="docutils literal"><span class="pre">false</span></tt>.</li>
  318. <li><tt class="docutils literal"><span class="pre">shadow-offset</span></tt> - XY shadow offset. <tt class="docutils literal"><span class="pre">3</span></tt>; <tt class="docutils literal"><span class="pre">5 10</span></tt>.</li>
  319. </ul>
  320. </dd>
  321. </dl></div>
  322. <div class="section" id="18">
  323. <h1><a class="toc-backref" href="#18">Templates</a></h1>
  324. <dl class="item">
  325. <a id="drawablepattern.t,untyped"></a>
  326. <dt><pre><span class="Keyword">template</span> <a href="#drawablepattern.t%2Cuntyped"><span class="Identifier">drawablepattern</span></a><span class="Other">(</span><span class="Other">`</span><span class="Keyword">type</span><span class="Other">`</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
  327. <dd>
  328. </dd>
  329. <a id="vd.t"></a>
  330. <dt><pre><span class="Keyword">template</span> <a href="#vd.t"><span class="Identifier">vd</span></a><span class="Other">(</span><span class="Other">)</span></pre></dt>
  331. <dd>
  332. void template
  333. </dd>
  334. <a id="recalc.t,bool"></a>
  335. <dt><pre><span class="Keyword">template</span> <a href="#recalc.t%2Cbool"><span class="Identifier">recalc</span></a><span class="Other">(</span><span class="Identifier">shadow</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span></pre></dt>
  336. <dd>
  337. Calculates vertex positions.
  338. </dd>
  339. <a id="draw_template.t,untyped,untyped,untyped,untyped"></a>
  340. <dt><pre><span class="Keyword">template</span> <a href="#draw_template.t%2Cuntyped%2Cuntyped%2Cuntyped%2Cuntyped"><span class="Identifier">draw_template</span></a><span class="Other">(</span><span class="Identifier">drawtype</span><span class="Other">,</span> <span class="Identifier">color</span><span class="Other">,</span> <span class="Identifier">function</span><span class="Other">,</span> <span class="Identifier">secondfunc</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
  341. <dd>
  342. <p>Draws colorized vertexes</p>
  343. <p>Arguments:</p>
  344. <ul class="simple"><li><tt class="docutils literal"><span class="pre">drawtype</span></tt> - draw type, like <tt class="docutils literal"><span class="pre">GL_POLYGON</span></tt></li>
  345. <li><tt class="docutils literal"><span class="pre">color</span></tt> - color for border drawing.</li>
  346. <li><tt class="docutils literal"><span class="pre">function</span></tt> - function called before <tt class="docutils literal"><span class="pre">glBegin</span></tt></li>
  347. <li><tt class="docutils literal"><span class="pre">secondfunc</span></tt> - function called after <tt class="docutils literal"><span class="pre">glEnd</span></tt></li>
  348. </ul>
  349. </dd>
  350. <a id="draw_texture_template.t,untyped,untyped,untyped,untyped"></a>
  351. <dt><pre><span class="Keyword">template</span> <a href="#draw_texture_template.t%2Cuntyped%2Cuntyped%2Cuntyped%2Cuntyped"><span class="Identifier">draw_texture_template</span></a><span class="Other">(</span><span class="Identifier">drawtype</span><span class="Other">,</span> <span class="Identifier">color</span><span class="Other">,</span> <span class="Identifier">function</span><span class="Other">,</span> <span class="Identifier">secondfunc</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
  352. <dd>
  353. </dd>
  354. </dl></div>
  355. </div>
  356. </div>
  357. <div class="row">
  358. <div class="twelve-columns footer">
  359. <span class="nim-sprite"></span>
  360. <br/>
  361. <small style="color: var(--hint);">Made with Nim. Generated: 2021-11-03 16:19:12 UTC</small>
  362. </div>
  363. </div>
  364. </div>
  365. </div>
  366. </body>
  367. </html>