Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
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

Draw text and color bar using sprites

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
2 replies to this topic

#1 Yura   Members   

263
Like
0Likes
Like

Posted 04 February 2013 - 06:55 AM

Hi,

I'm trying to draw text and color bar on my scene using sprites.

I want to achieve something like this: Capture2.PNG

 

I've tried to use this:

 

Font font = new Font(d3dDevice, new System.Drawing.Font("Arial", 20, 
System.Drawing.FontStyle.Regular));
            Sprite spr = new Sprite(d3dDevice);
            spr.Begin();
            font.DrawText(spr, "some string", 10, 20, new ColorBGRA(0, 65, 200, 0));
            spr.End();

 

but I've got just solid rectangles instead of each letter.

 

So, what should I do to receive desired result?



#2 CrescentFresh   Members   

146
Like
1Likes
Like

Posted 05 February 2013 - 10:17 AM

I'm not sure what you mean by "solid rectangles", but it may be that you don't have the correct render states enabled to draw text.

 

D3DXSPRITE_ALPHABLEND

D3DXSPRITE_SORT_TEXTURE

 

try enabling those states on the d3dDevice using SetRenderState();


Can I play with madness?


#3 Yura   Members   

263
Like
0Likes
Like

Posted 06 February 2013 - 02:22 AM

I'm not sure what you mean by "solid rectangles", but it may be that you don't have the correct render states enabled to draw text.

 

D3DXSPRITE_ALPHABLEND

D3DXSPRITE_SORT_TEXTURE

 

try enabling those states on the d3dDevice using SetRenderState();

 

ALPHABLEND helped, thx

[RESOLVED]






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.