nerobot

Forum Replies Created

Viewing 15 posts - 166 through 180 (of 805 total)
  • Author
    Posts
  • in reply to: Color extensions #12139

    nerobot
    Participant

    If you want to make color lighter or darker, you can multiply it with float:

    Local darkerPink:=Color.Pink * .8

    Local lighter:=Color.FromHex("#554488") * 1.2

    in reply to: Rendering Gradients? #12130

    nerobot
    Participant

    Nice!

    One note about converting Color into UInt:

    There is an ABGR format! I suppose, it’s a native opengl format.

    That’s why if you write color as $FF0000FF you’ll get Red color but you can expect Blue here.

    in reply to: Some notes about Pixmap #12127

    nerobot
    Participant

    mojo.Image uses Pixmap with premultiplied alpha.

    If you’ll save such pixmap then you’ll get artifacts on next loading image – alpha will be premultiplied twice here.

    I think this is the reason.

    PNG loader itself works well.

    in reply to: Some notes about Pixmap #12111

    nerobot
    Participant

    @abakobo  try to just resave pixmap without touching pixelFormat and alpha:

    it is an artefacts-free for me.

    in reply to: KeyboardMapper (to map ui.Buttion with KeyEvent) #12110

    nerobot
    Participant

    Actually, we can to omit where condition, and then we can pass any instance with method Clicked() as a button – thanks to geteric type T.

    in reply to: Preferences class #12100

    nerobot
    Participant

    I still hope that the best way is to use pure monkey2’s path..

    But I didn’t use mobile targets yet.

    You can write own Function GetPrefsFile:String( file:String,author:String="defValue",name:String="defValue" ) that will use sdl prefs or what you want else, and you can change single place if needed to make changes for a whole project.

    And to link with my code:

    Const AppPrefs:=Preferences.Get( GetPrefsFile( "app.json" ) )

    in reply to: Playing with first class functions #12098

    nerobot
    Participant

    I tried it just for testing because we talk about Nulls here.

    And I can live with that too. 🙂

    in reply to: Playing with first class functions #12096

    nerobot
    Participant

    What happen if we compare ‘default null’ first class function with keyword Null?

    The answer is – first class function is null until have no assigned values.

    Example app:

    Output:

    Also I found that mx2cc allow us to write weird code:

    Is this Null value will generate anonimous new instance or simple will do nothing?

    I think the answer is the second case – do nothing. If we have empty / null f and write f+=Null then f still is null.

    in reply to: Playing with first class functions #12095

    nerobot
    Participant

    Yes, I like what you said in the latest post.

    And some changes to docs for these methods where you explain that Null is context specific. Maybe even to create own docs page for Null and place references here from other pages.

    What happen if we compare ‘default null’ first class function with keyword Null?

    If GetValue ( "test",Null )=Null

    Genarally, .Contains () is our big friend. 🙂

    in reply to: Playing with first class functions #12089

    nerobot
    Participant

    You’re probably right, although it does allow the above ‘magic’ to work. Ditto other tricks like non-intrusive ref counting, eg: ‘_refs[obj]+=1’ will ‘just work’.

    There is an default (t) in c#, don’t know is it possible/ okay for monkey.

    With that mechanism we can write

    GetValue <T>:T ( key:String,value:T=default (T) )

    And it can also create default first class function for us.

    in reply to: Playing with first class functions #12084

    nerobot
    Participant

    Almost, you’re definitely supposed to be allowed to chain functions together, although ‘f=f+F2’ should work too, will fix!

    I’m not sure that f=f1+f2 is a good idea.

    If f1 returns 5 and f2 returns 10 then f1+f2 should return 15. But in our case we get resulting value of the last call only.

    But operator += is used as ‘subscription’ operator for a long time and it’s behavior is quite expected.

    in reply to: Playing with first class functions #12070

    nerobot
    Participant

    A null function value is a NOP function (ie: it doesn’t do anything and returns ‘null’) but is still a normal, valid function (just like a null int, ie: 0, is a normal int)

    Returning ‘null’-values of different types can be very insidious.

    For example, С# have method bool TryGetValue( key, out value ) to avoid returning unexisting values, and indexing operator throw an exception if key not found (msdn).

    IMO, for monkey2 will be good at least to improve docs for Map::Get() method and Map::[ ] operator, where would be explained that *you always get ‘default-null’ value here*. And very important to use Map::Contains() if you want to know has map a key of not.

    Have Int(0) isn’t the same as have no value at all.

    Just to pay attention on it.

    in reply to: Share your TED2GO themes, Please. #12069

    nerobot
    Participant

    As an idea – to make standalon app or special dialog in ted2go to customize themes.

    Dreams…

    in reply to: How to use Sprites? #12068

    nerobot
    Participant

    I am thinking about adding new Tab named Examples where would be collected all links to bananas/samples – kind of project tree view.

    in reply to: Ted2Go IDE #12054

    nerobot
    Participant

    Wow. 🙂 Thanks to all patrons!

Viewing 15 posts - 166 through 180 (of 805 total)