Mark Sibly

Forum Replies Created

Viewing 15 posts - 1,081 through 1,095 (of 1,431 total)
  • Author
    Posts
  • in reply to: extended ascii chars #4440

    Mark Sibly
    Keymaster

    Should be working now.

    in reply to: Possible to add method to Rect with "Extension" ? #4427

    Mark Sibly
    Keymaster

    OK. Why would you want to use Extension instead of Extends?

    The main advantage of extensions is that they can be used with objects that you *didn’t* create. With inheritance, you need to be in control of the ‘new’ that creates the object.

    So the above ‘Grow’ extension can be used with any Rect, not just ‘MyRects’ or some other class that Extends Rect. (also, you can’t currently extend structs anyway but that’s not really the point here!).

    You can do all sorts of cool things with extensions, like add a DrawMysprite() method to canvas, To:String() or To:JsonValue() to *anything* etc.

    There can also be multiple extensions of the same class, as opposed to single inheritance where you can create a new CoolRect1 or a CoolRect2 – but not both.

    It’s important to note that extension methods are really just global functions (which is why I was a bit wary of adding them in the first place). But in mx2, some functionality can only be achieved via methods, eg: operators, To:String() etc, so they provide quite a nice way of dealing with that.

    in reply to: Possible to add method to Rect with "Extension" ? #4425

    Mark Sibly
    Keymaster

    Here you go..

    Actually took me a few attempts to get right – you should be able to use plain ‘Rect’ inside the extension instead of ‘Rect<T>’ (the way you can inside normal class decls) but that’s not working. Will look into it eventually, but Rect<T> will always work.

    in reply to: Android OpenAL library missing symbol 'strtof' #4424

    Mark Sibly
    Keymaster

    New build of openal.so is up now.

    in reply to: Adding vertices to Shadowcaster() #4423

    Mark Sibly
    Keymaster

    ShadowCaster is currently just a simple container for vertices, it doesn’t really ‘manage’ them.

    So you can add vertices by doing something like:

    I guess it could include a stack, but this would just be ‘deadweight’ once the app was running, unless apps have a need to add vertices in realtime?

    in reply to: possible mojo.app osx close bug #4414

    Mark Sibly
    Keymaster

    Here, Cmd-Q quits ted2 but not mojo apps.

    This is because I’m ‘faking’ Cmd-Q in Ted2. On windows, Alt-F4 is automatically converted to a ‘close window’ message by the OS, but macos doesn’t do the same with Cmd-Q.

    It’s easy enough to fake it for macos mojo apps too the way I do with Ted2 though, and I think it’s a good idea – you can always intercept the window close event to prevent it. Any objections?

    Can you post an issue for this?

    in reply to: Is Rect.Centered() Correct ? #4411

    Mark Sibly
    Keymaster

    > Same size, but wrong location!

    Ha, yes! Will fix.

    in reply to: Lambdas Silently Ignore Default Arguments #4410

    Mark Sibly
    Keymaster

    I presume GitHub’s the correct place to post bugs, then?

    Yes, I’ve grown to like it a lot compared to my old ‘bug reports’ forum approach.

    I didn’t know if this was intended behavior or not.

    When in doubt, post, I can always just chuck it later.

    in reply to: Android OpenAL library missing symbol 'strtof' #4409

    Mark Sibly
    Keymaster

    Woah, somone’s actually *using* the android target?!?

    Double woah, lightsparks works really nicely on my Shield! And, once I remembered to build modules, it’s a pretty smooth build/run process.

    As for the strof issue, according to both the thread you linked to above and this thread here:

    http://stackoverflow.com/questions/14571399/android-ndk-cant-find-atof-function

    …it should be enough to set APP_PLATFORM in Application.mk for the openal.so project to an api version <=19.

    The project that builds openal.so isn’t actually included in the mx2 repos (it’s here: https://github.com/apportable/openal-soft.git) but looking at it now, APP_PLATFORM isn’t set to *anything* in Application.mk. And I’m getting a warning when building about api 24 being greater than minsdk version, so it’s probably using api 24.

    I’ll rebuild openal.so using api 10 (which is the what the mx2 product minsdk is) and upload soon.

    in reply to: Ted2Go IDE #4394

    Mark Sibly
    Keymaster

    mx2cc has actually had a ‘-semant’ option for a few versions now, in fact it now has -parse, -semant, -translate, -build and -run. Specifying any of these automatically include the previous ones, eg: -semant means -parse, -semant, while -run includes all of ’em.

    Probably easier easiest if I add this myself as it’s in the middle of the/my buildactions file.

    in reply to: Lambdas Silently Ignore Default Arguments #4393

    Mark Sibly
    Keymaster

    Can you post this to github issues, so it doesn’t get ‘lost’?

    in reply to: chars and char externals #4391

    Mark Sibly
    Keymaster

    Use a libc.char_t for the param type, eg: SomeFunc( chr:libc.char_t ).

    in reply to: Ted2 won't run on Gnome (Archlinux) #4373

    Mark Sibly
    Keymaster

    did you try using a c++ nullptr instead of the bb_array_null

    No, but I doubt it would work as it’s still just a const 0.

    The problem was my nasty habit of using -> with null ptrs. This officially became ‘undefined behaviour’ a few years back, so compilers are now starting to optimize out stuff like ‘this==0’, ‘!this’, ‘this==nullptr’ etc, because ‘this’ can/will never be null in a ‘well formed’ program.

    So the ‘length()’ method, which used to be ‘return this ? this->length : 0’ was being optimized down to plain old ‘return this->length’.

    The bb_array_null global fools/forces the compiler into always doing the ‘this’ comparison, since the compiler can’t know that nothing else changes bb_array_null (even though nothing does). But of course this involves an extra pointless read of the global.

    I could make Length a static/extension method, but the real fix IMO is to turn arrays into ‘handles’ that contain the pointer to the array (which they have been on and off during mx2 dev) and I’m in the process of doing that now. It will break any native code that use bbArray (easily fixed though) but it needs to be done so the sooner the better.

    Besides, it’ll make arrays much nicer to use with native code, eg: instead of “bbArray<bbInt> *p=bbArray<bbInt>::create( 100 )” it’ll just be “bbArray<bbInt> p( 100 )”. Also, you’ll be able to index via plain operator[] in native code instead of current ugly (*p)[] or p->at().

    in reply to: Ted2 won't run on Gnome (Archlinux) #4370

    Mark Sibly
    Keymaster

    I managed to reproduce this by installing/building with gcc-6.

    There’s a quick ‘n’ dirty fix up now at github, let me know if it works!

    in reply to: Ted2 won't run on Gnome (Archlinux) #4358

    Mark Sibly
    Keymaster

    Actually, I think I may have a clue what’s going on here – thanks for exe it should prove helpful.

Viewing 15 posts - 1,081 through 1,095 (of 1,431 total)