babylon.gui.d.ts 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /// <reference path="../../dist/preview release/babylon.d.ts" />
  2. declare module BABYLON.GUI {
  3. class AdvancedDynamicTexture extends DynamicTexture {
  4. private _isDirty;
  5. private _renderObserver;
  6. private _resizeObserver;
  7. private _background;
  8. private _rootContainer;
  9. background: string;
  10. constructor(name: string, size: number, scene: Scene);
  11. markAsDirty(): void;
  12. addControl(control: Control): AdvancedDynamicTexture;
  13. removeControl(control: Control): AdvancedDynamicTexture;
  14. dispose(): void;
  15. private _onResize();
  16. private _checkUpdate();
  17. private _render();
  18. }
  19. }
  20. /// <reference path="../../dist/preview release/babylon.d.ts" />
  21. declare module BABYLON.GUI {
  22. class Measure {
  23. left: number;
  24. top: number;
  25. width: number;
  26. height: number;
  27. constructor(left: number, top: number, width: number, height: number);
  28. copyFrom(other: Measure): void;
  29. isEqualsTo(other: Measure): boolean;
  30. static Empty(): Measure;
  31. }
  32. }
  33. /// <reference path="../../dist/preview release/babylon.d.ts" />
  34. declare module BABYLON.GUI {
  35. class ValueAndUnit {
  36. value: number;
  37. unit: number;
  38. negativeValueAllowed: boolean;
  39. constructor(value?: number, unit?: number, negativeValueAllowed?: boolean);
  40. readonly isPercentage: boolean;
  41. readonly isPixel: boolean;
  42. toString(): string;
  43. fromString(source: string): boolean;
  44. private static _Regex;
  45. private static _UNITMODE_PERCENTAGE;
  46. private static _UNITMODE_PIXEL;
  47. static readonly UNITMODE_PERCENTAGE: number;
  48. static readonly UNITMODE_PIXEL: number;
  49. }
  50. }
  51. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  52. declare module BABYLON.GUI {
  53. class Control {
  54. name: string;
  55. private _zIndex;
  56. _root: Container;
  57. _host: AdvancedDynamicTexture;
  58. _currentMeasure: Measure;
  59. private _fontFamily;
  60. private _fontSize;
  61. private _font;
  62. private _width;
  63. private _height;
  64. private _lastMeasuredFont;
  65. protected _fontOffset: {
  66. ascent: number;
  67. height: number;
  68. descent: number;
  69. };
  70. private _color;
  71. private _horizontalAlignment;
  72. private _verticalAlignment;
  73. private _isDirty;
  74. private _cachedParentMeasure;
  75. private _marginLeft;
  76. private _marginRight;
  77. private _marginTop;
  78. private _marginBottom;
  79. horizontalAlignment: number;
  80. verticalAlignment: number;
  81. width: string;
  82. height: string;
  83. fontFamily: string;
  84. fontSize: number;
  85. color: string;
  86. zIndex: number;
  87. readonly isDirty: boolean;
  88. marginLeft: string;
  89. marginRight: string;
  90. marginTop: string;
  91. marginBottom: string;
  92. constructor(name: string);
  93. protected _markAsDirty(): void;
  94. _link(root: Container, host: AdvancedDynamicTexture): void;
  95. protected applyStates(context: CanvasRenderingContext2D): void;
  96. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  97. protected _measure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  98. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  99. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  100. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  101. private _prepareFont();
  102. private static _HORIZONTAL_ALIGNMENT_LEFT;
  103. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  104. private static _HORIZONTAL_ALIGNMENT_CENTER;
  105. private static _VERTICAL_ALIGNMENT_TOP;
  106. private static _VERTICAL_ALIGNMENT_BOTTOM;
  107. private static _VERTICAL_ALIGNMENT_CENTER;
  108. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  109. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  110. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  111. static readonly VERTICAL_ALIGNMENT_TOP: number;
  112. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  113. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  114. private static _FontHeightSizes;
  115. static _GetFontOffset(font: string): {
  116. ascent: number;
  117. height: number;
  118. descent: number;
  119. };
  120. }
  121. }
  122. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  123. declare module BABYLON.GUI {
  124. class ContentControl extends Control {
  125. name: string;
  126. private _child;
  127. protected _measureForChild: Measure;
  128. child: Control;
  129. constructor(name: string);
  130. protected _localDraw(context: CanvasRenderingContext2D): void;
  131. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  132. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  133. }
  134. }
  135. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  136. declare module BABYLON.GUI {
  137. class Container extends Control {
  138. name: string;
  139. private _children;
  140. constructor(name: string);
  141. addControl(control: Control): Container;
  142. removeControl(control: Control): Container;
  143. _reOrderControl(control: Control): void;
  144. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  145. }
  146. }
  147. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  148. declare module BABYLON.GUI {
  149. class Rectangle extends ContentControl {
  150. name: string;
  151. private _thickness;
  152. private _background;
  153. thickness: number;
  154. background: string;
  155. constructor(name: string);
  156. protected _localDraw(context: CanvasRenderingContext2D): void;
  157. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  158. }
  159. }
  160. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  161. declare module BABYLON.GUI {
  162. class TextBlock extends Control {
  163. name: string;
  164. private _text;
  165. private _textY;
  166. private _textWrapping;
  167. private _textHorizontalAlignment;
  168. private _textVerticalAlignment;
  169. private _lines;
  170. private _totalHeight;
  171. textWrapping: boolean;
  172. text: string;
  173. textHorizontalAlignment: number;
  174. textVerticalAlignment: number;
  175. constructor(name: string, text: string);
  176. protected _measure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  177. private _drawText(text, textWidth, y, context);
  178. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  179. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  180. protected _renderLines(context: CanvasRenderingContext2D): void;
  181. }
  182. }