Exemple #1
0
void AtariGemdos_PumpEvents(_THIS)
{
	int i;
	SDL_keysym keysym;

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

	while (Cconis()!=DEV_BUSY) {
		unsigned long key_pressed;
		unsigned char scancode, asciicode;

		key_pressed=Cnecin();

		asciicode = key_pressed;
		scancode = key_pressed >> 16;

		gemdos_currentkeyboard[scancode]=0xFF;
		gemdos_currentascii[scancode]=asciicode;
	}

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

	/* Now generate events */
	for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
		/* Key pressed ? */
		if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i])
			SDL_PrivateKeyboard(SDL_PRESSED,
				TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_TRUE));
			
		/* Key unpressed ? */
		if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i])
			SDL_PrivateKeyboard(SDL_RELEASED,
				TranslateKey(i, gemdos_currentascii[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(gemdos_previouskeyboard, gemdos_currentkeyboard, ATARIBIOS_MAXKEYS);
}
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));
}