浏览代码

Update documentation for TileSet and Timer

Rémi Verschelde 10 年之前
父节点
当前提交
4abc7f5740
共有 2 个文件被更改,包括 43 次插入14 次删除
  1. 39 13
      doc/base/classes.xml
  2. 4 1
      scene/main/timer.cpp

+ 39 - 13
doc/base/classes.xml

@@ -34841,13 +34841,14 @@
 	</brief_description>
 	<description>
 	A TileSet is a library of tiles for a [TileMap]. It contains a list of tiles, each consisting of a sprite and optional collision shapes.
+	Tiles are referenced by a unique integer ID.
 	</description>
 	<methods>
 		<method name="create_tile">
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
-			Create a new tile, the ID must be specified.
+			Create a new tile which will be referenced by the given ID.
 			</description>
 		</method>
 		<method name="tile_set_name">
@@ -34856,7 +34857,7 @@
 			<argument index="1" name="name" type="String">
 			</argument>
 			<description>
-			Set the name of a tile, for decriptive purposes.
+			Set the name of the tile, for descriptive purposes.
 			</description>
 		</method>
 		<method name="tile_get_name" qualifiers="const">
@@ -34865,7 +34866,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
-			Return the name of a tile, for decriptive purposes.
+			Return the name of the tile.
 			</description>
 		</method>
 		<method name="tile_set_texture">
@@ -34892,6 +34893,7 @@
 			<argument index="1" name="material" type="CanvasItemMaterial">
 			</argument>
 			<description>
+			Set the material of the tile.
 			</description>
 		</method>
 		<method name="tile_get_material" qualifiers="const">
@@ -34900,6 +34902,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the material of the tile.
 			</description>
 		</method>
 		<method name="tile_set_texture_offset">
@@ -34908,6 +34911,7 @@
 			<argument index="1" name="texture_offset" type="Vector2">
 			</argument>
 			<description>
+			Set the texture offset of the tile.
 			</description>
 		</method>
 		<method name="tile_get_texture_offset" qualifiers="const">
@@ -34916,6 +34920,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the texture offset of the tile.
 			</description>
 		</method>
 		<method name="tile_set_shape_offset">
@@ -34924,6 +34929,7 @@
 			<argument index="1" name="shape_offset" type="Vector2">
 			</argument>
 			<description>
+			Set the shape offset of the tile.
 			</description>
 		</method>
 		<method name="tile_get_shape_offset" qualifiers="const">
@@ -34932,6 +34938,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the shape offset of the tile.
 			</description>
 		</method>
 		<method name="tile_set_region">
@@ -34949,7 +34956,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
-			Return the tile sub-region in the texture. This is common in texture atlases.
+			Return the tile sub-region in the texture.
 			</description>
 		</method>
 		<method name="tile_set_shape">
@@ -34976,6 +34983,7 @@
 			<argument index="1" name="shapes" type="Array">
 			</argument>
 			<description>
+			Set an array of shapes for the tile, enabling physics to collide with it.
 			</description>
 		</method>
 		<method name="tile_get_shapes" qualifiers="const">
@@ -34984,6 +34992,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the array of shapes of the tile.
 			</description>
 		</method>
 		<method name="tile_set_navigation_polygon">
@@ -34992,6 +35001,7 @@
 			<argument index="1" name="navigation_polygon" type="NavigationPolygon">
 			</argument>
 			<description>
+			Set a navigation polygon for the tile.
 			</description>
 		</method>
 		<method name="tile_get_navigation_polygon" qualifiers="const">
@@ -35000,6 +35010,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the navigation polygon of the tile.
 			</description>
 		</method>
 		<method name="tile_set_navigation_polygon_offset">
@@ -35008,6 +35019,7 @@
 			<argument index="1" name="navigation_polygon_offset" type="Vector2">
 			</argument>
 			<description>
+			Set an offset for the tile's navigation polygon.
 			</description>
 		</method>
 		<method name="tile_get_navigation_polygon_offset" qualifiers="const">
@@ -35016,6 +35028,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the offset of the tile's navigation polygon.
 			</description>
 		</method>
 		<method name="tile_set_light_occluder">
@@ -35024,6 +35037,7 @@
 			<argument index="1" name="light_occluder" type="OccluderPolygon2D">
 			</argument>
 			<description>
+			Set a light occluder for the tile.
 			</description>
 		</method>
 		<method name="tile_get_light_occluder" qualifiers="const">
@@ -35032,6 +35046,7 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the light occluder of the tile.
 			</description>
 		</method>
 		<method name="tile_set_occluder_offset">
@@ -35040,6 +35055,7 @@
 			<argument index="1" name="occluder_offset" type="Vector2">
 			</argument>
 			<description>
+			Set an offset for the tile's light occluder.
 			</description>
 		</method>
 		<method name="tile_get_occluder_offset" qualifiers="const">
@@ -35048,13 +35064,14 @@
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
+			Return the offset of the tile's light occluder.
 			</description>
 		</method>
 		<method name="remove_tile">
 			<argument index="0" name="id" type="int">
 			</argument>
 			<description>
-			Remove a tile, by integer id.
+			Remove the tile referenced by the given ID.
 			</description>
 		</method>
 		<method name="clear">
@@ -35066,7 +35083,7 @@
 			<return type="int">
 			</return>
 			<description>
-			Find an empty id for creating a new tile.
+			Return the ID following the last currently used ID, useful when creating a new tile.
 			</description>
 		</method>
 		<method name="find_tile_by_name" qualifiers="const">
@@ -35075,13 +35092,14 @@
 			<argument index="0" name="name" type="String">
 			</argument>
 			<description>
-			Find the first tile with the given name.
+			Find the first tile matching the given name.
 			</description>
 		</method>
 		<method name="get_tiles_ids" qualifiers="const">
 			<return type="Array">
 			</return>
 			<description>
+			Return an array of all currently used tile IDs.
 			</description>
 		</method>
 	</methods>
@@ -35092,35 +35110,35 @@
 	<brief_description>
 	</brief_description>
 	<description>
-	Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optinally be set to loop.
+	Timer node. This is a simple node that will emit a timeout callback when the timer runs out. It can optionally be set to loop.
 	</description>
 	<methods>
 		<method name="set_wait_time">
 			<argument index="0" name="time_sec" type="float">
 			</argument>
 			<description>
-			Set wait time. When the time is over, it will emit the timeout signal.
+			Set wait time in seconds. When the time is over, it will emit the timeout signal.
 			</description>
 		</method>
 		<method name="get_wait_time" qualifiers="const">
 			<return type="float">
 			</return>
 			<description>
-			Return the wait time. When the time is over, it will emit the timeout signal.
+			Return the wait time in seconds.
 			</description>
 		</method>
 		<method name="set_one_shot">
 			<argument index="0" name="enable" type="bool">
 			</argument>
 			<description>
-			Set as one-shot. If true, timer will stop after timeout, otherwise it will automatically restart.
+			Set as one-shot. If enabled, the timer will stop after timeout, otherwise it will automatically restart.
 			</description>
 		</method>
 		<method name="is_one_shot" qualifiers="const">
 			<return type="bool">
 			</return>
 			<description>
-			Return true if is set as one-shot. If true, timer will stop after timeout, otherwise it will automatically restart.
+			Return true if configured as one-shot.
 			</description>
 		</method>
 		<method name="set_autostart">
@@ -35151,19 +35169,21 @@
 			<return type="float">
 			</return>
 			<description>
-			Return the time left for timeout if the timer is active.
+			Return the time left for timeout in seconds if the timer is active, 0 otherwise.
 			</description>
 		</method>
 		<method name="set_timer_process_mode">
 			<argument index="0" name="mode" type="int">
 			</argument>
 			<description>
+			Set the timer's processing mode (fixed or idle, use TIMER_PROCESS_* constants as argument).
 			</description>
 		</method>
 		<method name="get_timer_process_mode" qualifiers="const">
 			<return type="int">
 			</return>
 			<description>
+			Return the timer's processing mode.
 			</description>
 		</method>
 	</methods>
@@ -35175,6 +35195,12 @@
 		</signal>
 	</signals>
 	<constants>
+		<constant name="TIMER_PROCESS_FIXED" value="0">
+		Update the timer at fixed intervals (framerate processing).
+		</constant>
+		<constant name="TIMER_PROCESS_IDLE" value="1">
+		Update the timer during the idle time at each frame.
+		</constant>
 	</constants>
 </class>
 <class name="ToolButton" inherits="Button" category="Core">

+ 4 - 1
scene/main/timer.cpp

@@ -182,11 +182,14 @@ void Timer::_bind_methods() {
 
 	ADD_SIGNAL( MethodInfo("timeout") );
 
-	ADD_PROPERTY(PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_timer_process_mode"), _SCS("get_timer_process_mode"));
+	ADD_PROPERTY( PropertyInfo(Variant::INT, "process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), _SCS("set_timer_process_mode"), _SCS("get_timer_process_mode") );
 	ADD_PROPERTY( PropertyInfo(Variant::REAL, "wait_time", PROPERTY_HINT_EXP_RANGE, "0.01,4096,0.01" ), _SCS("set_wait_time"), _SCS("get_wait_time") );
 	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "one_shot" ), _SCS("set_one_shot"), _SCS("is_one_shot") );
 	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "autostart" ), _SCS("set_autostart"), _SCS("has_autostart") );
 
+	BIND_CONSTANT( TIMER_PROCESS_FIXED );
+	BIND_CONSTANT( TIMER_PROCESS_IDLE );
+
 }
 
 Timer::Timer() {