PDA

View Full Version : Text on center of the canvas (Left(X), not Top(Y)).



Chesso
01-01-2007, 11:56 AM
Anyone know how I might go about centering the left position of text on the surface screen when drawing? (This is just for introduction text for testing atm).

The window is fixed to 350x350, I can easily find the middle, but i'd need to do something fancy to fit the text's length into that?

Legolas
01-01-2007, 12:35 PM
Something like:

((canvas_width - text_length) div 2)

Maybe I haven't understood your question

Chesso
01-01-2007, 12:56 PM
That might work yeah, just been awhile since iv'e done any of this.

Also, now that iv'e finally gotten UnDelphiX 1.07B to install, for some reason I can't draw anything on DXDraw's surface, aside from text so far.

e.g:

DXImageList.Items[0].Draw(DXDraw.Surface, 0, 0, 0);
DXImageList.Items[1].Draw(DXDraw.Surface, 20, 20, 0);

Does absolutely nothing, no matter where I put it. Either inbetween BeginScene; and EndScene or otherwise. (I of course Flip; at the end).

EDIT: I see so UnDelphiX doesn't like JPEGS lol, especially concerning transparency, oh well I converted the cursor to a bitmap so it seems ok now.