Jump to content
juleshuxley

Vertically algin text in RscText

Recommended Posts

Why is my RSC text not centered?

Here's my RSC class:

#define CT_STRUCTURED_TEXT 13
#define ST_CENTER 0x02

class MyRscStructuredText {
  idc = -1;
  type = CT_STRUCTURED_TEXT;  // defined constant
  style = ST_CENTER;          // defined constant
  x = 0.1;
  y = 0.1;
  w = 0.1;
  h = 0.1;
  size = 0.018;
  text = "";
  class Attributes {
    font = "TahomaB";
    color = "#000000";
    align = "center";
    valign = "middle";
    shadow = false;
    shadowColor = "#ff0000";
    size = "1";
  };
};

Here's the implementation:

_item = _display ctrlCreate ["MyRscStructuredText", -1];
_item ctrlSetPosition [0,0,0.0,0.0];
_item ctrlSetText "X";
_item ctrlSetBackgroundColor [1, 0, 0, 1];
_item ctrlSetTextColor [1,1,1,1];

Result:
Lmao.jpg

While it appears to be horizontally aligned, why is it not vertically aligned? Why is valign being ignored?

I just want that white x to be in the dead center of the red box, I don't mind what type the RSC is. Setting it to Structured Text doesn't appear to be doing anything anyway

Share this post


Link to post
Share on other sites

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×