Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: markc74 on May 20, 2018, 03:37:36 PM
-
I'm trying to create a group of objects that animate in and out of the screen in the same way, so I thought adding them to a surface would be the answer but I cant see a way to set font sizes within a surface. The only option I can find is to add text which defaults to a tiny font.
Is it possible?
-
After spending a good hour trying to work it out, 2 mins after posting I worked it out. Don't know if this is useful to anybody but here's how I did it!
local foo = fe.add_surface(500,540);
foo.add_text("xxxxx",100,15,400,30).charsize=130;
foo.add_text("222",100,200,400,30);
foo.add_text("333",100,300,400,30);
foo.add_text("444",100,520,400,30);
I really feel like an idiot! :o
-
After spending a good hour trying to work it out, 2 mins after posting I worked it out. Don't know if this is useful to anybody but here's how I did it!
Yes that's the right way. Did you notice that fonts on a surface have a slight border around them, when the surface is transparent?
-
Yes that's the right way. Did you notice that fonts on a surface have a slight border around them, when the surface is transparent?
Yes I did but I kinda like it looks. But now I cant seem to align the text in the surface though! Any ideas?
I've got this:
dd_artwork_options.add_text("Show Artwork",0, 0, 252, 66).charsize=40;
Which works great, albeit centres the text in the surface so tried this (and most variants I can think of!)
dd_artwork_options.add_text("Show Artwork",0, 0, 252, 66).charsize=40.align=Align.Left;
dd_artwork_options.add_text("Show Artwork",0, 0, 252, 66).charsize=40.align=Left;
But they don't work... Bah...
Am I missing something stupid? I've searched the site and couldn't see anything...
Many thanks for any help on this!
-
dd_artwork_options.add_text("Show Artwork",0, 0, 252, 66).charsize=40.align=Align.Left;
dd_artwork_options.add_text("Show Artwork",0, 0, 252, 66).charsize=40.align=Left;
But they don't work...
Hmm I never pass parameters directly using the dot, try creating a new object for the text, something like
local options_text = dd_artwork_options.add_text("Show Artwork",0, 0, 252, 66)
options_text.charsize = 40
options_text.align=Align.Left
that should work
-
Thanks zpaolo11x,
That's soo close! How do I then add that object to a surface?
-
That's soo close! How do I then add that object to a surface?
The object should be already added to the surface... look at the declaration:
local options_text = dd_artwork_options.add_text("Show Artwork",0, 0, 252, 66)
is adding the object to the dd_artwork_options surface (which I didn't declare in the code sinppet), while if it was like this:
local options_text = fe.add_text("Show Artwork",0, 0, 252, 66)
then the text object would be added to the main frontend.
-
Aaaaaah - now it clicks. ;D
Sorry I missed that the first time. Thank you very much for the explanation!
Best wishes,
Mark
-
That black fringing on a text drawn on a surface is caused by AM using alpha blend mode for surfaces. I’ve fixed it by setting premultiplied blend mode for surfaces in my commit that added blend modes to AM. You have to compile the current version from source or wait for the upcoming AM release.