Difference between revisions of "on.paint"

From Inspired-Lua Wiki
Jump to navigation Jump to search
m (Text replace - ".invalidate" to ":invalidate")
m
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
 
''[[:Category:gc|'gc']]'' is the Graphics Context, passed by default to the function.
 
''[[:Category:gc|'gc']]'' is the Graphics Context, passed by default to the function.
  
This function can be fired by the [[platform.window:invalidate]] function.
+
This function can be flagged to fire by calling the [[platform.window:invalidate]] function.
  
 +
== Example  ==
 +
 +
Below is an example of a program that uses on.paint(gc) to draw a line to the screen:
 +
<source lang="lua">
 +
function on.paint(gc) --Define a function for the event with the default argument
 +
gc:drawLine(5,5,200,1) --Draw a line on the screen
 +
end
 +
</source>
 
[[Category:Events]]
 
[[Category:Events]]

Latest revision as of 15:50, 17 December 2013

The function on.paint(gc) is called when the script's window needs to be painted.
'gc' is the Graphics Context, passed by default to the function.

This function can be flagged to fire by calling the platform.window:invalidate function.

Example

Below is an example of a program that uses on.paint(gc) to draw a line to the screen:

function on.paint(gc) --Define a function for the event with the default argument
	gc:drawLine(5,5,200,1) --Draw a line on the screen
end