🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

energy display

Started by
0 comments, last by Matt 24 years, 8 months ago
how do you make those little displays that show a units energy like units and buildings have in the C&C series? source code would be nice if anyone has it
Advertisement
There are many ways to do this. For a status bar I'd simply draw a box outline, then use blt to colorfill the statusbar as far as you need it to be filled.

Heres a DirectDraw example:

code:
//assume the outline has already been drawnDDBLTFX ddbltfx;RECT    StatusRect;ZeroMemory( &ddbltfx, sizeof(ddbltfx) );ddbltfx.dwSize = sizeof(ddbltfx);ddbltfx.dwFillColor = color;SetRect(&StatusRect, left, top, right, bottom);lpBackBuffer->Blt(&StatusRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);

Hmm... I guess that isn't a great example, but the concept still applies. At least it shows how to do colorfills in directdraw .

--TheGoop

This topic is closed to new replies.

Advertisement