Ejemplo n.º 1
0
void handleScreenEvent(bps_event_t *event)
{
    screen_event_t screen_event = screen_event_get_event(event);
	mtouch_event_t mtouch_event;
    int screen_val;
    int position[2];
    int rc;

    screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val);

    switch (screen_val)
    {
		case SCREEN_EVENT_MTOUCH_TOUCH:
		case SCREEN_EVENT_MTOUCH_MOVE:
		case SCREEN_EVENT_MTOUCH_RELEASE:
            rc = screen_get_mtouch_event(screen_event, &mtouch_event, 0);
            if (rc)
                fprintf(stderr, "Error: failed to get mtouch event\n");

            rc = gestures_set_process_event(set, &mtouch_event, NULL);

            // No gesture detected, pass through
            if (!rc)
            {
            	if (screen_val == SCREEN_EVENT_MTOUCH_TOUCH)
            		MouseDown(mtouch_event.x, mtouch_event.y);
            	else if (screen_val == SCREEN_EVENT_MTOUCH_MOVE)
            		test->MouseMove(ConvertScreenToWorld(mtouch_event.x, mtouch_event.y));
            	else
            		test->MouseUp(ConvertScreenToWorld(mtouch_event.x, mtouch_event.y));
            }

			break;

		case SCREEN_EVENT_KEYBOARD:
			screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_FLAGS, &screen_val);

			if (screen_val & KEY_DOWN)
			{
				screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SYM, &screen_val);

				if (screen_val >= ' ' && screen_val < '~')
				{
					Keyboard(screen_val, 0, 0);
				}
				else
				{
					screen_val = screen_val - 0xf000;
					Keyboard(screen_val, 0, 0);
				}
			}

			break;
    }
}
Ejemplo n.º 2
0
// DrawScene()
void DrawScene ()
{
	dFloat timeStep;

	// get the time step
	timeStep = timer.GetElapsedSeconds();

	// updtate the Newton physics world
	NewtonUpdate (nWorld, timeStep);

	// read the keyboard
	Keyboard ();


	// move the camera
	dVector target (cameraEyepoint + cameraDir);
	SetCamera (cameraEyepoint, target);

	// render the scene
	GraphicManager::Iterator iter (GraphicManager::GetManager());
	for (iter.Begin(); iter; iter ++) {
		glPushMatrix();
		iter.GetNode()->GetInfo()->Render();
		glPopMatrix();
	}
} 
Ejemplo n.º 3
0
/*
================
idUsercmdGenLocal::UsercmdInterrupt

Called asyncronously
================
*/
void idUsercmdGenLocal::UsercmdInterrupt( void ) {
	// dedicated servers won't create usercmds
	if ( !initialized ) {
		return;
	}

	// init the usercmd for com_ticNumber+1
	InitCurrent();

	// process the system mouse events
	Mouse();

	// process the system keyboard events
	Keyboard();

	// process the system joystick events
	Joystick();

	// create the usercmd for com_ticNumber+1
	MakeCurrent();

	// save a number for debugging cmdDemos and networking
	cmd.sequence = com_ticNumber+1;

	buffered[(com_ticNumber+1) & (MAX_BUFFERED_USERCMD-1)] = cmd;
}
Ejemplo n.º 4
0
// Maps special keys to normals key presses for simplicity.
void Special(int key, int x, int y)
{
  switch (key)
  {
    case GLUT_KEY_UP:
      Keyboard('w', x, y);
      break;
    case GLUT_KEY_DOWN:
      Keyboard('s', x, y);
      break;
    case GLUT_KEY_LEFT:
      Keyboard('a', x, y);
      break;
    case GLUT_KEY_RIGHT:
      Keyboard('d', x, y);
      break; 
  }
}
Ejemplo n.º 5
0
/********************************************************************
 * Function:        void ProcessIO(void)
 *	
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        This function is a place holder for other user
 *                  routines. It is a mixture of both USB and
 *                  non-USB tasks.
 *
 * Note:            None
 *******************************************************************/
void ProcessIO(void)
{   
    //Blink the LEDs according to the USB device status
    BlinkUSBStatus();

    // User Application USB tasks
    if((USBDeviceState < CONFIGURED_STATE)||(USBSuspendControl==1)) return;

   Keyboard();        
    //Call the function that behaves like a keyboard   
}//end ProcessIO
Ejemplo n.º 6
0
/********************************************************************
 * Function:		void ProcessIO(void)
 *******************************************************************/
void ProcessIO(void)
{	
	// User Application USB tasks
	if((USBDeviceState < CONFIGURED_STATE)||(USBSuspendControl==1)) return;

	// キースキャン
	KeyScan();
	
	//Call the function that behaves like a keyboard  
	Keyboard();
	 
}//end ProcessIO
Ejemplo n.º 7
0
	void update(float time)
	{
		Keyboard();

        Animation(time);

		if (STATE==climb) if (!onLadder) STATE=stay;
        if (STATE!=climb) dy+=0.0005*time;
        onLadder=false;

		x+=dx*time;
		Collision(0);

		y+=dy*time;
		Collision(1);
	}
Ejemplo n.º 8
0
int main(int argc, char **argv)
{
    PoleaxeManager = Manager(new manager());
    Alleg::Init();
    Mouse m = Mouse(new mouse());
    Keyboard k = Keyboard(new keyboard());
	Display disp = Display(new display());
	Timer t = Timer(new timer());
	disp->SetDisplayMode(840, 525, 32);
	Window w = Window(new window("test window", 10, 10, 300, 200, 0));
	PoleaxeManager->AddWindow(w);
	disp->SetBackground("background.bmp");
	w->Draw();
	PoleaxeManager->MessageLoop();
	return 0;
}
Ejemplo n.º 9
0
/*
================
idUsercmdGenLocal::GetDirectUsercmd
================
*/
usercmd_t idUsercmdGenLocal::GetDirectUsercmd( void ) {

	// initialize current usercmd
	InitCurrent();

	// process the system mouse events
	Mouse();

	// process the system keyboard events
	Keyboard();

	// process the system joystick events
	Joystick();

	// create the usercmd
	MakeCurrent();

	cmd.duplicateCount = 0;

	return cmd;
}
Ejemplo n.º 10
0
void ProcessIO(void) {
  // Blink the LEDs according to the USB device status
  // However, the LEDs are also used temporarily for showing the Num Lock
  // keyboard LED status.  If the host sends an LED state update interrupt
  // out report, or sends it by a SET_REPORT control transfer, then
  // the demo board LEDs are temporarily taken over to show the Num Lock
  // LED state info.  After a countdown timout, the firmware will switch
  // back to showing the USB state on the LEDs, instead of the num lock status.
  if (g_blink_status_valid == TRUE) {
    BlinkUSBStatus();
  } else {
    g_usb_led_timer--;
    if (g_usb_led_timer == 0) {
      g_blink_status_valid = TRUE;
    }
  }

  // User Application USB tasks
  if ((USBDeviceState < CONFIGURED_STATE) || (USBSuspendControl == 1))
    return;

  // Call the function that behaves like a keyboard
  Keyboard();
}
Ejemplo n.º 11
0
Keyboard Manager::keyboard() const {
	return Keyboard();
}
Ejemplo n.º 12
0
void SpecialFunc(int key, int x, int y)
{
    Keyboard(key+128,x,y);
}
Ejemplo n.º 13
0
HID::HID( HWND p_hwnd )
{
	m_keyboard		= Keyboard( p_hwnd );
	m_mouse			= Mouse( p_hwnd );
	m_observable	= HIDObservable();
}
Ejemplo n.º 14
0
LRESULT CALLBACK
WinProc(HWND   hWnd,   /* I - Window triggering this event */
        UINT   uMsg,   /* I - Message type */
        WPARAM wParam, /* I - 'word' parameter value */
        LPARAM lParam) /* I - 'long' parameter value */
    {
    PAINTSTRUCT ps;    /* WM_PAINT message info */
    RECT        rect;  /* Current client area rectangle */


    switch (uMsg)
        {
        case WM_CREATE :
            /*
             * 'Create' message.  Get device and rendering contexts, and 
	     * setup the client area for OpenGL drawing...
	     */

            DC = GetDC(hWnd);
	    SetupContext();
	    break;

        case WM_SIZE :
            /*
	     * Handle resizes...
	     */

            GetClientRect(hWnd, &rect);
	    Resize(rect.right, rect.bottom);

        case WM_PAINT :
            /*
             * Repaint the client area...
	     */

            BeginPaint(hWnd, &ps);
	    Redraw();
	    EndPaint(hWnd, &ps);
	    break;

        case WM_QUIT :
        case WM_CLOSE :
            /*
             * Destroy the window and exit...
             */

            DestroyWindow(Window);
            exit(0);
            break;

        case WM_DESTROY :
            /*
             * Release and free the device context, rendering
             * context, and color palette...
	     */

            if (RC)
    	        wglDeleteContext(RC);

            if (DC)
    	        ReleaseDC(Window, DC);

	    if (Palette)
	        DeleteObject(Palette);

            PostQuitMessage(0);
            break;

        case WM_QUERYNEWPALETTE :
            /*
             * Realize the color palette if necessary...
	     */

            if (Palette)
	        {
                SelectPalette(DC, Palette, FALSE);
                RealizePalette(DC);

                InvalidateRect(hWnd, NULL, FALSE);
	        return (TRUE);
	        }
            break;

        case WM_PALETTECHANGED:
            /*
             * Reselect our color palette if necessary...
	     */

            if (Palette && (HWND)wParam != hWnd)
	        {
                SelectPalette(DC, Palette, FALSE);
                RealizePalette(DC);

                UpdateColors(DC);
	        }
	    break;

        case WM_CHAR :
	    /*
	     * Handle key presses...
	     */

	    Keyboard((unsigned char)wParam, 0, 0);
	    break;

        default :
            /*
             * Pass all other messages through the default window
             * procedure...
             */

            return (DefWindowProc(hWnd, uMsg, wParam, lParam));
        }

    return (FALSE);
    }
Ejemplo n.º 15
0
//main menu
//@param[in] id :main ID
void OnMainMenu(int id)
{
	Keyboard((unsigned char)id,0,0);
}
Ejemplo n.º 16
0
}

Keyboard::~Keyboard() noexcept(false)
{
    
}

bool Keyboard::isKeyDown(Key k) const
{
    auto ptr = lock();
    if(ptr)
        return ptr->isKeyDown(k);
    return false;
}

Keyboard Keyboard::Null = Keyboard ( nullptr );

// ---------------------------------------------------------------------------------------------------

KeyboardLoader::KeyboardLoader()
{
    
}

KeyboardLoader::~KeyboardLoader() noexcept(false)
{
    
}

KeyboardHolder KeyboardLoader::load(const std::string &name) const
{
Ejemplo n.º 17
0
#define HEIGHT 30

#define BLOCKPIXSIZE 20
#define BLOCKSIZE 5
#define BLOCKNUM 9

#define MASK 0x80000000
#define CODE 0x80000000
#define CODE2 0x40000000

#define RANDI 60
#define QRANDI 100
#define PRERAND 3

Display display = Display((WIDTH+BLOCKSIZE*2)*BLOCKPIXSIZE,(HEIGHT)*BLOCKPIXSIZE,"Pentrix");
Keyboard keyboard = Keyboard();
Sound sound = Sound();



char DEBUGMSG2[128];
char TEXT[128];
int score= 0;
int hscore=0;




int blockx = 0;
int blocky = 0;
int blockt = 0;
Ejemplo n.º 18
0
Keyboard Input::keyboard()
{
        return Keyboard(_keyStates);
}