Overlay text?

Overlay text?

Post by eA » Sat, 05 Jul 2003 22:23:12



How can I overlay text over a directx window? I've tried using GDI,
but because the windows are double buffered it flickers a lot, and
also look a mess.

Many many thanks if anyone can help!

eAi

 
 
 

Overlay text?

Post by Adam Dawe » Sun, 06 Jul 2003 00:50:03



> How can I overlay text over a directx window?

Using textured quads is the easiest and fastest way I've found to put text
on your display... See http://www.lmnopc.com for a nice font texture
generator.

--

Adam.

 
 
 

Overlay text?

Post by vze » Sun, 06 Jul 2003 13:20:15


----- Original Message -----

Newsgroups: microsoft.public.win32.programmer.directx.graphics
Sent: Friday, July 04, 2003 9:23 AM
Subject: Overlay text?

> How can I overlay text over a directx window? I've tried using GDI,
> but because the windows are double buffered it flickers a lot, and
> also look a mess.

> Many many thanks if anyone can help!

> eAi

make a buffer to hold the text
clear it every frame
update it
initialize an HFONT
heres good parameters
hFont = CreateFont(17,9,0,0,FW_NORMAL,
    0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
    CLIP_DEFAULT_PRECIS,
    DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
    "Arial");
initialize LPD3DXFONT font with
    D3DXCreateFont(device,hFont,&font);
make a RECT struct with the text area

use
font->Begin();
font->DrawTextA(textBuffer,strlen(textBuffer),&rect,DT_LEFT,0xffffffff);
font->End();

to draw white text aligned on the left

 
 
 

Overlay text?

Post by vze » Sun, 06 Jul 2003 13:23:22



> ----- Original Message -----

> Newsgroups: microsoft.public.win32.programmer.directx.graphics
> Sent: Friday, July 04, 2003 9:23 AM
> Subject: Overlay text?

> > How can I overlay text over a directx window? I've tried using GDI,
> > but because the windows are double buffered it flickers a lot, and
> > also look a mess.

> > Many many thanks if anyone can help!

> > eAi

> make a buffer to hold the text
> clear it every frame
> update it
> initialize an HFONT
> heres good parameters
> hFont = CreateFont(17,9,0,0,FW_NORMAL,
>     0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
>     CLIP_DEFAULT_PRECIS,
>     DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
>     "Arial");
> initialize LPD3DXFONT font with
>     D3DXCreateFont(device,hFont,&font);
> make a RECT struct with the text area

> use
> font->Begin();
> font->DrawTextA(textBuffer,strlen(textBuffer),&rect,DT_LEFT,0xffffffff);
> font->End();

> to draw white text aligned on the left

oops thats direct3d, directx only is easier i guess
if u have an offscreen buffer use
DdrawOffScreen->GetDC(&hDC); to get a dc
then
TextOut(hDC, Vtx.Prj.X, Vtx.Prj.Y, Text, strlen(Text));
DdrawOffScreen->ReleaseDC(hDC);
to draw
 
 
 

Overlay text?

Post by eA » Wed, 09 Jul 2003 01:11:10



> How can I overlay text over a directx window? I've tried using GDI,
> but because the windows are double buffered it flickers a lot, and
> also look a mess.

> Many many thanks if anyone can help!

> eAi

Not sure if i made myself very clear. I need to overlay text over
another program's window (a game) I've use the API DrawText but this
flickers as the game window is double buffered. So, I'm not sure how I
can write to another windows's DirectX. I've managed to write to my
own program's window, but I'm not sure how this code could be ajusted
to write to another program's window, as just changing the hwnd in the
various places its used, doesn't appear to do anything, appart from
*up my own program a bit.

Many thanks!

eAi