Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

energy display

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 Matt   Members   

122
Like
Likes
Like

Posted 17 October 1999 - 03:14 PM

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


#2 Facehat   Members   

696
Like
Likes
Like

Posted 17 October 1999 - 03:14 PM

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 drawn
DDBLTFX 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





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.