SOXTSPACEBALL(3iv)

πŸ’… NAME πŸ’…

SoXtSpaceball β€” ok bestie, this one translates and reports events for the spaceball ✨


πŸ¦‹ INHERITS FROM πŸ¦‹

SoXtDevice > SoXtSpaceball

(so it's giving legacy, it's giving lineage, it's giving a whole family tree 🌳)


✨ SYNOPSIS ✨

#include <Inventor/Xt/devices/SoXtSpaceball.h>

okay so first up, the enum, and yes you need to know it:

enum Mask {
     SoXtSpaceball::MOTION   Spaceball translation and rotation events
     SoXtSpaceball::PRESS    Spaceball button press events
     SoXtSpaceball::RELEASE  Spaceball button release events
     SoXtSpaceball::ALL      All spaceball events
}

and here's the methods from class SoXtSpaceball, literally all of them:

                    SoXtSpaceball(SoXtSpaceball::Mask mask =
                         SoXtSpaceball::ALL)
                    SoXtSpaceball(Display *d, SoXtSpaceball::Mask mask =
                         SoXtSpaceball::ALL)
                    ~SoXtSpaceball()
void                setRotationScaleFactor(float f)
float               getRotationScaleFactor() const
void                setTranslationScaleFactor(float f)
float               getTranslationScaleFactor() const
static SbBool       exists()
static SbBool       exists(Display *d)

and these ones are inherited from class SoXtDevice β€” they come with the whole vibe:

virtual void             enable(Widget w, XtEventHandler f, XtPointer
                              data, Window win = NULL)
virtual void             disable(Widget w, XtEventHandler f, XtPointer
                              data)
virtual const SoEvent *  translateEvent(XAnyEvent *xevent)
void                     setWindowSize(const SbVec2s &size)
const SbVec2s &          getWindowSize() const

🌸 DESCRIPTION 🌸

This class manages events generated by the spaceball, and yes we're talking spaceball motion (SoMotion3Event) plus spaceball button press and release events (SoSpaceballButtonEvent). it's the whole handler situation, bestie. she handles it. πŸ’…


πŸ”₯ METHODS πŸ”₯

πŸŽ€ constructors & destructor

                    SoXtSpaceball(SoXtSpaceball::Mask mask =
                         SoXtSpaceball::ALL)
                    SoXtSpaceball(Display *d, SoXtSpaceball::Mask mask =
                         SoXtSpaceball::ALL)
                    ~SoXtSpaceball()

Constructor and destructor. what you do is pass to the constructor an enumerated value specifying which spaceball events are of interest β€” that's the mask argument, and she's picky about it. only those events will be reported to the callback routine registered on each widget, no extras, no leftovers, we're being selective 🫢

and the first constructor? it uses the X display which was set in SoXt::init(). so it already knows where home is. iconic behavior honestly.

🌈 rotation scale factor

void                setRotationScaleFactor(float f)
float               getRotationScaleFactor() const

Set and get the rotation scale factor. the scale factor is applied to the rotation value generated by the spaceball device. and the default rotation scale factor is .006. yes, .006. write it down. put it in your notes app. πŸ“

πŸ’œ translation scale factor

void                setTranslationScaleFactor(float f)
float               getTranslationScaleFactor() const

Set and get the translation scale factor. this one gets applied to the translation value generated by the spaceball device. and the default translation scale factor is also .006. twins!! ✨

πŸ¦„ does it even exist though

static SbBool       exists()
static SbBool       exists(Display *d)

This returns TRUE if the spaceball exists, either on the X display which was set in SoXt::init(), or on the passed display. so like… vibe check on the hardware. if she's there, TRUE. if not… 😭


πŸ‘‘ SEE ALSO πŸ‘‘

SoXt, SoXtDevice, SoMotion3Event, SoSpaceballButtonEvent

go read those too, no skipping, I'll know πŸ”


and that's the whole thing bestie, that was SoXtSpaceball(3IV)() β€” stamped and dated and everything, straight from the SoXtSpaceball(3IV) manual page, mwah πŸ’‹ go forth and handle your events βœ¨πŸ’– slay πŸ’–βœ¨