Mark Sibly

Forum Replies Created

Viewing 15 posts - 196 through 210 (of 1,431 total)
  • Author
    Posts
  • in reply to: How Parent/Children works? #13183

    Mark Sibly
    Keymaster

    Use the ‘Parent’ property to change an entity’s parent, eg:

    You can also set an entity’s parent to ‘null’, meaning the entity is in ‘world space’.

    in reply to: Help with Pointers. #13182

    Mark Sibly
    Keymaster

    Monkey pointers are similar to C pointers, only they use ‘Ptr’ instead of ‘*’ and ‘Varptr’ instead of ‘&’, eg:

    Also, you need to use ‘[]’ to dereference a pointer, so ‘p[0]’ is the same as ‘(*p)’ in C.

    ‘CString’ is a built-in type that should only appear in extern blocks and basically means ‘const char *’. It can be used as if it were a normal monkey2 string. So whenever you see ‘CString’ in a monkey2 extern block, just think ‘const char*’.

    Note there is an error in the sdl-mixer file: ‘Function Mix_LoadMUS:Mix_Music Ptr( file:CString Ptr )’ is wrong as ‘CString Ptr’ is actually a ‘const char **’! This should just be ‘file:CString’. I have just pushed a fix for this to the develop branch at github. However, you can always just fix this yourself and update modules if you want.

    I have not actually tried the sdl-mixer module myself as it has a dependancy on a shared library for decoding music etc that I wasn’t sure how to build/use. There is however a vsynth demo in bananas that using the module just for playing audio.


    Mark Sibly
    Keymaster

    Cheers, I thought that was probably it but for the sake of clarity and to minimize confusion it’s always nice to be as clear as possible.

    Same answer though, Cast wont be throwing an exception any time soon. Even if it did, I’d still like something ‘castish’ which is faster than “If i instanceOf T then t:=Cast<T>( i )” which effectively needs to do 2 downcasts.

    in reply to: How to deal with external cpp strings returns? #13169

    Mark Sibly
    Keymaster

    Yes you will have to wrap it natively.


    Mark Sibly
    Keymaster

    var b = (B)a; // <– This won’t happen…
    > // System.InvalidCastException has been thrown

    I’m not too keen on making Cast throw an exception or runtime error, as cast currently doubles as an ‘intanceOf’ style operation, eg: you can go…

    If Cast<B>( a ) Print "A as a B!"

    Changing this behaviour would break a ton of my own code and would mean I would have to add ‘InstanceOf’ or similar to the language. I’m quite happy with current behaviour.


    Mark Sibly
    Keymaster

    This one seems to have a link to an object instance somewhere in memory, but the displayed value is Null.

    Please post runnable examples including Main() – how am I meant to know what goes before that etc?


    Mark Sibly
    Keymaster

    Can you post output of console? You can copy and paste from console by clicking in console, then using edit menu to select-all/copy (Yes, this should be smoother, my fault really).

    [edit]Ok, can reproduce, seems to be a mingw thing. Under msvc x64 I get:

    ob is Null
    -now trying to invoke the doMore() method on ‘ob’ Null intance-

    Attempt to invoke method on null instance

    ie: it should die before the ‘yo!’ Will check it out…

    in reply to: Android compile error #13058

    Mark Sibly
    Keymaster

    For the record, I’m currently using the following versions of everything and can build OK:

    android studio 3.0.1
    android sdk platform-tools 27.0.1
    android sdk tools 26.1.1
    NDK 16.1.4479499

    Make sure you have build tools 26.0.2 installed too. One of the build.gradle files (called ‘build.gradle (Module:app) in the android project) references ‘buildToolsVersion “26.0.2”‘ so you could also try editing this to any version you have installed.

    Finally, you might want to check you have all ‘SDK Update Sites’ enabled.

    in reply to: Android compile error #13057

    Mark Sibly
    Keymaster

    Have you updated your SDK tools etc?

    That gradle thing is a real pain – it’s a version control tool apparently, but it has serious version problems itself!


    Mark Sibly
    Keymaster

    I thought invoking a method on a Null instance was giving an error..

    It was and it should. In debug mode I get the following error…

    Attempt to invoke method on null instance

    …on line 29, ob3.doMore()

    This is 100% correct behaviour – you can’t invoke a method on a Null instance. You could a while back but haven’t been able to for some time now.

    in reply to: Compiling on Ubuntu 14.04 LTS (fresh install) #13044

    Mark Sibly
    Keymaster

    sudo aptget install g++multilib libopenaldev libpulsedev libsdl2dev

    Cleanest I’ve seen yet, will probably do a clean install myself soon and give this a whirl.

    My plan is to produce a guide for Linux Mint 18.3 – MATE “Sylvia” as a starting point for users wanting to install Linux and setup up dependencies for Monkey

    This would be great. Even if we can’t cover alllinuxes, one at least would give newbies some idea of where to start.

    Good luck with emscripten! How long does that take to build on a  decent machine (about 6 hours on my el ‘cheapo linux box)?


    Mark Sibly
    Keymaster

    Look all right to me. Pulling out the noise, code is:

    Shouldn’t the downcasting on line 26 be an error?

    Don’t think so. B is a subclass of A, so Cast<B>( a ) is semantically correct (ie: compilable) if ‘a’ is of class A (or any other superclass of B). In general, the compiler can’t know at compile time what the true class of ‘a’ is though.

    in reply to: Website refresh #13042

    Mark Sibly
    Keymaster

    Is that Monkey logo the new official Monkey2 logo?

    Almost…I am 93% sure it will be, just need a few more days to decide for sure. I didn’t actually like it that much at first, but it has grown on me and I’m really more concerned if users are comfortable with it anyway, and everyone seems to be.

    Also, Diffrenzy posted a logo image which I accidentally deleted using my clumsy god like admin powers (‘delete’ button is right next to ‘download’) so here’s hoping he will post it again.

    in reply to: Non stretchy "fill" layout in 3D? #12995

    Mark Sibly
    Keymaster

    Fixes coming soon…

    in reply to: Website refresh #12994

    Mark Sibly
    Keymaster

    Hold crap this is great! Huge thanks to Diffrenzy for doing this…

    Have fixed the operator overloading example on the front page (which needs more work), and please feel free to mention anything no matter how minor.

    but still the issue with the method

    Oops, forgot to hit ‘update’ on the post – fixed now?!?

Viewing 15 posts - 196 through 210 (of 1,431 total)