Problem with C# and DirectX Colors

Started by
5 comments, last by Tophurious 16 years, 4 months ago
I am having a problem with C# and DirectX. I have make a 'Microsoft.DirectX.Direct3D.ColorValue startColor' in a class. Inside that classes constructor I want to set up the varaibles for startColor but I can only do it invidually is seems. How can I set a,r,g,b at the same time?
Advertisement
If I understand your question correctly, one of the below should work for you.

ColorValue(float, float, float, float);

ColorValue.FromArgb(Int32)
-------------------------------------------------------- What''s the difference between engineers and architects? Engineers build weapons; architects build targets. --------------------------------------------------------
Well, sort of. Inside of my classes constructor I want to set up startColor. But i can not do startColor = ColorValue(1, 0, 0, 0); How would I do something like that?
Why not use the constructor for ColorValue?

startColor = new ColorValue(float r, float g, float b, float a);

????
I am using VS2005 and I do not have that option. I tried doing
startColor = Microsoft.DirectX.Direct3D.ColorValue( ? ? ? );
but no constructor will come up.
// invalid:startColor = Microsoft.DirectX.Direct3D.ColorValue( ? ? ? );// valid:startColor = new Microsoft.DirectX.Direct3D.ColorValue(a, r, g, b );  //           ^^^//           *** important!!!// also valid:startColor = Microsoft.DirectX.Direct3D.ColorValue.FromArgb( );

FromArgb() is a static function for the class that you can call without an instance.
However, you can't call a constructor without using the keyword "new".
Yeah, don't forget the R,G,B and A <-- You might be forgetting this

This topic is closed to new replies.

Advertisement