Sign in to follow this  

Problem with C# and DirectX Colors

This topic is 3661 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
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

This topic is 3661 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this