7
7
import com .badlogic .gdx .graphics .glutils .ShapeRenderer ;
8
8
import com .badlogic .gdx .graphics .glutils .ShapeRenderer .ShapeType ;
9
9
10
- /*
11
-
12
- TODO: Start Here!
13
-
14
- In this demo, we'll use ShapeRenderer to draw some lines!
15
-
10
+ /**
11
+ * TODO: Start Here!
12
+ *
13
+ * In this demo, we'll use ShapeRenderer to draw some lines! We'll use most of the line drawing
14
+ * methods offered by ShapeRenderer, but remember to check out the Javadocs for the full story. If
15
+ * you're lazy, you can just Google "LibGDX ShapeRenderer", and you'll find what you're looking
16
+ * for!
16
17
*/
17
18
18
19
public class DrawingLines extends ApplicationAdapter {
19
20
20
21
ShapeRenderer shapeRenderer ;
21
22
22
23
@ Override
23
- public void create () {
24
+ public void create () {
24
25
// Remember we want to create our ShapeRenderer outside of our render callback
25
26
shapeRenderer = new ShapeRenderer ();
26
27
}
@@ -33,7 +34,7 @@ public void dispose() {
33
34
}
34
35
35
36
@ Override
36
- public void render () {
37
+ public void render () {
37
38
// As always, first we clear the screen
38
39
Gdx .gl .glClearColor (0 , 0 , 0 , 1 );
39
40
Gdx .gl .glClear (GL20 .GL_COLOR_BUFFER_BIT );
@@ -52,7 +53,7 @@ public void render () {
52
53
shapeRenderer .line (30 , 0 , 130 , 100 , Color .BLUE , Color .RED );
53
54
// The last interesting thing we can do is draw a bunch of connected line segments using polyline
54
55
// First we set up the list of vertices, where the even positions are x coordinates, and the odd positions are the y coordinates
55
- float [] verticies = {100 , 200 , 300 , 300 , 200 , 300 , 300 , 200 };
56
+ float [] verticies = {100 , 200 , 300 , 300 , 200 , 300 , 300 , 200 };
56
57
shapeRenderer .polyline (verticies );
57
58
// Finally, as always, we end the batch
58
59
shapeRenderer .end ();
0 commit comments