소스 검색

Moved cursor example to animation section.

Paweł Jarosz 3 년 전
부모
커밋
ac7ca09612

+ 2 - 2
examples/_main/loader.go

@@ -767,9 +767,9 @@ embedded_components {
   }
 }
 embedded_components {
-  id: "sprite/cursor"
+  id: "animation/cursor"
   type: "collectionproxy"
-  data: "collection: \"/examples/sprite/cursor/cursor.collection\"\n"
+  data: "collection: \"/examples/animation/cursor/cursor.collection\"\n"
   "exclude: false\n"
   ""
   position {

+ 2 - 2
examples/_main/menu.gui_script

@@ -103,7 +103,7 @@ function init(self)
 	self.index = {}
 	self.index["basics"] = { "simple_move", "message_passing", "follow", "parent_child", "spawn", "z_order", "movement_speed" }
 	self.index["physics"] = { "dynamic", "kinematic", "raycast", "trigger", "hinge_joint"}
-	self.index["animation"] = { "spinner", "flipbook", "chained_tween", "basic_tween", "spine" }
+	self.index["animation"] = { "spinner", "flipbook", "chained_tween", "basic_tween", "spine", "cursor" }
 	self.index["gui"] = { "button", "stencil", "load_texture", "pointer_over", "color"}
 	self.index["input"] = { "move", "text", "down_duration", "mouse_and_touch" }
 	self.index["particles"] = { "particlefx", "modifiers" }
@@ -111,7 +111,7 @@ function init(self)
 	self.index["render"] = { "camera" }
 	self.index["debug"] = { "physics", "profile" }
 	self.index["collection"] = { "proxy", "splash" }
-	self.index["sprite"] = { "size", "tint", "cursor" }
+	self.index["sprite"] = { "size", "tint" }
 	self.index["file"] = { "sys_save_load" }
 	self.index["tilemap"] = { "collisions", "get_set_tile" }
 	local categories = {}

+ 1 - 1
examples/sprite/cursor/cursor.collection → examples/animation/cursor/cursor.collection

@@ -4,7 +4,7 @@ embedded_instances {
   id: "bee"
   data: "components {\n"
   "  id: \"cursor\"\n"
-  "  component: \"/examples/sprite/cursor/cursor.script\"\n"
+  "  component: \"/examples/animation/cursor/cursor.script\"\n"
   "  position {\n"
   "    x: 0.0\n"
   "    y: 0.0\n"

+ 0 - 0
examples/sprite/cursor/cursor.md → examples/animation/cursor/cursor.md


+ 0 - 0
examples/sprite/cursor/cursor.png → examples/animation/cursor/cursor.png


+ 3 - 3
examples/sprite/cursor/cursor.script → examples/animation/cursor/cursor.script

@@ -7,10 +7,10 @@ end
 function on_input(self, action_id, action)
 	if action_id == hash("touch") and action.pressed then -- <3>
 		self.duration = self.duration + 1 -- <4>
-		if self.duration > 2 then  -- <5>
+		if self.duration > 3 then  -- <5>
 			self.duration = 0
 		end
-		label.set_text("#info", "Duration: "..self.duration)  -- <6>
+		label.set_text("#info", "Cursor animation duration: "..self.duration)  -- <6>
 		go.cancel_animations("#sprite", "cursor")  -- <7>
 		go.set("#sprite", "cursor", 0.0)  -- <8>
 		go.animate("#sprite", "cursor", go.PLAYBACK_LOOP_FORWARD, 1, go.EASING_LINEAR, self.duration) -- <9>
@@ -22,7 +22,7 @@ end
 2. Store a duration time used in this example (for defining how long the cursor animation should take) in self reference.
 3. If we receive input (touch or mouse click) we change the duration of the cursor animation.
 4. Increase the duration.
-5. If the duration is larger than 2, set it back to 0 to make a circular change of the duration.
+5. If the duration is larger than 3, set it back to 0 to make a circular change of the duration.
 6. Set the text of the label with id `info` to show the current duration of the animation to user.
 7. Cancel previous animation on cursor value.
 8. Reset cursor value to 0.