OpenMods / OpenPeripheral-Addons

An addon for OpenPeripheral, adding physical blocks and items to the game
MIT License
11 stars 10 forks source link

getStringWidth removed? #60

Closed applejag closed 9 years ago

applejag commented 9 years ago

I have a program displaying text (on terminal glasses), and I want it to display one piece of text after the next. Previously I used bridge.getStringWidth but that method seems to be deprecated/removed.

How do I do this then? The method was buggy before so have you replaced it with some hidden method or how do I do this?

I've seen you've added anchors, can they be applied to this? Or do I solve this using some different approach?

I'm thinking of using formatting (§1 §b §r, etc.) but then I don't have access to the whole color spectrum...


Tl;dr: why did you removed getStringWidth and how do I work without it?

boq commented 9 years ago

We removed it, since it was broken on server, without any possibility of fixing. It should never exists in first place.

Sorry, no alternative provided. If your program used it, it was already behaving different in various screen resolutions.

If you have just two pieces of text, you could use anchors: for one label set object anchors to (right, middle) and for other to (left, middle).

applejag commented 9 years ago

The idea with anchor was may you could set the anchor to the right of another object, so it would always be on the right side.

Anyways I got what I wanted with formatting, here's a small screenshot of how it looks atm: image

So as you can see on the text below the gradient I wanted to have it in different colors, which was tricky to accomplish before but with formatting it was easy...