Text height/width scaledheight/scaledwidth not accurate?


(James Barrett) #1

Hi,

I’m making a branching dialogue system for my game and I’m trying to draw rectangles around the options that you can select.

I figured that Draw.rectPlus(text.x, text.y, text.width, text.height, 0x000000) would do what I want, but the boxes are all the wrong size. Here is a screenshot. http://puu.sh/9Hcdj/a6492b8a58.png I have also tried using scaledWidth and scaledHeight.

Each of the replies (1-4, not the main text) is an individual Text object, and then I am using a for loop to draw a rectangle at their individual co-ordinates and supposedly at their size, however the height of the rectangle is much higher than it should be and so it looks like one big rectangle.

Any help on how to get the pixel height of the text is appreciated.


(TaylorAnderson) #2

might want to try text.textWidth and text.textHeight.

text i find is very finicky for me, but those should help!


(James Barrett) #3

Looks like this was my problem! thanks a bunch man.


(TaylorAnderson) #4

No problem!

The other thing to remember with text, something I learned recently, is that if you want to center its origin, right after doing so you should also put text.originX -= 1 and text.originY -= 1