Example #1
0
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
    ChangeWindowMode(TRUE);//ウィンドウモード
    if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;//初期化と裏画面化

    while(ProcessLoop()==0){//メインループ
        switch(func_state){
            case 0://初回のみ入る処理
                load();        //データロード
                first_ini();//初回の初期化
                func_state=99;
                break;
            case 99://STGを始める前に行う初期化
                ini();
                func_state=100;
                break;
            case 100://通常処理
                calc_ch();    //キャラクタ計算
                ch_move();    //キャラクタの移動制御
                enemy_main();//敵処理メイン
                graph_main();//描画メイン
                stage_count++;
                break;
            default:
                printfDx("不明なfunc_state\n");
                break;
        }
        if(CheckStateKey(KEY_INPUT_ESCAPE)==1)break;//エスケープが入力されたらブレイク
        ScreenFlip();//裏画面反映
    }
    DxLib_End();//DXライブラリ終了処理
    return 0;
}
Example #2
0
int Title::Execute()
{
	if (!bSequenceChangeng){

		//上下の項目選択
		//上
		if (CheckStateKey(KEY_INPUT_UP) == 1 || (CheckStateKey(KEY_INPUT_UP) > 15 && CheckStateKey(KEY_INPUT_UP) % 10 == 0)){
			
			//移動先がLoadなら
			if (Selecting == TIT_EXIT){
				//セーブファイルが有れば
				if (PathFileExists("savedata.sav")){
					Selecting = (Selecting + 2) % 3;
				}
				//なければ飛ばす
				else  Selecting = TIT_START;
			}
			else Selecting = (Selecting + 2) % 3;
			
			return MAIN_SEQ_CONTINUE;
		}
		if (CheckStateKey(KEY_INPUT_DOWN) == 1 || (CheckStateKey(KEY_INPUT_DOWN) > 15 && CheckStateKey(KEY_INPUT_DOWN) % 10 == 0)){
			
			//移動先がLoadなら
			if (Selecting == TIT_START){
				//セーブファイルが有れば
				if (PathFileExists("savedata.sav")){
					Selecting = (Selecting + 1) % 3;
				}
				//なければ飛ばす
				else  Selecting = TIT_EXIT;
			}
			else Selecting = (Selecting + 1) % 3;
			
		
			return MAIN_SEQ_CONTINUE;
		}
		//決定キー
		if (CheckStateKey(KEY_INPUT_Z) == 1){
			bSequenceChangeng = true;

			return MAIN_SEQ_CONTINUE;
		}

	}
	else {
		++ChangeCounter;
		
		if (ChangeCounter == ChangeFrame){
			
			switch (Selecting){
			case TIT_START:
				return MAIN_SEQ_PROLOGUE;
				break;


			case TIT_LOAD:
				return MAIN_SEQ_GAMEMAIN;
				break;

			//終了
			case TIT_EXIT:
				return MAIN_SEQ_EXIT;
				break;

			default:
				MessageBox(NULL, "不正なシーケンスが返されました。", "error", MB_OK);
				break;
			}
		}

	}
	MainCounter++;

	return MAIN_SEQ_CONTINUE;
}
Example #3
0
//標準入力をチェックする関数
void GetHitPadStateDefault(){
	int h,i,PadInput,mul=1;

	PadInput = GetJoypadInputState( DX_INPUT_PAD1 );//パッドの入力状態を取得
	
	for(i=0;i<16;i++){
		if(PadInput & mul)  pad[PLAYER_MAX].key[i]++;
		else		pad[PLAYER_MAX].key[i]=0;
		mul*=2;
	}

	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].left]   ,CheckStateKey(configpad[PLAYER_MAX].left  ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].up]     ,CheckStateKey(configpad[PLAYER_MAX].up    ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].right]  ,CheckStateKey(configpad[PLAYER_MAX].right ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].down]   ,CheckStateKey(configpad[PLAYER_MAX].down  ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].hold]   ,CheckStateKey(configpad[PLAYER_MAX].hold  ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].turn_L] ,CheckStateKey(configpad[PLAYER_MAX].turn_L));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].turn_R] ,CheckStateKey(configpad[PLAYER_MAX].turn_R));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].key1]   ,CheckStateKey(configpad[PLAYER_MAX].key1  ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].key2]   ,CheckStateKey(configpad[PLAYER_MAX].key2  ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].key3]   ,CheckStateKey(configpad[PLAYER_MAX].key3  ));
	input_pad_or_key(&pad[PLAYER_MAX].key[configpad[0].pause]  ,CheckStateKey(configpad[PLAYER_MAX].pause ));
}
Example #4
0
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){

	//FullscreenMessage();
	ChangeWindowMode( FALSE );

	SetMainWindowText("高橋テトリスver0.04");
    if (DxLib_Init() == -1) return -1; //初期化

	load();

	if (SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;//裏画面化

	exe_cnt=0;
	func_state=0;

    while(ProcessLoop()==0){//メインループ
			
		music_ini();

		switch(func_state){
		case 0: //初期ロード
			launch_ini();
			mode=0;
			menu_ini();
			func_state=1;
			break;
		case 1: //ロゴ画面
			graph_logo();
			break;
		case 2: //メニュー画面
			control_menu();
			graph_menu();
			break;
		case 50: //モード選択画面
			control_menu();
			graph_menu();
			break;
		case 51: //モード選択後移行画面
			graph_menu();
			menu_selected_cnt++;
			if (menu_selected_cnt>30) {
				first_ini();
				func_state=100;
			}
			break;
		case 100: //ゲームメイン画面
			control_main();
			block_main();
			cal_score();
			graph_main();
			stage_cnt++;
			if (gameover_flag==1 && CheckStatePad(-1,PAD_NUM_HOLD)==1) {
				result_ini();
				func_state=101;
			}
			if (CheckStatePad(-1,PAD_NUM_PAUSE)==1) {
				pause_push_Pl=PadPushPlayer;
				StopSoundMem( bgm_handle[bgm_num] ) ;
				pause_select=0;
				func_state=999;
			}
			break;
		case 999: //ポーズ画面
			control_game_pause();
			graph_main();
			if (CheckStatePad((all_cpu_flag==0)?pause_push_Pl:-1,PAD_NUM_HOLD)==1) {
				switch (pause_select) {
				case 0:
					PlaySoundMem( bgm_handle[bgm_num] , DX_PLAYTYPE_LOOP , FALSE ) ;
					func_state=100;
					break;
				case 1:
					first_ini();
					func_state=100;
					break;
				case 2:
					menu_ini();
					func_state=50;
					break;
				}
			}
			if (CheckStatePad((all_cpu_flag==0)?pause_push_Pl:-1,PAD_NUM_PAUSE)==1) {
				PlaySoundMem( bgm_handle[bgm_num] , DX_PLAYTYPE_LOOP , FALSE ) ;
				func_state=100;
			}
			break;
		case 101: //リザルト画面
			control_result();
			graph_main();
			stage_cnt++;
			if (CheckStatePad(-1,PAD_NUM_HOLD)==1) func_state=102;
			break;
		case 102: //ゲームオーバー後選択画面
			control_over_select();
			graph_main();
			stage_cnt++;
			if (CheckStatePad(-1,PAD_NUM_HOLD)==1) {
				switch (over_select) {
				case 0:
					first_ini();
					func_state=100;
					break;
				case 1:
					menu_ini();
					menu_select=mode;
					func_state=50;
					break;
				case 3:
					func_state=101;
					break;
				}
			}
			break;
		default:
			printfDx("error:不明なfunc_state\n");
			break;
		}

		control_func_state();

		exe_cnt++;

		music_play();
	
		if(CheckStateKey(KEY_INPUT_ESCAPE)==1) break;//エスケープが入力されたらブレイク
		ScreenFlip();//裏画面反映
    }

    DxLib_End();//DXライブラリ終了処理
    return 0;
}
Example #5
0
//パッドとキーボードの両方の入力をチェックする関数
void GetHitPadStateAll(){
	int h,i,PadInput,mul=1;
	for (h=0;h<PLAYER_MAX;h++) {
		switch(h) {
		case 0:
			PadInput = GetJoypadInputState( DX_INPUT_PAD1 );//パッドの入力状態を取得
			break;
		case 1:
			PadInput = GetJoypadInputState( DX_INPUT_PAD2 );//パッドの入力状態を取得
			break;
		case 2:
			PadInput = GetJoypadInputState( DX_INPUT_PAD3 );//パッドの入力状態を取得
			break;
		case 3:
			PadInput = GetJoypadInputState( DX_INPUT_PAD4 );//パッドの入力状態を取得
			break;
		}
		for(i=0;i<16;i++){
			if(PadInput & mul)  pad[h].key[i]++;
			else		pad[h].key[i]=0;
			mul*=2;
		}
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].left]   ,CheckStateKey(configpad[Pl[h].keyboard_num+4].left  ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].up]     ,CheckStateKey(configpad[Pl[h].keyboard_num+4].up    ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].right]  ,CheckStateKey(configpad[Pl[h].keyboard_num+4].right ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].down]   ,CheckStateKey(configpad[Pl[h].keyboard_num+4].down  ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].hold]   ,CheckStateKey(configpad[Pl[h].keyboard_num+4].hold  ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].turn_L] ,CheckStateKey(configpad[Pl[h].keyboard_num+4].turn_L));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].turn_R] ,CheckStateKey(configpad[Pl[h].keyboard_num+4].turn_R));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].key1]   ,CheckStateKey(configpad[Pl[h].keyboard_num+4].key1  ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].key2]   ,CheckStateKey(configpad[Pl[h].keyboard_num+4].key2  ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].key3]   ,CheckStateKey(configpad[Pl[h].keyboard_num+4].key3  ));
		input_pad_or_key(&pad[Pl[h].pad_num].key[configpad[Pl[h].pad_num].pause]  ,CheckStateKey(configpad[Pl[h].keyboard_num+4].pause ));
	}
}