Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectX Opacity

Started by shahmirj Mar 7, 2008 at 8:24 PM 1 replies 1.8k views
Original Post
shahmirj
shahmirj
Ok i want to make a splash screen for my program. Except i dont want to design a sprite that holds all the different frames for my opacity levels My Game is in 2D and im loading up .png files Im using Direct3D I want to just loop through the opacity for my splash screen i got this from some where but i cant understand the language http://activedeveloper.dk/weblogs/mrjs/archive/2005/09/14/1995.aspx If you can help me or post a link to another tutorial :)
MattWorden
MattWorden
Are you using the Sprite object to do your 2D drawing?

If so, then when you draw your sprite, you can supply a color (System.Drawing.Color) as one of the parameters. There is an alpha component to the color (see the System.Drawing.Color.FromARGB() function), which you can set to a number from 0 (completely transparent) to 255 (completely opaque).

So, you can adjust that alpha number over time to fade-in and fade-out a sprite.

I hope that's helpful.

-Matt
www.mwgames.com - my game projects websiteNimble2D Blog - Simple 2D Game Dev with VB.Net
shahmirj
shahmirj
Thats for the System lib

however i just found the answer got the idea from .FromARGB() ^

Didnt realize it had it in my code all along

D3Dsprite->Draw(sprite, ∂, &center, &position, D3DCOLOR_ARGB(255, 255, 255, 255));

^^^^The -> D3DCOLOR_ARGB(Opacity, Red, Green, Blue);

he he :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.