Mark Sibly

Forum Replies Created

Viewing 15 posts - 346 through 360 (of 1,431 total)
  • Author
    Posts
  • in reply to: Help wanted with mojo joystick code! #11580

    Mark Sibly
    Keymaster

    No problem, I was also very interested in how well my code worked as so far it’s only had a 50% success rate!

    Up to 75% now so I feel a bit better…

    in reply to: Help wanted with mojo joystick code! #11576

    Mark Sibly
    Keymaster

    In this case I have this in my App class: App.SdlEventFilter = MySdlEventFilter , and then

    This is weird because the latest code doesn’t use events at all!

    Well, nearly, I still grab jevent->which for debugging, so jevent better never be NULL.

    So some things to try: Remove ALL code from event handlers in joystick.monkey2. Check if other apps crash when joysticks are added/removed – maybe it’s an SDL event thing. Comment out stuff until it works. Stick some print statements around SDL calls – there shouldn’t be many of them left. You could also build a debug version and use gdb to debug it, but you’d have to tweak env_windows.txt a bit…Let me know if you want to try this.

    I think the approach I’m using is good – in fact, latest SDL 2.0.7 adds a function that will make it even easier.

    You could actually try latest SDL if you want, there are quite a few changes to joystick so they may have fixed something. Grab SDL 2.0.7 source from here: https://www.libsdl.org/download-2.0.php and copy the ‘include’ and ‘src’ dirs into the current sdl2/SDL dir, overwriting existing dirs (backup or whatever first!). Then, copy all the SDL_config_blah.h files from current include dir (ie: from your backup) to the new 2.0.7 include dir. Tried this yesterday and it seemed to work fine on windows, joystick and ted2go worked anyway. Much more testing to do before I can ‘officially’ upgrade sdl2 though.

    After around 100 plug-unplug of two different gamepads I had no crash…

    Thanks for super comprehensive test! I’ve also had SDL fail to register plugins a few times, but it never seems to cause any problems. Still, perhaps indicative of something bad going on in SDL, as I still get the ‘ping’ when it’s plugged in…but SDL misses it.

    Tried with a XBox360 pad and a Pandora gamepad no crashes to report 🙂

    Thanks!

    in reply to: [SOLVED] Can't install Monkey 2 on Windows 10 #11549

    Mark Sibly
    Keymaster

    (note to self: don’t edit posts by going back->edit->submit!)

    in reply to: [SOLVED] Can't install Monkey 2 on Windows 10 #11546

    Mark Sibly
    Keymaster

    It should be very easy to build from source on llnux – as long as you have also installed the myriad of dev-lib dependancies required on Linux. And you’ll need these for building monkey2 apps as well as monkey2 itself, so hosting a prebuilt version on Linux is of very little value.

    On Windows and Macos this stuff is easy – all required dependancies are built-in to the c++ compilers used by monkey2.

    However, on Linux installing g++ is just the start, you’ll also need to install things like the dev libs for x, opengl, and a ton of other obscure stuff depedending on what actual version of linux you’re using.

    I would love to make monkey2 easier to use on Linux, but making it ‘apt-gettable’ or something would be a huge undertaking for me, given my limited knowledge of the relevant linux stuff, and I just can’t justify the time/effort/pain involved as the audience for Linux seems to be tiny to non-existant?

    The nice thing is that once you do have it running on Linux, it’s pretty sweet (but I would say that)!

    in reply to: Chipmunk 'speed' #11543

    Mark Sibly
    Keymaster

    No idea –  perhaps try asking on the chipmunk forums?

    https://chipmunk-physics.net/forum/viewforum.php?f=1

    in reply to: ScanCodeToRawKey #11535

    Mark Sibly
    Keymaster

    Just using like the function above. Couldn’t think of a better way to check for “Any Key” being pressed.

    You don’t need to pass rawkeys to KeyDown, you can just pass a plain ‘virtual’ key, eg: ‘Key.A’ or ‘Key.Z’ etc.

    But to pass an int ‘key’ to KeyDown you’ll need to convert it to a ‘Key’ type first – in fact, this is probably all your use of ScanCodeToRawKey is really achieving here – In this case, it doesn’t really matter whether you pass virtual keys or rawkeys or banana keys to KeyDown, since you’re just throwing every possible value at it!

    To convert an int to a key, you can ‘Cast<Key>( n )’ it – example below. But as people have noted there are other ways to do this too.

    in reply to: Apply shader to group or layer of objects #11534

    Mark Sibly
    Keymaster

    I did have a look into this andit’s doable but a bit complicated to make ‘nice’.

    Just to clarify though, are you only wanting to apply a shader to a bunch of shapes? This is easier…

    in reply to: ScanCodeToRawKey #11527

    Mark Sibly
    Keymaster

    ScanCodeToRawKey is an internal function – it has been @hidden from docs, and should therefore be considered ‘use art your own risk’.

    I’ve had to make it public in the past as monkey2 lacked an ‘Internal’ directive, ie: decls are visible to other module members only. But that has recently been added to monkey so I have made several methods/functions Internal.

    What are you actually using it for?

    in reply to: Monkey2 Bunnymark (github) #11509

    Mark Sibly
    Keymaster

    Hmm, can’t find an Image.Window, do you perhaps mean Pixmap.Window?

    It might have been more consistent if I’d used Image.Window, but the idea was for New Image( image,rect…) etc. to create a ‘window’ into an atlas that shares the same ‘material’ (ie: texture) as the atlas, thus minimizing renderstate changes.

    But I messed up here, and each image created with New Image( image,rect… ) actually ended up with a new ‘material’ too, which caused a renderstate change for each DrawImage. Pretty easily fixed, although there’a a minor chance it may affect some existing code out there – will deal with that if/when it happens.

    in reply to: Monkey2 Bunnymark (github) #11505

    Mark Sibly
    Keymaster

    Yay, decided to do my own bunnymark based on ethernaut’s and found a pretty major issue in mojo!

    You’re supposed to be able to use images as atlases in mojo, and New Image( image,x,y,w,h ) is supposed to ‘grab’ a frame from an atlas.

    This works BUT currently also creates a new material for the frame instead of just sharing the same material as the atlas – so my version was initially slower than ethernaut’s by a large margin! Fixing this so that all images created from other images ‘share’ the same material gives a considerable speed up – was getting about 50K images @60hz with ethernaut’s version, now get about 180K with mine!

    Will push this change to the repos soon.

    My bunnymark (works but will be slow with current mx2):

    in reply to: Flagged by BitDefender #11503

    Mark Sibly
    Keymaster

    I have never had any reports of a ‘true’ positive so I’m 99.999% sure you’re OK.

    in reply to: PlayMusic PlayheadSample, PlayheadTime ? #11502

    Mark Sibly
    Keymaster

    Should be possible, I will look into it.

    in reply to: One more Extension example #11501

    Mark Sibly
    Keymaster

    But how does user ‘know’ they are using an extension and it’s safe to skip ‘?.’?

    If there’s a possiblility an object could be Null, coder should always use ?. or check for null IMO, regardless of whether  member is an extension or not. Extensions should behave as much like ‘normal’ methods as possible.

    Making a special case for extensions just complicates the language more. My current thinking anyway…

    in reply to: One more Extension example #11487

    Mark Sibly
    Keymaster

    Self can be null inside of extension.

    I never really considered this, not sure if I like it or not!

    [edit] Don’t think I do like it, esp now there’s ‘?.’ – please don’t depend on it in future.

    in reply to: Printing to the Ted2 console #11480

    Mark Sibly
    Keymaster

    Yes, this issue has been in there for ages and I should probably get round to doing something about it one of these days, just not quite sure what exactly!

Viewing 15 posts - 346 through 360 (of 1,431 total)