Jump to content

Why does dxDrawText use end position and not width and hight?


Gaimo

Recommended Posts

Posted


I solved the problem by doing this:
 

function dxNewDrawText(...)
    arg = {...}
    arg[4] = arg[2] + arg[4]
    arg[5] = arg[3] + arg[5]
    dxDrawText(unpack(arg))
end

But I would like to understand the reason to use end position.

  • 4 months later...
Posted (edited)

float leftX, float topY [, float rightX = leftX, float bottomY = topY

It uses those arguments for positioning so that you can determine the 4 points of a rectangle in which the text will be. Default alignment is horizontal "left" and vertical "top". You can easily change this to "center", "center" to place your text in the middle of the rectangle you defined with the 4 left, top, right, bottom points.

Idk why they didn't just do x,y, width,height but it works like this.

Edited by FernandoMTA

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...