Jump to content

Centering dxDrawText..


Feche1320

Recommended Posts

  • Moderators
From 1024*768 and up the text draw is OK, but from 800*600 to 640*480 it isn't showing..
drawColor("#2EFE2EEG #FFFFFF24/7 RACE DD/DM", (754/1024)*sxx-50, (228/768)*syy-210, (732/1024)*sxx, (258/768)*syy, tocolor(0,0,0,255), (sxx/1024)*0.8, "bankgothic") 

the sxx-50 don't have the same effect in 800*600 and in1024*768

You have to convert the absolute position x, y to a relative position, then convert the relative position to the absolute position ( but for the player screen size )

drawColor ? ( custom function ? )

drawColor("#2EFE2EEG #FFFFFF24/7 RACE DD/DM", (754/1024)*sxx-50, (228/768)*syy-210, (732/1024)*sxx, (258/768)*syy, tocolor(0,0,0,255), (sxx/1024)*0.8, "bankgothic")

As you can see, the blue is not at the good place ! All positions modifications need to be before the relative conversion ( like this ):

(754-50/1024)*sxx => (704/1024)*sxx

(228-210/768)*syy => (18/768)*sxx

I supposed that in in 1024*768 the text is at the good place so try whit this.

(It's more easy with colors isn't it ? :lol: )

Link to comment
  • Moderators
right: the absolute X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking.

bottom: the absolute Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking.

It's set the size of a 'rectangle' ( the bounding box ). This 'rectangle' is needed if you want to use this arguments:

clip: if set to true, the parts of the text that don't fit within the bounding box will be cut off.

wordBreak: if set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line.

And if you want to center the text to the middle, left or right of this 'rectangle'.

I think you don't want to use it so you can use sxx and syy.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...