コード例 #1
0
ファイル: main.c プロジェクト: andybest/bitbox
void game_frame()
{
    kbd_emulate_gamepad ();

    if (GAMEPAD_PRESSED(0,up) && y>-240) y--;
    if (GAMEPAD_PRESSED(0,down) && y<240) y++;
    if (GAMEPAD_PRESSED(0,left) && x>-320) x--;
    if (GAMEPAD_PRESSED(0,right) && x<320) x++;

    if (gamepad_buttons[0]) {
    	snd_vol=32;
    } else {
    	if (snd_vol) 
    		snd_vol--;
    }
} 
コード例 #2
0
ファイル: main.c プロジェクト: lowagner/bitbox-modes
void game_frame()
{
    kbd_emulate_gamepad();
}
コード例 #3
0
ファイル: emulator.c プロジェクト: lowagner/bitbox
int main ( int argc, char** argv )
{

    for (int i=1;i<argc;i++) {
        if (!strcmp(argv[i],"--fullscreen"))
            fullscreen = 1;
        else if (!strcmp(argv[i],"--slow"))
            slow = 1;
        else if (!strcmp(argv[i],"--verbose"))
            quiet = 0;
        else if (!strcmp(argv[i],"--scale2x"))
            scale = 2;
        else {
            instructions();
            exit(0);
        }
    }

    // display current options
    if (!quiet) {
        printf("Options : %s %s scale : %d\n",fullscreen?"fullscreen":"windowed",slow?"slow":"normal speed",scale);
        instructions();
        printf(" - Starting\n");
    }

    gamepad_buttons[0] = 0; // all up
    gamepad_buttons[1] = 0;

    if (init()) return 1;
    game_init();

    // now start sound
    SDL_PauseAudio(0);

    // program main loop
    bool done = false;
    while (!done)
    {

        // message processing loop
        done = handle_events();
        kbd_emulate_gamepad();
        // update game
        game_frame();

        // update time
        vga_frame++;
        
        #if VGA_MODE!=NONE
        refresh_screen(screen);
        #endif

        SDL_Delay(time_left());
        next_time += slow ? TICK_INTERVAL*10:TICK_INTERVAL;

        SDL_Flip(screen);
    } // end main loop

    // all is well ;)
    if (!quiet)
        printf(" - Exited cleanly\n");
    return 0;
}
コード例 #4
0
ファイル: usbh_hid_keybd.c プロジェクト: lowagner/bitbox
/* boot keyboard report  : 
        u8 modifier (LCtrl =1, LShift=2, LAlt=4, LWin - Rctrl, ... )
        u8 reserved
        8u codes[6] of pressed keys
*/
static void KEYBRD_Decode(uint8_t coreID, uint8_t *pbuf)
{
    keyboard_mod[coreID]=pbuf[0];
    memcpy((char *)keyboard_key[coreID],pbuf+2,KBR_MAX_NBR_PRESSED);
    kbd_emulate_gamepad();
}