public void addEllipse(DEVICE_PACK p, string iname, string texture, Vector2 wh, Vector2 radXY, float mass, float friction, bool isStatic) { OBJECT obj = new OBJECT(); obj.Init(p, texture, "ui", wh, OBJTYPE.all); obj.makeEllipse(radXY.X, radXY.Y, mass); obj.Position = new Vector2(0, -1000); obj.setFriction(friction); obj.setStatic(isStatic); obj.name = iname; objList.Add(obj); click = true; focusObj = obj; if (focusPos != new Vector2(0, -1000)) obj.Position = focusPos; ellipseCount++; }
public void makeLast(OBJECT obj) { objList.Remove(obj); objList.Add(obj); focusObj = obj; nextGeomType = obj.geomType; }
public void removeLast() { if (objList.Count == 0) return; focusPos = objList[objList.Count - 1].Position; objList[objList.Count - 1].Delete(); if (objList[objList.Count - 1].geomType == GEOMTYPE.box) boxCount--; objList.Remove(objList[objList.Count - 1]); focusObj = null; }
private void PushObjProperties(OBJECT obj) { nameTextbox.Text = obj.name.ToString(); textureTextbox.Text = obj.mesh.texname; widthTextbox.Text = obj.mesh.wh.X.ToString(); heightTextbox.Text = obj.mesh.wh.Y.ToString(); massTextBox.Text = obj.objDesc[0].mass.ToString(); if (obj.geomType == GEOMTYPE.box) { boxWidth.Text = obj.objDesc[0].wh.X.ToString(); boxHeight.Text = obj.objDesc[0].wh.Y.ToString(); geomTabIndex = 0; propertsTab.SelectedTab = propertsTab.TabPages[0]; } if (obj.geomType == GEOMTYPE.circle) { circleRad.Text = obj.objDesc[0].radius.ToString(); geomTabIndex = 1; propertsTab.SelectedTab = propertsTab.TabPages[1]; } if (obj.geomType == GEOMTYPE.ellipse) { ellipseRadX.Text = obj.objDesc[0].xradius.ToString(); ellipseRadY.Text = obj.objDesc[0].yradius.ToString(); geomTabIndex = 2; propertsTab.SelectedTab = propertsTab.TabPages[2]; } if (obj.geomType == GEOMTYPE.verts) { textureGeomWidth.Text = obj.mesh.wh.X.ToString(); textureGeomHeight.Text = obj.mesh.wh.Y.ToString(); textureGeomTexture.Text = obj.mesh.tex.Name.ToString(); geomTabIndex = 3; propertsTab.SelectedTab = propertsTab.TabPages[3]; } frictionBox.Text = obj.objDesc[0].geom.FrictionCoefficient.ToString(); isStatcBox.Checked = obj.objDesc[0].body.IsStatic; ObjectFactory.Instance.makeLast(obj); ObjectFactory.Instance.click = true; }