Difference between revisions of "Event.ENTER FRAME"

From GiderosMobile
(added example)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
  
 
=== Description ===
 
=== Description ===
The Gideros runtime dispatches the built-in [[Event.ENTER_FRAME]] event to [[Sprite]] instances before rendering the screen. Visual changes made by any [[Event.ENTER_FRAME]] listener function will be visible at next frame.
+
The Gideros runtime dispatches the built-in '''Event.ENTER_FRAME''' event to [[Sprite]] instances before rendering the screen. Visual changes made by any '''Event.ENTER_FRAME''' listener function will be visible at next frame.
  
 
=== Parameters ===
 
=== Parameters ===
Line 13: Line 13:
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
function onEnterFrame(e)
 
function onEnterFrame(e)
 
print(e.deltaTime)
 
print(e.deltaTime)
Line 19: Line 19:
  
 
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
 
stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)
</source>
+
</syntaxhighlight>
  
 
{{Sprite}}
 
{{Sprite}}

Latest revision as of 14:26, 13 July 2023

Available since: Gideros 2011.6
Value: enterFrame
Defined by: Sprite

Description

The Gideros runtime dispatches the built-in Event.ENTER_FRAME event to Sprite instances before rendering the screen. Visual changes made by any Event.ENTER_FRAME listener function will be visible at next frame.

Parameters

deltaTime: (number) time passed from previous frame
time: (number) time passed from app start
frameCount: (number) frame count from app start

Example

function onEnterFrame(e)
	print(e.deltaTime)
end

stage:addEventListener(Event.ENTER_FRAME, onEnterFrame)