mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
393 stars 115 forks source link

getinfos() return null tables for AM classes' functions #639

Open oomek opened 4 years ago

oomek commented 4 years ago

When I run the following:

foreach ( m in instance.getclass() )
{
    if ( typeof(m) == "function" )
    {
        foreach ( f in m.getinfos() )
            ::print( f + "\n" )
    }
}

I get null fields for fe.Text fe.Image etc

0
true
(null : 0x0000000000000000)
(null : 0x0000000000000000)

When I use an instance of my own class I get some meaningful data:

on_tick
(array : 0x0000000008655000)
false
0
D:\EMU\ATTRACTMODE\layouts/test smoothing/inertia.nut
(array : 0x0000000008654100)

Do you know by any chance what may be causing it? I've created an inertia class that adds nice physics based animation to any fe. object and parameter, but I'm having problems diverting class functions like set_rgb(r,g,b) and I wouldn't like to hardcode them as it supposed to be universal and work on any object.

rogalian commented 4 years ago

If I run this code in mine I get the below error: `Script Error in /home/rogalian/.attract/layouts/Verticools Deluxe/layout.nut - the index 'instance' does not exist

Reason for trying - I want to know if it's possible to find + reuse the font size AM is using in it's configuration menu (at low resolutions it always appears to render its own text really well with no tricks required)

oomek commented 4 years ago

You have to create an instance object first for example local instance = fe.add_text("test",0,0,100,100) and compare the console output with an instance of some class local instance = SomeClass()

oomek commented 4 years ago

I don't think that you can access the font size AM is using for the overlays. What kind of tricks you're refering to?

rogalian commented 4 years ago

Setting fe.layout.width and fe.layout.height larger (double) the screen resolution gives vastly better text than letting layout height and width match screen when resolution is 320x240.

From: Radek Dutkiewicz notifications@github.com To: mickelson/attract attract@noreply.github.com CC: rogalian github@rogalian.com, Comment comment@noreply.github.com Received: 28 Jul 2020 13:07:37 Subject: Re: [mickelson/attract] getinfos() return null tables for AM classes' functions (#639)

I don't think that you can access the font size AM is using for the overlays. What kind of tricks you're refering to?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/mickelson/attract/issues/639#issuecomment-665001387], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ABHG5WBW4W5SCVMP7244HVDR525QPANCNFSM4PJ5MNKQ]. [https://github.com/notifications/beacon/ABHG5WFBSUHN4NY6HRSMS5DR525QPA5CNFSM4PJ5MNK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOE6RR3KY.gif]

oomek commented 4 years ago

Forget about oversampling. I'm finishing my Signed Distance Field font renderer which allows smooth scaling fonts in AM and additionally you get outline, shadow and glow for free, no expensive blurs required. This class can be adopted for pixelated bitmap fonts. That's the only sane solution for 240p

oomek commented 4 years ago

Kerning of small fonts is totaly broken but it's caused by SFML not AM. I was trying to fix it on SFML repo, but the discussion went to a stall.

rogalian commented 4 years ago

Forget about oversampling. I'm finishing my Signed Distance Field font renderer which allows smooth scaling fonts in AM and additionally you get outline, shadow and glow for free, no expensive blurs required. This class can be adopted for pixelated bitmap fonts. That's the only sane solution for 240p

Apologies it's way off your bug topic to jump in like this! I understand your explanation about the instance, thanks. I also get the nulls.

At 320x240 I agree, bitmap is end-game but oversampling isn't too bad. 640x240 with oversampling looks very good. If you can improve on it cheaply I'm keen to try your renderer.

oomek commented 4 years ago

Coming back to the topic, I was trying to use the _call metamethod, but ti's not firing. @mickelson do you know why by any chance?

mickelson commented 4 years ago

Not off the top of my head, I’m not an expert on the squirrel functionality tho

On Jul 28, 2020, at 9:54 AM, Radek Dutkiewicz notifications@github.com wrote:

 Coming back to the topic, I was trying to use the _call metamethod, but ti's not firing. @mickelson do you know why by any chance?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

oomek commented 4 years ago

I did some more experiments. _call function fires, but only when you call the instance itself instance() calling class functions does not unfortunately. It's a bit disapponting that I cannot override the class function members like I _get, _set with non function class members.