Mark Sibly

Forum Replies Created

Viewing 15 posts - 436 through 450 (of 1,431 total)
  • Author
    Posts
  • in reply to: Monkey 2 structure question? #10867

    Mark Sibly
    Keymaster

    Might be  a bug – can you post a runnable sample?

    in reply to: Load/save persistent data on mobile targets? #10863

    Mark Sibly
    Keymaster

    IMO, a web/cloud solution is best here, as a user *should* be able to wipe device data the way they can wipe apps if they want, so if you want data to be truly recoverable, it should probably be stored off device, perhaps even on an SD card?

    Are there any android/ios APIs for accessing google drive or icloud?

    in reply to: Tuple experiment and usages #10862

    Mark Sibly
    Keymaster

    I prefer ( ) because other langs use them.

    Examples?

    I’m especially interested in statically typed languages. I’m vaguely aware of how python does tuples, but that doesn’t really have type declarations.

    in reply to: mojo3D – util.Fly() for mobile? #10861

    Mark Sibly
    Keymaster

    pinch/zoom doesn’t quite work in 3d though does it? You want pinch/move which is a bit different, or do you keep pinching over and over to move?

    And how would rotate work? Swipe left/right? Or hold and drag to look? Would be good to learn how swipe works anyway…

    It was be nice to see an example! Any recommendations for android/ios?

    in reply to: mojo3D – util.Fly() for mobile? #10851

    Mark Sibly
    Keymaster

    ok, but I’m lloking for a complete dropin that does pan, tilt(rotation), zoom and rotation.

    Util fly was a 5 minute hack designed to do 3 things: rotate left/right and move forward! So no, it doesn’t do gesture recognition etc.

    I got 2d scale/drag/rotate going quite nicely I think – see touchtest banana – but I haven’t attempted 3d as yet. In fact, I don’t think I’ve even seen any examples – can you describe a bit more clearly what you’re after?

    in reply to: Tuple experiment and usages #10850

    Mark Sibly
    Keymaster

    I have been thinking about tuples a bit lately, and I actually think adding tuples directly to the language itself would not be *that* tricky – well, the syntax side of things anyway.

    Basically, anything in brackets would be a tuple, eg: (1), (10,”Hello”,arseBisuits) etc.

    A single element tuple would be interchangeable with a simple value/expression.

    Tuple types could be declared with brackets, eg: Local result:(Entity,bool), Function Find:(Object,bool)( blah:String ) etc.

    Nested tuples would simply be collapsed/linearized, eg: (10,20,(30,40)) and (10,20,30,40) would have the sample type: (Int,Int,Int,Int).

    Tuple initializers: Local (x,y,z):=(10,”Hello”,.5), Local (x:Int,y:String,z:Float)=(10,”Hello”,.5)

    Tuple assignments: (x,y,z)=(1,2,3), (x,y,z)+=(10,20,30)

    Tuple operators: (x,y,z)+(10,20,30)

    These all seem quite intuitive to me and should be relatively easy to parse, although actual backend implementation etc would be challenging.

    Definitely not gonna happen in the near future, but worth thinking about.

    (Ok, type conflicts with function types (I think) – perhaps <> instead, eg: Local x:<Int,Float>?)

    in reply to: Mserver link no worky! #10833

    Mark Sibly
    Keymaster

    Fixed, thanks.

    in reply to: Structs and reflection #10807

    Mark Sibly
    Keymaster

    This is because Variant.Type only returns the static type of the variant. You’ll need to use InstanceType on the object contained in the variant instead of v.Type, eg:

    Local type:=Cast<Object>( v ).InstanceType

    …safer…

    I now think InstanceType should probably be renamed to DynamicType, and possibly the above DynamicType code added to Variant too which can do it more efficiently.

    Anyway, quick fix for the above: change the Default block to:

    in reply to: Structs and foreach loops #10806

    Mark Sibly
    Keymaster

    Same problem – Current is returning a *copy* of the iterator item. Modifying this copy has no effect.

    Actually, if you just use Vec2’s ‘x’ and ‘y’ fields directly (not ‘X’ and ‘Y’ properties), eg: iter.Current.x=0, you will get a compile time error, because the compiler ‘knows’ you are trying to modify a copy. However, the compiler doesn’t know exactly what X or Y properties do – they may or may not actually modify Self – and I didn’t want to just disallow property/method calls in general on returned copies or subject people to the joys of ‘const correctness’, so it’s a bit of a half-assed check.

    The solution is to get current item, modify it, and then set it back (aka read-modify-write), eg:

    Same applies to Stacks etc.

    However, you don’t need to do this with plain arrays, eg: myarray[i].X=0 will work fine, as an array element is really just a special type of variable (which is why you can Varptr it).

    This means you can in fact do a little hack with stacks where you can set elements directly:

    mystack.Data[i].X=0

    This is because the Data property of Stack returns the underlying array. You do need to be careful ‘i’ is in range though, as array may be longer than Stack!

    in reply to: mojo3D – util.Fly() for mobile? #10805

    Mark Sibly
    Keymaster

    I think you can touch left for rot left, right for rot right, center for move foward.

    in reply to: Declaring fixed-size strings. #10796

    Mark Sibly
    Keymaster

    I recommend using a libc.char_t pointer if you need to provide a fixed sized string or string buffer. A CString may not work, as CStrings should not be modified and are subtly different.

    For example, here’s roughly how monkey2 CurrentDir function wraps the libc getcwd call:

    Not pretty, but that’s c/c++ strings for you. I recommend wrapping ‘messy’ calls like this instead of using them directly, as above.

    I also recommend looking at the libc module and std filesystem for ideas on how to write C API wrappers.

    in reply to: Chipmunk and pointers (revisited) #10795

    Mark Sibly
    Keymaster

    Ok, erm, looks like tomorrow sorry!

    in reply to: Chipmunk and pointers (revisited) #10793

    Mark Sibly
    Keymaster

    I will be pushing the void ptr change (and removing handle_to_object etc) some time today.

    in reply to: Website Problems… #10780

    Mark Sibly
    Keymaster

    this is code this is not this is this ain’t.

    some more

    in reply to: Why I love Monkey (A Bias Point of View) #10779

    Mark Sibly
    Keymaster

    Thank you!

Viewing 15 posts - 436 through 450 (of 1,431 total)