public override void DrawLine(Point a, Point b, Color color) { mDevice.DrawBuffer.Flush(); mLines[0] = new PositionColor(a.X, a.Y, 0, color.ToArgb()); mLines[1] = new PositionColor(b.X, b.Y, 0, color.ToArgb()); mDevice.SetDeviceStateTexture(null); mDevice.AlphaArgument1 = TextureArgument.Diffuse; mDevice.Device.VertexDeclaration = mPosColorDecl; mDevice.Device.DrawUserPrimitives(SlimDX.Direct3D9.PrimitiveType.LineList, 1, mLines); mDevice.AlphaArgument1 = TextureArgument.Texture; }
public static PositionColor FromBaseObject(BaseObject baseObj) { if (baseObj == null || baseObj.NativeObject == IntPtr.Zero) { return(null); } PositionColor obj = baseObj as PositionColor; if (object.Equals(obj, null)) { obj = new PositionColor(CreatedWhenConstruct.CWC_NotToCreate); obj.BindNativeObject(baseObj.NativeObject, "CPositionColor"); obj.IncreaseCast(); } return(obj); }
public override void DrawRect(RectangleF rect, Color color) { mDevice.DrawBuffer.Flush(); int c = color.ToArgb(); mLines[0] = new PositionColor(rect.X, rect.Y, 0, c); mLines[1] = new PositionColor(rect.Right, rect.Y, 0, c); mLines[2] = new PositionColor(rect.Right, rect.Bottom, 0, c); mLines[3] = new PositionColor(rect.X, rect.Bottom, 0, c); mLines[4] = new PositionColor(rect.X, rect.Y, 0, c); mDevice.SetDeviceStateTexture(null); mDevice.Device.SetTextureStageState(0, TextureStage.ColorArg0, TextureArgument.Diffuse); mDevice.Device.VertexDeclaration = mPosColorDecl; mDevice.Device.DrawUserPrimitives(Direct3D.PrimitiveType.LineStrip, 4, mLines); mDevice.Device.SetTextureStageState(0, TextureStage.ColorArg0, TextureArgument.Current); }
public override void DrawLines(Point[] pt, Color color) { mDevice.DrawBuffer.Flush(); if (pt.Length > mLines.Length) { mLines = new PositionColor[pt.Length]; } for (int i = 0; i < pt.Length; i++) { mLines[i] = new PositionColor(pt[i].X, pt[i].Y, 0, color.ToArgb()); } mDevice.SetDeviceStateTexture(null); mDevice.Device.SetTextureStageState(0, TextureStage.ColorArg0, TextureArgument.Diffuse); mDevice.Device.VertexDeclaration = mPosColorDecl; mDevice.Device.DrawUserPrimitives(Direct3D.PrimitiveType.LineStrip, pt.Length - 1, mLines); mDevice.Device.SetTextureStageState(0, TextureStage.ColorArg0, TextureArgument.Current); }
void Start() { andererRenderer = unserCube.GetComponent <MeshRenderer>(); andererRenderer.material.color = new Color(0, 0, 1); Transform anderesTransform = unserCube.transform; anderesTransform.position = new Vector3(0, 0, 0); BoxCollider andererCollider = unserCube.GetComponent <BoxCollider>(); AssignRandomColor randomColorAssigner = unserCube.GetComponent <AssignRandomColor>(); PositionColor myPositionColor = unserCube.GetComponent <PositionColor>(); PublicColor meineColor = unserCube.GetComponent <PublicColor>(); meineColor.myColor = new Color(1, 0, 0); int newDoubledInt = DoubleGivenInt(2); print(newDoubledInt); }
public override void DrawToFrameBuffer(double gameTime) { base.DrawToFrameBuffer(gameTime); double perc = (double)(value - minValue) / (double)(maxValue - minValue); int mid = (int)(perc * clientRectangle.Width); Rectangle frameClientRect = ScreenToFrame(ClientToScreen(clientRectangle)); PositionColor[] barQuad = new PositionColor[4]; barQuad[0].Position = new Vector3(frameClientRect.Left, frameClientRect.Top, 0); barQuad[1].Position = new Vector3(frameClientRect.Left, frameClientRect.Bottom, 0); barQuad[2].Position = new Vector3(frameClientRect.Left + mid, frameClientRect.Top, 0); barQuad[3].Position = new Vector3(frameClientRect.Left + mid, frameClientRect.Bottom, 0); barQuad[0].Color = Gradient(barColor, 0.90f); barQuad[1].Color = Gradient(barColor, 0.00f); barQuad[2].Color = Gradient(barColor, 0.90f); barQuad[3].Color = Gradient(barColor, 0.00f); PositionColor.Draw(BeginMode.TriangleStrip, barQuad); }
public BaseObject Create() { PositionColor emptyInstance = new PositionColor(CreatedWhenConstruct.CWC_NotToCreate); return(emptyInstance); }