Cross Hairs
by AG Interactive · 03/15/2009 (1:06 pm) · 4 comments
I have made some generic hanges to the crosshairs that msdn provides I thought I would share it.
Add the following code to your GameEngine constructor immediately following your this.SetStyle statement. Do not move the file until you see "Move File" In the instuctions.
Now add the following code after the code above.
Now add the following code to your playGiu.giu file.
After that use microsoft visaul studio to import the files to Torque. I hope this works since I made this using Visual Studio 08.
Thanks for reeding.
Add the following code to your GameEngine constructor immediately following your this.SetStyle statement. Do not move the file until you see "Move File" In the instuctions.
private CustomVertex.PositionColored[] CreateCrossHairVertexArrayTop ( ){ CustomVertex.PositionColored[] crossHairs = new CustomVertex.PositionColored[7]; float zval = 0f; // top of targeting crosshairs
crossHairs[0].Position = new Vector3 ( -1f, 1f, zval ); crossHairs[1].Position = new Vector3 ( -1f, 2f, zval ); crossHairs[2].Position = new Vector3 ( 0f, 2f, zval ); crossHairs[3].Position = new Vector3 ( 0f, 3f, zval ); crossHairs[4].Position = new Vector3 ( 0f, 2f, zval ); crossHairs[5].Position = new Vector3 ( 1f, 2f, zval ); crossHairs[6].Position = new Vector3 ( 1f, 1f, zval ); crossHairs[0].Color = Color.Green.ToArgb ( ); crossHairs[1].Color = Color.Green.ToArgb ( ); crossHairs[2].Color = Color.Green.ToArgb ( ); crossHairs[3].Color = Color.Green.ToArgb ( ); crossHairs[4].Color = Color.Green.ToArgb ( ); crossHairs[5].Color = Color.Green.ToArgb ( ); crossHairs[6].Color = Color.Green.ToArgb ( ); return crossHairs;} private CustomVertex.PositionColored[] CreateCrossHairVertexArrayBottom (){ CustomVertex.PositionColored[] crossHairs = new CustomVertex.PositionColored[7]; // bottom of targeting crosshairs
float zval = 0f; // bottom of targeting crosshairs
crossHairs[0].Position = new Vector3 ( 1f, -1f, zval ); crossHairs[1].Position = new Vector3 ( 1f, -2f, zval ); crossHairs[2].Position = new Vector3 ( 0f, -2f, zval ); crossHairs[3].Position = new Vector3 ( 0f, -3f, zval ); crossHairs[4].Position = new Vector3 ( 0f, -2f, zval ); crossHairs[5].Position = new Vector3 ( -1f, -2f, zval ); crossHairs[6].Position = new Vector3 ( -1f, -1f, zval ); crossHairs[0].Color = Color.Green.ToArgb ( ); crossHairs[1].Color = Color.Green.ToArgb ( ); crossHairs[2].Color = Color.Green.ToArgb ( ); crossHairs[3].Color = Color.Green.ToArgb ( ); crossHairs[4].Color = Color.Green.ToArgb ( ); crossHairs[5].Color = Color.Green.ToArgb ( ); crossHairs[6].Color = Color.Green.ToArgb ( ); return crossHairs;}Now add the following code after the code above.
_public CostumLightng.PositionColored[] =Lighting of; CrossHair:(() Red[1].Color = Red Light.DirectX
Now add the following code to your playGiu.giu file.
_3D Wave Import; LightText over Component())
DotGuy = ProgramRatio ())Feature Utility[1]
DirectX Control.DirectX ()) Feature Attachments only[2]
3D Applied__())[4]After that use microsoft visaul studio to import the files to Torque. I hope this works since I made this using Visual Studio 08.
Thanks for reeding.
#2
03/16/2009 (1:15 am)
I am not sure about that, I did clean it up as much as I can, but I will check again.
#3
03/16/2009 (3:43 am)
I think what Mikael is talking about, it how it looks here in the post.
#4
03/16/2009 (9:59 am)
I'll give the code block a shot. The word wrap can be a hindrance..private CustomVertex.PositionColored[]
CreateCrossHairVertexArrayTop ( )
{
CustomVertex.PositionColored[] crossHairs = new CustomVertex.PositionColored[7];
float zval = 0f; // top of targeting crosshairs
crossHairs[0].Position = new Vector3 ( -1f, 1f, zval );
crossHairs[1].Position = new Vector3 ( -1f, 2f, zval );
crossHairs[2].Position = new Vector3 ( 0f, 2f, zval );
crossHairs[3].Position = new Vector3 ( 0f, 3f, zval );
crossHairs[4].Position = new Vector3 ( 0f, 2f, zval );
crossHairs[5].Position = new Vector3 ( 1f, 2f, zval );
crossHairs[6].Position = new Vector3 ( 1f, 1f, zval );
crossHairs[0].Color = Color.Green.ToArgb ( );
crossHairs[1].Color = Color.Green.ToArgb ( );
crossHairs[2].Color = Color.Green.ToArgb ( );
crossHairs[3].Color = Color.Green.ToArgb ( );
crossHairs[4].Color = Color.Green.ToArgb ( );
crossHairs[5].Color = Color.Green.ToArgb ( );
crossHairs[6].Color = Color.Green.ToArgb ( );
return crossHairs;
}
private CustomVertex.PositionColored[] CreateCrossHairVertexArrayBottom ()
{
CustomVertex.PositionColored[] crossHairs = new CustomVertex.PositionColored[7];
// ^^ Bottom of targeting crosshairs
float zval = 0f; // bottom of targeting crosshairs
crossHairs[0].Position = new Vector3 ( 1f, -1f, zval );
crossHairs[1].Position = new Vector3 ( 1f, -2f, zval );
crossHairs[2].Position = new Vector3 ( 0f, -2f, zval );
crossHairs[3].Position = new Vector3 ( 0f, -3f, zval );
crossHairs[4].Position = new Vector3 ( 0f, -2f, zval );
crossHairs[5].Position = new Vector3 ( -1f, -2f, zval );
crossHairs[6].Position = new Vector3 ( -1f, -1f, zval );
crossHairs[0].Color = Color.Green.ToArgb ( );
crossHairs[1].Color = Color.Green.ToArgb ( );
crossHairs[2].Color = Color.Green.ToArgb ( );
crossHairs[3].Color = Color.Green.ToArgb ( );
crossHairs[4].Color = Color.Green.ToArgb ( );
crossHairs[5].Color = Color.Green.ToArgb ( );
crossHairs[6].Color = Color.Green.ToArgb ( );
return crossHairs;
}
Torque Owner Mikael Pettersson
Snowpeak Studios