#include <Vrui/Application.h>
#include <GL/GLObject.h>
#include <Vrui/Vrui.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
class MagicSand : public Vrui::Application, public GLObject
{
public:
MagicSand(int & argc, char ** argv)
:Vrui::Application(argc, argv)
{
}
~MagicSand()
{
}
public:
virtual void initContext(GLContextData & contextData) const
{
}
virtual void display(GLContextData & contextData) const
{
}
static void EventProcess(XEvent & event)
{
switch (event.type)
{
case KeyPress:
{
KeySym keySym;
XKeyEvent keyEvent=event.xkey;
keySym=XLookupKeysym(&keyEvent,0);
if (keySym == XK_0)
{
std::cout << "0" << std::endl;
}
else if (keySym == XK_1)
{
std::cout << "1" << std::endl;
}
break;
}
case KeyRelease:
break;
default:
break;
}
}
void run(void)
{
setFrameFunction(frameWrapper,this);
setDisplayFunction(displayWrapper,this);
setSoundFunction(soundWrapper,this);
Vrui::mainLoop(EventProcess);
}
};
VRUI_APPLICATION_RUN(MagicSand)