Пример #1
0
void amstrad_mouse_poll(int x, int y, int b)
{
        mousex += x;
        mousey -= y;

        if ((b & 1) && !(oldb & 1))
           keyboard_send(0x7e);
        if ((b & 2) && !(oldb & 2))
           keyboard_send(0x7d);
        if (!(b & 1) && (oldb & 1))
           keyboard_send(0xfe);
        if (!(b & 2) && (oldb & 2))
           keyboard_send(0xfd);
        
        oldb = b;
}
Пример #2
0
void pc_keyboard_send(uint8_t val)
{
    if (AT)
    {
        keyboard_at_adddata_keyboard_raw(val);
    }
    else
    {
        keyboard_send(val);
    }
}
Пример #3
0
static uint8_t mouse_amstrad_poll(int x, int y, int z, int b, void *p)
{
        mouse_amstrad_t *mouse = (mouse_amstrad_t *)p;
        
        mousex += x;
        mousey -= y;

        if ((b & 1) && !(mouse->oldb & 1))
                keyboard_send(0x7e);
        if ((b & 2) && !(mouse->oldb & 2))
                keyboard_send(0x7d);
        if (!(b & 1) && (mouse->oldb & 1))
                keyboard_send(0xfe);
        if (!(b & 2) && (mouse->oldb & 2))
                keyboard_send(0xfd);
        
        mouse->oldb = b;

	return(0);
}
Пример #4
0
void pollKeyboard(void)
{
	KeyboardEvent e;
    
	// controller ranges:
	const int chan_begin= 0, chan_end= 7;
	const int chana_begin= 16, chana_end= 23;

	while(keyboard_poll(&e)) 
	{

		
		printf("%d %d %d\n", e.x, e.y, e.type);
//		fflush(stdout);
		
		if(e.type>>4 == 0x0b)	// control change
		{
			if( (e.x>=chan_begin) && (e.x<=chan_end) )
				chan[e.x-chan_begin]= e.y;
			else if( (e.x>=chana_begin) && (e.x<=chana_end) )
				chana[e.x-chana_begin]= e.y;
			else if((e.x >= 32)&&(e.x <= 39)&&(e.y == 127))
			{
		
				if(e.x < 32+animationcount)
				{
					for(uint8_t i = 32;i <= 39;i++)
					{
						keyboard_send(176,i,0);
					}
					for(uint8_t i = 48;i <= 55;i++)
					{
						keyboard_send(176,i,0);
					}
					for(uint8_t i = 64;i <= 71;i++)
					{
						keyboard_send(176,i,0);
					}
					keyboard_send(176,e.x,127);
				}
				
				
				button(e.x-32);
			}
			else if((e.x >= 48)&&(e.x <= 55)&&(e.y == 127))
			{
		
				if(e.x < 40+animationcount)
				{
					for(uint8_t i = 32;i <= 39;i++)
					{
						keyboard_send(176,i,0);
					}
					for(uint8_t i = 48;i <= 55;i++)
					{
						keyboard_send(176,i,0);
					}
					for(uint8_t i = 64;i <= 71;i++)
					{
						keyboard_send(176,i,0);
					}
					keyboard_send(176,e.x,127);
				}
				
				
				button(e.x-40);
			}
			else if((e.x >= 64)&&(e.x <= 71)&&(e.y == 127))
			{
		
				if(e.x < 48+animationcount)
				{
					for(uint8_t i = 32;i <= 39;i++)
					{
						keyboard_send(176,i,0);
					}
					for(uint8_t i = 48;i <= 55;i++)
					{
						keyboard_send(176,i,0);
					}
					for(uint8_t i = 64;i <= 71;i++)
					{
						keyboard_send(176,i,0);
					}
					keyboard_send(176,e.x,127);
				}
				
				
				button(e.x-48);
			}
		}
	}
}
Пример #5
0
void * captureKeyboard(){
	while( stopRecording == 0){
		keyboard_send();
	}
	pthread_exit(NULL);
}