示例#1
0
void AtariIkbd_PumpEvents(_THIS)
{
	int i, specialkeys;
	SDL_keysym keysym;

	/*--- Send keyboard events ---*/

	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
		/* Key pressed ? */
		if (SDL_AtariIkbd_keyboard[i]==KEY_PRESSED) {
			SDL_PrivateKeyboard(SDL_PRESSED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));
			SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED;
		}
			
		/* Key released ? */
		if (SDL_AtariIkbd_keyboard[i]==KEY_RELEASED) {
			SDL_PrivateKeyboard(SDL_RELEASED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
			SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED;
		}
	}

	/*--- Send mouse events ---*/

	/* Mouse motion ? */
	if (SDL_AtariIkbd_mousex || SDL_AtariIkbd_mousey) {
		SDL_PrivateMouseMotion(0, 1, SDL_AtariIkbd_mousex, SDL_AtariIkbd_mousey);
		SDL_AtariIkbd_mousex = SDL_AtariIkbd_mousey = 0;
	}

	/* Mouse button ? */
	if (SDL_AtariIkbd_mouseb != atari_prevmouseb) {
		for (i=0;i<2;i++) {
			int curbutton, prevbutton;

			curbutton = SDL_AtariIkbd_mouseb & (1<<i);
			prevbutton = atari_prevmouseb & (1<<i);

			if (curbutton && !prevbutton) {
				SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
			}
			if (!curbutton && prevbutton) {
				SDL_PrivateMouseButton(SDL_RELEASED, atari_GetButton(i), 0, 0);
			}
		}
		atari_prevmouseb = SDL_AtariIkbd_mouseb;
	}
}
示例#2
0
void AtariBios_PumpEvents(_THIS)
{
	int i;
	SDL_keysym keysym;

	SDL_AtariMint_BackgroundTasks();

	/* Update pressed keys */
	SDL_memset(bios_currentkeyboard, 0, ATARIBIOS_MAXKEYS);

	while (Bconstat(_CON)) {
		unsigned long key_pressed;
		key_pressed=Bconin(_CON);
		bios_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
	}

	/* Read special keys */
	UpdateSpecialKeys(Kbshift(-1));

	/* Now generate events */
	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
		/* Key pressed ? */
		if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
			SDL_PrivateKeyboard(SDL_PRESSED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));
			
		/* Key unpressed ? */
		if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
			SDL_PrivateKeyboard(SDL_RELEASED,
				SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
	}

	if (use_dev_mouse) {
		SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE);
	} else {
		SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
	}

	/* Will be previous table */
	SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, sizeof(bios_previouskeyboard));
}
void AtariBios_PumpEvents(_THIS)
{
    int i;
    SDL_keysym keysym;


    SDL_memset(bios_currentkeyboard, 0, ATARIBIOS_MAXKEYS);

    while (Bconstat(_CON)) {
        unsigned long key_pressed;
        key_pressed=Bconin(_CON);
        bios_currentkeyboard[(key_pressed>>16)&(ATARIBIOS_MAXKEYS-1)]=0xFF;
    }


    UpdateSpecialKeys(Kbshift(-1));


    for (i=0; i<ATARIBIOS_MAXKEYS; i++) {

        if (bios_currentkeyboard[i] && !bios_previouskeyboard[i])
            SDL_PrivateKeyboard(SDL_PRESSED,
                                SDL_Atari_TranslateKey(i, &keysym, SDL_TRUE));


        if (bios_previouskeyboard[i] && !bios_currentkeyboard[i])
            SDL_PrivateKeyboard(SDL_RELEASED,
                                SDL_Atari_TranslateKey(i, &keysym, SDL_FALSE));
    }

    if (use_dev_mouse) {
        SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE);
    } else {
        SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
    }


    SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, sizeof(bios_previouskeyboard));
}