Mark Sibly

Forum Replies Created

Viewing 15 posts - 1,141 through 1,155 (of 1,431 total)
  • Author
    Posts
  • in reply to: you can't have a field in an extend of 'external extends void' #4020

    Mark Sibly
    Keymaster

    Just passing canvas as a plain parameter would be the safest/cleanest if this is possible.

    It’s kind of hard to suggest the best approach without knowing more about your code – if you’ve got something that works probably best to just stick with it for now until you have more to show/share.

    in reply to: you can't have a field in an extend of 'external extends void' #4014

    Mark Sibly
    Keymaster

    My aim is to pass the canvas passed to OnRender to my box2D debugdraw.

    The safest way would be to pass it as a parameter if possible.

    Failing that, a canvas ptr will work as long as you stick the canvas somewhere the gc can see it, eg: in a monkey2 global. Then, c++ code can safely use the pointer as long as you don’t modify the global, as the gc will be keeping the global alive. If that’s what you’re doing, it’s not a bad solution.

    The OnRender canvas will indeed probably ‘survive’ at least one pass through OnRender without you having to do anything tricky (right now it’ll probably survive for as long as the window) but I can’t guarantee that’ll be true forever.

    in reply to: how to get an extern class that extends bbObject and not void? #4012

    Mark Sibly
    Keymaster

    The c++ class must actually extend bbObject, eg:

    in reply to: XML module #4010

    Mark Sibly
    Keymaster

    Have you got a small test program for the Linq stuff?

    in reply to: you can't have a field in an extend of 'external extends void' #4008

    Mark Sibly
    Keymaster

    I’ll fix the compiler error, but the main problem here is you shouldn’t really store GCable objects (like MiniFoo) in non-GCable objects (like Foo or any subclass) as Foo’s fields will not be garbage collected (since Foo isn’t) and MiniFoo will eventually be GCd unless you have somehow made sure it’s kept alive elsewhere. I think this should be prohibited altogether.

    Using a Ptr – or even a Ptr to a struct that contains a MiniFoo – wont help because MiniFoo still wont be found by the GC.

    If you really need to do this, the safest way is probably via an int handle, and an IntMap<MiniFoo> somewhere that assocates handles with objects.

    in reply to: XML module #3989

    Mark Sibly
    Keymaster

    The module builds but I’m getting pretty much empty .cpp source files in my windows_debug folder and if I try to use any of the extension methods I get “undefined reference” errors.

    Are you using the latest mx2cc? Extensions are undergoing ongoing maintenance…

    If you are, can you reproduce with a simple example?

    in reply to: XML module #3966

    Mark Sibly
    Keymaster

    I’ve made a pretty good start on tinyxml2, but the more the merrier! Wish people would staring using that module manager thingy though…

    Anyway, I’m more of a JSON guy myself, but is this pretty much what you need from an xml module?

    …which produces…

    in reply to: XML module #3964

    Mark Sibly
    Keymaster

    tinyxml2 looks very tidy…

    http://www.grinninglizard.com/tinyxml2/

    The mx2 API would probably look something like:

    There’s more methods, but that’s the jist of it, just yer basic tree. Is that the sort of thing you’re after?

    in reply to: network/socket/tcp read/write class ? #3959

    Mark Sibly
    Keymaster

    Just commited the ‘official’ std.socket.Socket and std.socket.SockerServer classes.

    Very similar to Si’s work except:

    • Only Read( ptr,count) and Write( ptr,count ) IO supported for now. Socket extends Stream so the intent is to add ReadString/WriteString etc to Stream.
    •  If called from a fiber, socket ops including connect, listen, accept, close, read and write are performed on a thread while the fiber suspends itself, ie: they wont lockup the gui. Lots of room for improvement in the implementation here (and there are vsync issues), but it makes client/server stuff about 10000 easier to write than in mx1 (see new echoserver banana).
    • Only ‘stream’ sockets for now. Connection oriented datagrams should be very easy to add, connection-less will require more work, but are these even used any more? I think something WebSocket-ish (ie: a message/reply based protocol) should be next up!
    • Should be completely ipv6 friendly.

    Basically, it’s a WIP first attempt. The ‘new’ ipv6 friendly way to do sockets is much nicer to work with though.

    in reply to: network/socket/tcp read/write class ? #3951

    Mark Sibly
    Keymaster

    ipv6 socket support for mx1 has just reared it’s ugly head again, so I think I’ll get stuck into this right now!

    in reply to: Bug or not for struct Extension #3910

    Mark Sibly
    Keymaster

    It’s working here as long as I ‘./updatemx2cc.sh’ and ‘./rebuildall.sh’ after that.

    Perhaps best to wait until the next binaries update – I’ll do one today.

    in reply to: a bug, a bug, a bug?(solved) #3909

    Mark Sibly
    Keymaster

    …also running OS X El Capitan 10.11.6

    in reply to: a bug, a bug, a bug?(solved) #3908

    Mark Sibly
    Keymaster

    Just did a clean install from github-master.zip and it works fine as long as I do ‘./updatemx2cc.sh’.

    However, the error message I get when it does crap out is slightly different, so perhaps it’s a compiler version problem. Here’s my g++ –version info:

    Please post yours.

    The error I get is:

    in reply to: a bug, a bug, a bug?(solved) #3886

    Mark Sibly
    Keymaster

    > so it could probably be with my computer only.

    It’s incredibly unlikely to be that.

    What’s probably happened is that the version I committed wasn’t working 100%, while the version here on my machine is. Unfortunately, I wont be commiting the latest just yet as there are lots of changes that need testing first.

    So don’t panic, we’ll get it sorted soon!

    in reply to: Bug or not for struct Extension #3883

    Mark Sibly
    Keymaster

    Fixed! Needs more testing but I think it’s doable – take that c#!

Viewing 15 posts - 1,141 through 1,155 (of 1,431 total)