Problem with C# and DirectX Colors
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?
If I understand your question correctly, one of the below should work for you.
ColorValue(float, float, float, float);
ColorValue.FromArgb(Int32)
ColorValue(float, float, float, float);
ColorValue.FromArgb(Int32)
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.
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".
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement