nerobot

Forum Replies Created

Viewing 15 posts - 211 through 225 (of 805 total)
  • Author
    Posts
  • in reply to: Remove close button from single tab #11795

    nerobot
    Participant

    We can’t get any TabButton from TabView. And TabButton has no property Closable.

    Easiest way to manage closable state is to add additional parameter closable:Bool=True into TabView.AddTab().

    You can do it yourself or ask to Mark to add this ability.

    It would be better to have it in mojox.

    in reply to: File access API? #11794

    nerobot
    Participant

    Topic about image saving: http://monkeycoder.co.nz/forums/topic/how-to-save-a-image/

    There is also ExternalDir() function along with InternalDir.

    I’m not sure is it sdcard dir or not.

    But if it’s so, you can use something like this:

    in reply to: Data Packer (read directly from stream) #11775

    nerobot
    Participant

    In addition to GUI app:

    • there is a single output file now, info section with names / offsets / sizes placed alogn with binaries;
    • addet GetText() method to extract textual files.

    nerobot
    Participant

    Congrats!! 🙂

    in reply to: Android/iOS resolution question #11772

    nerobot
    Participant

    I think you always should to use virtual resolution and relative coords to get the same result on all devices.

    Also you can load HD resources according to real resolution.

    in reply to: File access API? #11771

    nerobot
    Participant

    LoadString based on DataBuffer.Load 😉

    Look at std.filesystem functions. There is an InternalDir() for example. Maybe it’s what you need.

    I can’t insert link to docs page because docs is dynamically showing by JavaScript, therefore I insert link to source code:

    github page

    in reply to: Data Packer (read directly from stream) #11766

    nerobot
    Participant

    Some ideas about using data packer.

    I want to use it for release but don’t want to re-pack every time while developing.

    My approach is to have 2 imports with different ‘configs’ for resource manager:

    We use one of them at a time – just comment/uncomment two lines.

    Inside of them we have something like:

    Don’t forget to call our InitAssets() in Main():

    Of course, we should use our Assets class for any loading stuff to get all discussed here benefits (easy swapping between loading-from-single-files and loading-from-packs).

    Also, we can try to find single-files in assets folder if not found in pack-file.

    Attachments:
    in reply to: RemoveIf example #11762

    nerobot
    Participant

    Function LessThan<T>:Bool( val:T )( cmp:T )

    Wow, two pairs of brackets, it’s an undocumented cheat! 🙂
    And it works. My life will never be the same…

    in reply to: Class' Where conditions #11761

    nerobot
    Participant

    Ok I though this was not new and that the new feature announced in the blog post was not for generics.

    New part of Where is abilitity to combine conditions by And / Or / Not operators.

    You can write Where T Extends Component Or T=MyUpdater. Yes, we also can use = and <> in conditions.

    Combined condition is needed also for multi-generic classes, for example:

     

    I still don’t get when the class has been instantiated if the program could not run. Afaik you have to call New() to get an instance. Or Mark meant instantiated in the compiler logic?

    Here: “instantiated” means “code part where we call New()”. Monkey2’s compiler check all New() calls to check are they correct accordingly with Where. C++ compiler do its own checks but doesn’t allow us to deny using of unwanted types as a generics (allow to deny, sounds good:) ).

    in reply to: Operator From() #11759

    nerobot
    Participant

    If you want a function to be called when a value is modified, you’ll need a ‘Set’ style method for assignments

    Yes, I want this! But don’t want to use Set or properties.:)

    Saying about Class Assignable<T> above I meant to have it as a core type of monkey2 like a Variant is.

    Variant have an assignment magic on a c++ side. I need right the same plus event Assigned to be able to react on value changes.

    I know that this is very specific thing, but maybe it sounds useful not for me only.

    in reply to: Data Packer (read directly from stream) #11756

    nerobot
    Participant

    This solution depends on Stream.Seek( position:Int ) method, but not all streams are seek-able.

    This time I know only that it works fine for desktops.

    Also need to test very big pack file – about 500 mb and monitoring RAM usage.

    I expect to see low RAM usage because it just jumps to resource offset in file stream and read only needed data part.

    in reply to: Operator From() #11755

    nerobot
    Participant

    No, I will not supporting assignment overloading in the near future, if ever.

    I agree, and I never used it in c++.

    Any ideas how to get what I want?

    My idea is to have special base class with Assigned event. So we can’t break anything by overloading but can react on assignment:

    Maybe this class will extends Variant but with generic type.

    And usage:

    in reply to: Class' Where conditions #11745

    nerobot
    Participant

    What would be the syntax for the new where for class conditions? And what is the purpose of this feature?

    Don’t use it just because you can if you don’t really need that. 🙂

    And I don’t get how a compilation error can occur while the class is instantiated, wouldn’t it be a runtime error?

    Not a runtime error but compile time error!

    mx2cc checks variables types at compile time.

    See my example below. There is an compilation error. Just comment where condition and you can compile it.

    Both classes have DoSomething methods => we can use them as generic type.

    But if we want to use ComponentHolder with components only – we add Where condition to deny other types.

    in reply to: Operator From() #11736

    nerobot
    Participant

    The truth is, I don’t want to have such magic in monkey2.

    I agree – operator To + extensions = powerful coding.

    So the monkey2 equivalent might be: if ‘operator from’ WAS supported, and a dst type implemented ‘operator from’ and a src type implemented ‘operator to’, which would get used when converting from src type to dst type?

    Left-sided vars have a bigger priority, I think…

    If there’s something you can’t do this way, let me know and we can try to come up with a solution.

    I’m triyng to do observable variables – sort of plain values wrapper which would notify listeners about value changing.

    And I want to use this wrapper as a plain type, but I can’t catch value assignment without overriding of assign operator.

    Variant type have a magic with value assigning – we can assign anything.

    I want to do something like that but with strong types checking via generics.

    My example:

    in reply to: Consistent "Can't find Main:Void()" #11712

    nerobot
    Participant

    Try to compile template app.

    Menu File — Templates — Simple mojo app.

Viewing 15 posts - 211 through 225 (of 805 total)