@ts-defold/types 1.2.4 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +66 -48
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Defold Types
2
- <a href="https://discord.gg/eukcq5m"><img alt="Chat with us!" src="https://img.shields.io/discord/766898804896038942.svg?colorB=7581dc&logo=discord&logoColor=white"></a>
3
2
  <a href="https://www.npmjs.com/package/@ts-defold/type-gen"><img alt="npm install" src="https://img.shields.io/npm/dt/@ts-defold/types?color=%23CA0000&label=npm&logo=npm"></a>
3
+ <a href="https://discord.gg/eukcq5m"><img alt="Chat with us!" src="https://img.shields.io/discord/766898804896038942.svg?colorB=7581dc&logo=discord&logoColor=white"></a>
4
4
  > TypeScript definitions for [Defold](https://defold.com/)
5
5
 
6
6
  ## Installation
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="lua-types/5.1" />
3
3
  /// <reference types="typescript-to-lua/language-extensions" />
4
4
 
5
- // DEFOLD. stable version 1.2.188 (6bfeea3b13d7b8920483ea2cba9c181a8650b84d)
5
+ // DEFOLD. stable version 1.2.190 (d31d6397a72178541a5ef6e7ef2bed090d828f58)
6
6
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
7
7
 
8
8
 
@@ -742,9 +742,12 @@ The id of the animated property.
742
742
  * gets a named property of the specified game object or component
743
743
  * @param url url of the game object or component having the property
744
744
  * @param property id of the property to retrieve
745
+ * @param options (optional) options table
746
+ index into array property (1 based)
747
+ name of internal property
745
748
  * @return value the value of the specified property
746
749
  */
747
- export function get(url: string | hash | url, property: string | hash): any
750
+ export function get(url: string | hash | url, property: string | hash, options?: any): any
748
751
 
749
752
  /**
750
753
  * Returns or constructs an instance identifier. The instance id is a hash
@@ -848,8 +851,11 @@ The id of the animated property.
848
851
  * @param url url of the game object or component having the property
849
852
  * @param property id of the property to set
850
853
  * @param value the value to set
854
+ * @param options (optional) options table
855
+ index into array property (1 based)
856
+ name of internal property
851
857
  */
852
- export function set(url: string | hash | url, property: string | hash, value: any): void
858
+ export function set(url: string | hash | url, property: string | hash, value: any, options?: any): void
853
859
 
854
860
  /**
855
861
  * Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
@@ -930,6 +936,12 @@ The id of the animated property.
930
936
  declare namespace gui {
931
937
 
932
938
 
939
+ /**
940
+ * The fonts used in the gui. The type of the property is hash.
941
+ * Key must be specified in options table.
942
+ */
943
+ export let fonts: any
944
+
933
945
  /**
934
946
  * fit adjust mode
935
947
  */
@@ -1523,6 +1535,12 @@ with a custom curve. See the animation guide for more information.
1523
1535
  */
1524
1536
  export function get_adjust_mode(node: node): any
1525
1537
 
1538
+ /**
1539
+ * gets the node alpha
1540
+ * @param node node from which to get alpha
1541
+ */
1542
+ export function get_alpha(node: node): void
1543
+
1526
1544
  /**
1527
1545
  * Returns the blend mode of a node.
1528
1546
  * Blend mode defines how the node will be blended with the background.
@@ -1631,6 +1649,13 @@ with a custom curve. See the animation guide for more information.
1631
1649
  */
1632
1650
  export function get_font(node: node): hash
1633
1651
 
1652
+ /**
1653
+ * This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
1654
+ * @param font_name font of which to get the path hash
1655
+ * @return hash path hash to resource
1656
+ */
1657
+ export function get_font_resource(font_name: hash | string): hash
1658
+
1634
1659
  /**
1635
1660
  * Returns the scene height.
1636
1661
  * @return height scene height
@@ -1884,37 +1909,6 @@ with a custom curve. See the animation guide for more information.
1884
1909
  */
1885
1910
  export function get_text(node: node): string
1886
1911
 
1887
- /**
1888
- * Get text metrics given the provided font, text and parameters.
1889
- * @param font font id
1890
- * @param text text to measure
1891
- * @param width max-width. Use for line-breaks (default=FLT_MAX)
1892
- * @param line_break true to break lines accordingly to width (default=false)
1893
- * @param leading scale value for line spacing (default=1)
1894
- * @param tracking scale value for letter spacing (default=0)
1895
- * @return metrics a table with the following fields:
1896
-
1897
- - width
1898
- - height
1899
- - max_ascent
1900
- - max_descent
1901
-
1902
- */
1903
- export function get_text_metrics(font: string | hash, text: string, width: number, line_break: boolean, leading: number, tracking: number): any
1904
-
1905
- /**
1906
- * Get the text metrics from a text node.
1907
- * @param node text node to measure text from
1908
- * @return metrics a table with the following fields:
1909
-
1910
- - width
1911
- - height
1912
- - max_ascent
1913
- - max_descent
1914
-
1915
- */
1916
- export function get_text_metrics_from_node(node: node): any
1917
-
1918
1912
  /**
1919
1913
  * Returns the texture of a node.
1920
1914
  * This is currently only useful for box or pie nodes.
@@ -2163,6 +2157,13 @@ The rate with which the animation will be played. Must be positive
2163
2157
  */
2164
2158
  export function set_adjust_mode(node: node, adjust_mode: any): void
2165
2159
 
2160
+ /**
2161
+ * sets the node alpha
2162
+ * @param node node for which to set alpha
2163
+ * @param alpha 0..1 alpha color
2164
+ */
2165
+ export function set_alpha(node: node, alpha: number): void
2166
+
2166
2167
  /**
2167
2168
  * Set the blend mode of a node.
2168
2169
  * Blend mode defines how the node will be blended with the background.
@@ -2348,7 +2349,7 @@ The rate with which the animation will be played. Must be positive
2348
2349
  * @param parent parent node to set
2349
2350
  * @param keep_scene_transform optional flag to make the scene position being perserved
2350
2351
  */
2351
- export function set_parent(node: node, parent: node, keep_scene_transform: boolean): void
2352
+ export function set_parent(node: node, parent: node, keep_scene_transform?: boolean): void
2352
2353
 
2353
2354
  /**
2354
2355
  * Set the paricle fx for a gui node
@@ -2587,6 +2588,12 @@ The rate with which the animation will be played. Must be positive
2587
2588
 
2588
2589
 
2589
2590
 
2591
+ /**
2592
+ * The textures used in the gui. The type of the property is hash.
2593
+ * Key must be specified in options table.
2594
+ */
2595
+ export let textures: any
2596
+
2590
2597
 
2591
2598
  }
2592
2599
  // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
@@ -3946,6 +3953,30 @@ declare namespace resource {
3946
3953
  */
3947
3954
  export function get_current_manifest(): number
3948
3955
 
3956
+ /**
3957
+ * Gets the text metrics from a font
3958
+ * @param url the font to get the (unscaled) metrics from
3959
+ * @param options A table containing parameters for the text. Supported entries:
3960
+
3961
+ `width`
3962
+ The width of the text field. Not used if `line_break` is false.
3963
+ `leading`
3964
+ The leading (default 1.0)
3965
+ `tracking`
3966
+ The leading (default 0.0)
3967
+ `line_break`
3968
+ If the calculation should consider line breaks (default false)
3969
+
3970
+ * @return metrics a table with the following fields:
3971
+
3972
+ - width
3973
+ - height
3974
+ - max_ascent
3975
+ - max_descent
3976
+
3977
+ */
3978
+ export function get_text_metrics(url: hash, options: any): any
3979
+
3949
3980
  /**
3950
3981
  * Is any liveupdate data mounted and currently in use?
3951
3982
  * This can be used to determine if a new manifest or zip file should be downloaded.
@@ -5674,19 +5705,6 @@ declare namespace label {
5674
5705
  */
5675
5706
  export function get_text(url: string | hash | url): string
5676
5707
 
5677
- /**
5678
- * Gets the text metrics from a label component
5679
- * @param url the label to get the (unscaled) metrics from
5680
- * @return metrics a table with the following fields:
5681
-
5682
- - width
5683
- - height
5684
- - max_ascent
5685
- - max_descent
5686
-
5687
- */
5688
- export function get_text_metrics(url: string | hash | url): any
5689
-
5690
5708
  /**
5691
5709
  * Sets the text of a label component
5692
5710
  * ⚠ This method uses the message passing that means the value will be set after `dispatch messages` step.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-defold/types",
3
- "version": "1.2.4",
3
+ "version": "1.2.8",
4
4
  "description": "TypeScript definitions for Defold",
5
5
  "repository": "github:ts-defold/types",
6
6
  "keywords": [
@@ -27,7 +27,7 @@
27
27
  "lua-types": "^2.10.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@ts-defold/type-gen": "^0.5.0",
30
+ "@ts-defold/type-gen": "^0.5.2",
31
31
  "typescript": "4.3.4",
32
32
  "typescript-to-lua": "^1.0.1"
33
33
  },