public TemplateButton(Template t, int index, TemplateMenu menu) { this.menu = menu; Index = index; template = t; size = t.Size; buttonMesh = Mesh.Box; buttonMesh.UIElement = true; }
public void Init() { camera = new Camera(this); background = new Background(); templateMenu = new TemplateMenu(this); tilesetList = new TilesetList(this); manipulators.Add(EditMode.Select, new SelectManipulator(this)); manipulators.Add(EditMode.Move, new MoveManipulator(this)); manipulators.Add(EditMode.Rotate, new RotateManipulator(this)); manipulators.Add(EditMode.Scale, new ScaleManipulator(this)); gridMesh = new Mesh(PrimitiveType.Quads); gridMesh.Color = new Color(1, 1, 1, 0.2f); List <Vector2> gridVectorList = new List <Vector2>(); for (int x = -50; x <= 50; x++) { gridVectorList.Add(new Vector2(1 * x - 0.01f, -50)); gridVectorList.Add(new Vector2(1 * x + 0.01f, -50)); gridVectorList.Add(new Vector2(1 * x + 0.01f, 50)); gridVectorList.Add(new Vector2(1 * x - 0.01f, 50)); gridVectorList.Add(new Vector2(-50, 1 * x - 0.01f)); gridVectorList.Add(new Vector2(-50, 1 * x + 0.01f)); gridVectorList.Add(new Vector2(50, 1 * x + 0.01f)); gridVectorList.Add(new Vector2(50, 1 * x - 0.01f)); } gridMesh.Vertices = gridVectorList.ToArray(); originMesh = new Mesh(PrimitiveType.Quads); originMesh.Color = new Color(1, 1, 1, 0.4f); gridVectorList.Clear(); gridVectorList.Add(new Vector2(-0.02f, -50)); gridVectorList.Add(new Vector2(+0.02f, -50)); gridVectorList.Add(new Vector2(+0.02f, 50)); gridVectorList.Add(new Vector2(-0.02f, 50)); gridVectorList.Add(new Vector2(-50, -0.02f)); gridVectorList.Add(new Vector2(-50, +0.02f)); gridVectorList.Add(new Vector2(50, +0.02f)); gridVectorList.Add(new Vector2(50, -0.02f)); originMesh.Vertices = gridVectorList.ToArray(); templateCreator = new TemplateCreator(this); layerCreator = new LayerCreator(this); }