Difference between revisions of "GSDP:GAM100/CProcessing/vertex()"
From Inside
< GSDP:GAM100 | CProcessing
>D.hamilton (New page: {{GSDP:GAM100API.css}} =vertex()= ==Description== ==== Parameters ==== ==Example== <syntaxhighlight lang='c'> void update() { } </syntaxhighlight> ====Related==== * [[GSDP:GAM100/CP...) |
>D.hamilton |
||
Line 2: | Line 2: | ||
=vertex()= | =vertex()= | ||
==Description== | ==Description== | ||
+ | Using [[GSDP:GAM100/CProcessing/beginShape() |beginShape() ]], [[GSDP:GAM100/CProcessing/vertex() |vertex() ]], and [[GSDP:GAM100/CProcessing/endShape() |endShape() ]], a shape can be defined with any number of vertices. After begin shape is called, use [[GSDP:GAM100/CProcessing/vertex() |vertex() ]] to specify the specific vertices of the shape. A shape will not be drawn until [[GSDP:GAM100/CProcessing/endShape() |endShape() ]] is called. | ||
==== Parameters ==== | ==== Parameters ==== | ||
+ | vertex(x, y) | ||
+ | *x - (float) the horizontal position of the vertex | ||
+ | *y - (float) the vertical position of the vertex | ||
==Example== | ==Example== | ||
Line 10: | Line 14: | ||
void update() | void update() | ||
{ | { | ||
+ | // Start drawing a shape | ||
+ | beginShape(); | ||
+ | // Specify three vertices | ||
+ | vertex(100.0f, 100.0f); | ||
+ | vertex(200.0f, 100.0f); | ||
+ | vertex(200.0f, 200.0f); | ||
+ | |||
+ | // signal the end of the shape and draw the shape | ||
+ | endShape(); | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 13:14, 26 September 2018
vertex()
Description
Using beginShape() , vertex() , and endShape() , a shape can be defined with any number of vertices. After begin shape is called, use vertex() to specify the specific vertices of the shape. A shape will not be drawn until endShape() is called.
Parameters
vertex(x, y)
- x - (float) the horizontal position of the vertex
- y - (float) the vertical position of the vertex
Example
void update()
{
// Start drawing a shape
beginShape();
// Specify three vertices
vertex(100.0f, 100.0f);
vertex(200.0f, 100.0f);
vertex(200.0f, 200.0f);
// signal the end of the shape and draw the shape
endShape();
}