-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathExample.cs
More file actions
36 lines (18 loc) · 821 Bytes
/
Example.cs
File metadata and controls
36 lines (18 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using UnityEngine;
using System.Collections;
using ProtoTurtle.BitmapDrawing;
public class Example : MonoBehaviour {
void Start () {
Material material = renderer.material;
Texture2D texture = new Texture2D(512,512, TextureFormat.RGB24, false);
texture.wrapMode = TextureWrapMode.Clamp;
material.SetTexture(0, texture);
texture.DrawFilledRectangle(new Rect(0, 0, 120, 120), Color.green);
texture.DrawRectangle(new Rect(0, 0, 120, 60), Color.red);
texture.DrawCircle(256, 256, 100, Color.cyan);
texture.DrawFilledCircle(256, 256, 50, Color.grey);
texture.DrawCircle(0, 0, 512, Color.red);
texture.DrawLine(new Vector2(120, 60), new Vector2(256, 256), Color.black);
texture.Apply();
}
}