Jump to content
  • Advertisement
Sign in to follow this  

Problem with C# and DirectX Colors

This topic is 3820 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
If I understand your question correctly, one of the below should work for you.

ColorValue(float, float, float, float);

ColorValue.FromArgb(Int32)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

// 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".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!