#1 2017-02-03 23:26:18

From: Sweden
Registered: 2016-12-12
Posts: 15

Improved text overlay

I have a few suggestions like.

Would be nice if overlays could be indefinite and returning a object which could be modified during runtime.
The defaults are just some made up things just to show they should be defaults and not required.

 * @type   {object} Text object.
 * @return {object} Overlay object.
const text = alt1.overlayText({
  text: 'Foo', // required
  size: 25, // defaults ???
  group: 'Bar' // defaults 'none'
  color: rgba(r, g, b, a), // defaults white with no transparency
  x: x, // defaults 0
  y: y, // defaults 0
  shadow: false, // show text shadow? defaults true
  time: false // defaults 1000ms

Then at a later stage you could modify it and when you don't want the overlay destroy() it.

text.color = rgba(r, g, b, a);
text.x = x;
text.shadow = true;

This can be used to animate text overlays in many ways like blinking red text for warnings, floating combat text and any other way the creator can come up with.

My reasoning for passing in the group with the object is to avoid race condition if you have different loops calling alt1.overLaySetGroup().???

Would also be nice to have a way a few font options like monospace and some better looking font with AA. (Pass it in with the text object?)
Would also be nice if the overlay object returned could have a property with it's width and height for easier positioning.

This can be a new function or for backwards compatibility alt1.overlayText() could check if first argument is an object otherwise it would use the current argument signature.


#2 2017-02-04 12:28:52

Registered: 2014-12-30
Posts: 739

Re: Improved text overlay

The current overlay system was initially designed for debugging and just kind of expanded as other apps needed small additions.

I'm looking at making a new separate overlay api. It will allow you to target individual overlay elements and the forced timeout will be removed.

AA fonts are currently not possible as i can't draw things with alpha value. That will be for another rework related to the rendering.


Quick reply

Write your message and submit

Board footer

Powered by FluxBB