neosplash(){ disp_off(); cls(); load_palette(16,neosprpal,1); load_vram(0x5000,neospr,0x400); load_palette(0,badge1pal,1); set_tile_data(neotiles); load_tile(0x1000); for(j=0;j<14;j++){ for(i=0;i<14;i++){ put_tile(j*14+i,i+1,j); } } for(i=0;i<8;i++){ spr_set(i); spr_pal(0); spr_pri(1); spr_ctrl(SIZE_MAS,SZ_32x16); spr_pattern(0x5000+0x80*i); spr_y(224-24); spr_x(i*32); } disp_on(); t=0; for(;;){ t++; vsync(); joy0=joy(0); satb_update(); if(joy0&JOY_STRT){ break; } if(t>144)break; } psgPlay(0); disp_off(); for(i=0;i<8;i++){ spr_set(i); spr_hide(); } satb_update(); cls(); set_color(0,0); set_color(256,0); disp_on(); while(joy0&JOY_STRT){ vsync(); joy0=joy(0); } }
Q_DECL_EXPORT #endif int main(int argc, char *argv[]) { #if defined(Q_OS_LINUX) && !defined(MAEMO) QApplication::setAttribute(Qt::AA_X11InitThreads, true); #endif QApplication a(argc, argv); QSize res = QApplication::desktop()->screenGeometry().size(); if (res.width() < res.height()) res.transpose(); pixel_xres = res.width(); pixel_yres = res.height(); g_dpi_scale = CalculateDPIScale(); dp_xres = (int)(pixel_xres * g_dpi_scale); dp_yres = (int)(pixel_yres * g_dpi_scale); net::Init(); #ifdef __SYMBIAN32__ const char *savegame_dir = "E:/PPSSPP/"; const char *assets_dir = "E:/PPSSPP/"; #elif defined(BLACKBERRY) const char *savegame_dir = "/accounts/1000/shared/misc/"; const char *assets_dir = "app/native/assets/"; #elif defined(MEEGO_EDITION_HARMATTAN) || defined(MAEMO) const char *savegame_dir = "/home/user/MyDocs/PPSSPP/"; const char *assets_dir = "/opt/PPSSPP/"; #else const char *savegame_dir = "./"; const char *assets_dir = "./"; #endif NativeInit(argc, (const char **)argv, savegame_dir, assets_dir, "BADCOFFEE"); #ifdef USING_GLES2 emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif #ifdef __SYMBIAN32__ // Set RunFast hardware mode for VFPv2. User::SetFloatingPointMode(EFpModeRunFast); // Disable screensaver QScopedPointer<QSystemScreenSaver> ssObject(new QSystemScreenSaver(emugl)); ssObject->setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #endif QScopedPointer<QThread> thread(new QThread); QScopedPointer<MainAudio> audio(new MainAudio()); audio->moveToThread(thread.data()); QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run())); thread->start(); #ifdef QT_HAS_SDL SDLJoystick joy(true); joy.startEventLoop(); #endif int ret = a.exec(); thread->quit(); NativeShutdown(); net::Shutdown(); return ret; }
static int mainInternal(QApplication &a) { #ifdef USING_GLES2 emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif #ifdef __SYMBIAN32__ // Set RunFast hardware mode for VFPv2. User::SetFloatingPointMode(EFpModeRunFast); // Disable screensaver QScopedPointer<QSystemScreenSaver> ssObject(new QSystemScreenSaver(emugl)); ssObject->setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #endif QScopedPointer<QThread> thread(new QThread); QScopedPointer<MainAudio> audio(new MainAudio()); audio->moveToThread(thread.data()); QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run())); thread->start(); #ifdef QT_HAS_SDL SDLJoystick joy(true); joy.startEventLoop(); #endif int ret = a.exec(); thread->quit(); return ret; }
static int mainInternal(QApplication &a) { #ifdef MOBILE_DEVICE emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif #ifdef __SYMBIAN32__ // Set RunFast hardware mode for VFPv2. User::SetFloatingPointMode(EFpModeRunFast); // Disable screensaver QScopedPointer<QSystemScreenSaver> ssObject(new QSystemScreenSaver(emugl)); ssObject->setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #endif #ifdef QT_HAS_SDL SDLJoystick joy(true); joy.startEventLoop(); SDL_Init(SDL_INIT_AUDIO); SDL_AudioSpec fmt, ret_fmt; memset(&fmt, 0, sizeof(fmt)); fmt.freq = 44100; fmt.format = AUDIO_S16; fmt.channels = 2; fmt.samples = 2048; fmt.callback = &mixaudio; fmt.userdata = (void *)0; if (SDL_OpenAudio(&fmt, &ret_fmt) < 0) { ELOG("Failed to open audio: %s", SDL_GetError()); } else { if (ret_fmt.samples != fmt.samples) // Notify, but still use it ELOG("Output audio samples: %d (requested: %d)", ret_fmt.samples, fmt.samples); if (ret_fmt.freq != fmt.freq || ret_fmt.format != fmt.format || ret_fmt.channels != fmt.channels) { ELOG("Sound buffer format does not match requested format."); ELOG("Output audio freq: %d (requested: %d)", ret_fmt.freq, fmt.freq); ELOG("Output audio format: %d (requested: %d)", ret_fmt.format, fmt.format); ELOG("Output audio channels: %d (requested: %d)", ret_fmt.channels, fmt.channels); ELOG("Provided output format does not match requirement, turning audio off"); SDL_CloseAudio(); } } // Audio must be unpaused _after_ NativeInit() SDL_PauseAudio(0); #else QScopedPointer<QThread> thread(new QThread); QScopedPointer<MainAudio> audio(new MainAudio()); audio->moveToThread(thread.data()); QObject::connect(thread.data(), SIGNAL(started()), audio.data(), SLOT(run())); thread->start(); #endif int ret = a.exec(); #ifndef QT_HAS_SDL thread->quit(); #endif return ret; }
int main(int argc, char** argv){ ros::init(argc, argv, "joystick_window"); ros::NodeHandle n; JoyStickWindow joy(n); joy.loop(); return 0; }
interrupt 15 void TIM_ISR(void) { // clear TIM CH 7 interrupt flag TFLG1 = TFLG1 | 0x80; timer++; if(diffrun == 1 && gamerun == 0 || diffrun == 0 && gamerun == 1){ joy(); buttAatd++; } }
static int mainInternal(QApplication &a) { #ifdef MOBILE_DEVICE emugl = new MainUI(); emugl->resize(pixel_xres, pixel_yres); emugl->showFullScreen(); #endif EnableFZ(); // Disable screensaver #ifdef __SYMBIAN32__ QSystemScreenSaver ssObject(emugl); ssObject.setScreenSaverInhibit(); QScopedPointer<SymbianMediaKeys> mediakeys(new SymbianMediaKeys()); #elif defined(QT_HAS_SYSTEMINFO) QScreenSaver ssObject(emugl); ssObject.setScreenSaverEnabled(false); #endif #ifdef SDL SDLJoystick joy(true); joy.startEventLoop(); SDL_Init(SDL_INIT_AUDIO); SDL_AudioSpec fmt, ret_fmt; memset(&fmt, 0, sizeof(fmt)); fmt.freq = 44100; fmt.format = AUDIO_S16; fmt.channels = 2; fmt.samples = 2048; fmt.callback = &mixaudio; fmt.userdata = (void *)0; if (SDL_OpenAudio(&fmt, &ret_fmt) < 0) { ELOG("Failed to open audio: %s", SDL_GetError()); } else { if (ret_fmt.samples != fmt.samples) // Notify, but still use it ELOG("Output audio samples: %d (requested: %d)", ret_fmt.samples, fmt.samples); if (ret_fmt.freq != fmt.freq || ret_fmt.format != fmt.format || ret_fmt.channels != fmt.channels) { ELOG("Sound buffer format does not match requested format."); ELOG("Output audio freq: %d (requested: %d)", ret_fmt.freq, fmt.freq); ELOG("Output audio format: %d (requested: %d)", ret_fmt.format, fmt.format); ELOG("Output audio channels: %d (requested: %d)", ret_fmt.channels, fmt.channels); ELOG("Provided output format does not match requirement, turning audio off"); SDL_CloseAudio(); } } SDL_PauseAudio(0); #else QScopedPointer<MainAudio> audio(new MainAudio()); audio->run(); #endif return a.exec(); }
squirrelsplash(){ disp_off(); cls(); foo=6; put_string(" PC Engine ",0,foo); put_string(" MML Sound Library ",0,2+foo); put_string(" 'SQUIRREL' ",0,4+foo); put_string(" By: Aetherbyte ",0,6+foo); put_string(" http://www.aetherbyte.com/ ",0,8+foo); foo++; put_string(" Game concept and graphics by ",0,12+foo); put_string(" http://lazybraingames.com/ ",0,14+foo); disp_on(); bar=0; while(1){ lastjoy0=joy0; vsync(); bar++; joy0=joy(0); if(joy0&JOY_STRT)break; if(bar>90)break; } cls(); while(joy0&JOY_STRT){ vsync(); joy0=joy(0); } }
main() { int joie; cls(); init_satb(); reset_satb(); set_color(0,0); /* Je veux le noir */ set_color(1,511); /* Je veux le blanc */ set_font_color(1, 0); load_default_font(); put_string("TimeFend", 12, 12); put_string("First presented at AC2015", 4, 13); put_string("by Cr30s & Bjorn", 8, 15); for(;;) { joie = joy(0); if (joie & JOY_STRT) timefend(); } }
void MiscControlPage::FillInitialJoystickPortValues() { // temporary hardcoded joystick port devices (not for BSD) #if wxUSE_JOYSTICK wxJoystick joy(wxJOYSTICK1); #endif int JoySaveID[] = { ConfigurationData::CD_JOYPORT1, ConfigurationData::CD_JOYPORT2 }; wxComboBox* box[2]; box[0] = (wxComboBox*)FindWindowByName(wxT("Joyport1Selector")); box[1] = (wxComboBox*)FindWindowByName(wxT("Joyport2Selector")); for (int i = 0; i < 2; ++i) { box[i]->Clear(); box[i]->Append(wxT("--empty--")); box[i]->Append(wxT("mouse")); box[i]->Append(wxT("tetris2-protection")); box[i]->Append(wxT("magic-key")); box[i]->Append(wxT("keyjoystick1")); box[i]->Append(wxT("keyjoystick2")); #if wxUSE_JOYSTICK for (int j = 1; j <= joy.GetNumberJoysticks(); ++j) { box[i]->Append(wxString::Format(wxT("joystick%d"), j)); } #endif wxString current; ConfigurationData::instance().GetParameter(JoySaveID[i], current); int pos = box[i]->FindString(current); if (pos != wxNOT_FOUND) { box[i]->SetSelection(pos); } else { box[i]->SetSelection(0); } } m_oldJoy1 = box[0]->GetValue(); m_oldJoy2 = box[1]->GetValue(); }
void DrawN() { unsigned char end = 1; redraw = 1; do { vsync(); end = 1; if(redraw) { ResetVideo(); set_xres(256, xres_flags); scroll(0, 0, -32, 0, 240, 0xC0); #ifndef CDROM1 load_background(n_bg, n_pal, n_map, 32, 20); #else set_screen_size(SCR_SIZE_32x32); cd_loaddata(GPHX_OVERLAY, OFS_N_PAL_bin, palCD, SIZE_N_PAL_bin); load_palette(0, palCD, 16); cd_loadvram(GPHX_OVERLAY, OFS_N_DATA_bin, 0x1000, SIZE_N_DATA_bin); cd_loadvram(GPHX_OVERLAY, OFS_N_BAT_bin, 0, SIZE_N_BAT_bin); // Why these get zapped to 0 when in CDROM1... RestoreGlobals(); #endif redraw = 0; disp_on(); } controller = joy(0); if(controller & JOY_SEL) end = 0; }while(!end); }
/* *********************************************************************** Main - Setup *********************************************************************** */ void main(void) { /* put your own code here */ DisableInterrupts; initializations(); EnableInterrupts; //printf("%ld\n",time(0)); //prints time elapsed since 1970 Initial_board(mine); Initial_mask(mask); /* *********************************************************************** Main - Loop *********************************************************************** */ for(;;) { PTT_PTT3 = display1_en; //display1_en = 1 means PTT_PTT3 = 0 (en) PTT_PTT5 = !display2_en; //display2_en = 1 means PTT_PTT5 = 0 (en) //butts(); if(diffrun == 0 && gamerun == 0){ //splash screen if(setflag == 1){ send_i(LCDCLR); splashDisp(); setflag = 0; } if(buttBpb){ //buttBpb (FLAG), as opposed to buttBatd diffrun = 1; setflag = 1; } } if(diffrun == 1 && gamerun == 0){ //difficulty screen if(setflag == 1){ send_i(LCDCLR); diffDisp(); setflag = 0; } difficulty(); if(buttBpb){ gamerun = 1; diffrun = 0; setflag = 1; } } if(diffrun == 0 && gamerun == 1){ if(setflag == 1){ send_i(LCDCLR); Create_board(nbomb,mine); joymove = 99; setflag = 0; } //printf("Mask: \n"); if(joymove != 0){ for(i = 0; i < NROW; i++){ for(j = 0; j < NCOL; j++){ //printf("%2d ",mask[i][j]); pos(i,j); if(mask[i][j] == 9){ pmsglcd("?"); }else if(mask[i][j] == 0){ pmsglcd(" "); }else if(mask[i][j] >= 1 && mask[i][j] <= 8){ dumb = 30 + mask[i][j]; print_c(dumb); }else if(mask[i][j] == 10){ pmsglcd("F"); } } //printf("\n"); } } joymove = joy(); if(joymove == 2){ if(irow != 0){ irow--; } } if(joymove == 4){ if(icol != 0){ icol--; } } if(joymove == 6){ if(icol != (NCOL - 1)){ icol++; } } if(joymove == 8){ if(icol != (NROW - 1)){ irow++; } } nclick = GameControl(irow,icol,nclick,mine,mask); } if(nclick == -1){ fail = 1; for(a = 0; a < NROW; a++){ for(b = 0; b < NCOL; b++){ mask[a][b] = mine[a][b]; } } } //printf("Number Click: %d\n",nclick); nflag = FlagControl(frow,fcol,nflag,mask); if((nflag + nclick) == nbomb){ win = 1; } //printf("Number Flag: %d\n",nflag); //printf("Flag: \n"); for(i = 0; i < NROW; i++){ for(j = 0; j < NCOL; j++){ //printf("%2d ",mask[i][j]); } //printf("\n"); } //printf("Mine: \n"); for(i = 0; i < NROW; i++){ for(j = 0; j < NCOL; j++){ //printf("%2d ",mine[i][j]); } //printf("\n"); } /* //If the left pushbutton if(leftpb && !gamerun){ leftpb = 0; gamerun = 1; send_i(LCDCLR); //display message pmsglcd("Ready, Set..."); } //If the right pushbutton if(rghtpb && gamerun){ rghtpb = 0; gamerun = 0; } */ } /* loop forever */ /* please make sure that you never leave main */ }
int Joystick::init(){ Pio joy(Input::JOY_PORT); return joy.init(Input::JOY_MASK, Pio::INPUT | Pio::PULLDOWN); }
run_game() { /* init variables */ frame = 0; hero_walk_state = 0; spr_addr_hero = SPR_ADDR__HERO_D; joy1_dpad = 0; /* init sprites */ init_satb(); load_vram(SPR_ADDR__HERO_U, spr_hero_u, 0x400); load_vram(SPR_ADDR__HERO_UR, spr_hero_ur, 0x400); load_vram(SPR_ADDR__HERO_R, spr_hero_r, 0x400); load_vram(SPR_ADDR__HERO_DR, spr_hero_dr, 0x400); load_vram(SPR_ADDR__HERO_D, spr_hero_d, 0x400); load_vram(SPR_ADDR__HERO_DL, spr_hero_dl, 0x400); load_vram(SPR_ADDR__HERO_L, spr_hero_l, 0x400); load_vram(SPR_ADDR__HERO_UL, spr_hero_ul, 0x400); set_sprpal(PAL_NUM__HERO, pal_hero); /* hero sprite */ spr_set(SPR_NUM__HERO); spr_x(hero_x); spr_y(hero_y); spr_pattern(spr_addr_hero); spr_ctrl(SIZE_MAS|FLIP_MAS, SZ_32x32|NO_FLIP); spr_pal(PAL_NUM__HERO); spr_pri(1); /* font */ set_font_color(1, 0); set_font_pal(0); load_default_font(); satb_update(); vsync(); /******************************************************************************* GAME LOOP *******************************************************************************/ for(;;) { joy1 = joy(0); joy1a = joytrg(0); old_spr_addr_hero = spr_addr_hero; /* d-pad input */ #asm lda _joy1 lsr4 sta _joy1_dpad bne movement_input jmp no_movement_input movement_input: #endasm if (joy1 & JOY_UP) hero_y--; else if (joy1 & JOY_DOWN) hero_y++; if (joy1 & JOY_LEFT) hero_x--; else if (joy1 & JOY_RGHT) hero_x++; if (frame % 8 == 0) hero_walk_state++; #asm ldx _joy1_dpad ;// lower nibble of _spr_addr_hero already zeroed lda tbl_hero_spr_addr,X sta _spr_addr_hero+1 no_movement_input: #endasm /* a/b input */ if (joy1 & JOY_A) { spr_addr_hero_modifier = 0x300; if (spr_addr_hero != old_spr_addr_hero) { if (frame % 4) { spr_addr_hero = old_spr_addr_hero; } else { if (!(joy1a & JOY_A)) { spr_addr_hero = old_spr_addr_hero + 0x400; if (spr_addr_hero > 0x6C00) spr_addr_hero = 0x5000; } } } } else if (joy1 & JOY_B) { spr_addr_hero_modifier = 0x300; if (spr_addr_hero != old_spr_addr_hero) { if (frame % 4) { spr_addr_hero = old_spr_addr_hero; } else { if (!(joy1a & JOY_B)) { spr_addr_hero = old_spr_addr_hero - 0x400; if (spr_addr_hero < 0x5000) spr_addr_hero = 0x6C00; } } } } else { /* hero direction walk animation*/ if (hero_walk_state == 1) { spr_addr_hero_modifier = 0x100; } else if (hero_walk_state == 3) { spr_addr_hero_modifier = 0x200; } else{ spr_addr_hero_modifier = 0; } } spr_set(SPR_NUM__HERO); spr_pattern(spr_addr_hero + spr_addr_hero_modifier); spr_x(hero_x); spr_y(hero_y); hero_walk_state = hero_walk_state % 4; frame++; satb_update(); vsync(); } }
config(){ psgPlay(0); draw_win(5,13,9,5); draw_win(18,13,9,5); put_string("LEVEL",6,15); put_string("MUSIC",19,15); put_number(level,1,12,15); put_number(music,1,25,15); bar=0; foo=0; while(bar==0){ psgPlay(0); put_string("<",12,14); put_string(">",12,16); while(foo==0){ title_color_cycle(); lastjoy0=joy0; vsync(); joy0=joy(0); if( (joy0&JOY_A && !(lastjoy0&JOY_A)) || (joy0&JOY_RGHT && !(lastjoy0&JOY_RGHT)) ){ put_string(" ",12,14); put_string(" ",12,16); foo=1; psgPlay(7); } if(joy0&JOY_UP&&!(lastjoy0&JOY_UP)){ if(level<9) level++; else level=0; put_number(level,1,12,15); psgPlay(7); }else if(joy0&JOY_DOWN && !(lastjoy0&JOY_DOWN)){ if(level>0) level--; else level=9; put_number(level,1,12,15); psgPlay(7); } if(joy0&JOY_STRT && !(lastjoy0&JOY_STRT)){ foo=255; bar=1; psgPlay(7); } } psgPlay(music+2); put_string("<",25,14); put_string(">",25,16); while(foo==1){ loopSong(); title_color_cycle(); lastjoy0=joy0; vsync(); joy0=joy(0); if( (joy0&JOY_B && !(lastjoy0&JOY_B)) || (joy0&JOY_LEFT && !(lastjoy0&JOY_LEFT)) ){ put_string(" ",25,14); put_string(" ",25,16); foo=0; psgPlay(7); } if(joy0&JOY_A && !(lastjoy0&JOY_A)){ foo=255; bar=1; psgPlay(7); } if(joy0&JOY_UP&&!(lastjoy0&JOY_UP)){ psgPlay(7); if(music<4) music++; else music=0; put_number(music,1,25,15); psgPlay(music+2); }else if(joy0&JOY_DOWN && !(lastjoy0&JOY_DOWN)){ psgPlay(7); if(music>0) music--; else music=4; put_number(music,1,25,15); psgPlay(music+2); } if(joy0&JOY_STRT && !(lastjoy0&JOY_STRT)){ foo=255; bar=1; psgPlay(7); } } } cls(); }
title(){ psgPlay(2); cls(); set_tile_data(title_tiles); load_tile(0x1000); load_palette(15,title_pal,1); for(i=0;i<16;i++){ for(j=0;j<4;j++){ put_tile(j*16+i,i,j+1); } } for(i=0;i<8;i++){ set_color_rgb(241+i,0,7-i,0); set_color_rgb(248+i,i,7,i); if(248+7+i<256)set_color_rgb(248+7+i,7,i,7); } draw_win(1,21,30,6); put_string(" HI-SCORE 00 LV 0",0,1); put_number(hiscore,5,11,1); put_number(hilevel,1,30,1); put_string("PC Engine version by cabbage",2,22); put_string(" NEO Retro Coding Compo 2013",2,24); put_string(" http://www.neoflash.com/ ",2,25); put_string("PUSH RUN BUTTON !",8,15); foo=1; t=0; while(1){ rs++; lastjoy0=joy0; vsync(); joy0=joy(0); t++; if(t>30){ if(foo==0){ put_string(" ",8,15); foo=1; t=0; }else{ put_string("PUSH RUN BUTTON !",8,15); foo=0; t=0; } } if(joy0&JOY_STRT){ break; } title_color_cycle(); } while(joy0&JOY_STRT){ vsync(); joy0=joy(0); } put_string(" ",8,15); srand(rs); config(); }