Example #1
0
//-------------------------------------------------------------------
// 実行中
//-------------------------------------------------------------------
void cTitleScene::Idle()
{
	if( !FadeIn() ) return;

	if( InputButton(Up) == 1 ){
		Device->Sound.PlaySE(0);
		pTitleCursor->Up();
	}
	if( InputButton(Down) == 1 ){
		Device->Sound.PlaySE(0);
		pTitleCursor->Down();
	}

	if( InputButton(Button1) == 1 ){
		switch( pTitleCursor->GetSelectID() ){
			case Select_GoSelect:
				Device->Sound.PlaySE(2);
				select_ = Select_GoSelect;
				stateFunc_.setFunc( &cTitleScene::End );
				MyOutputDebugString( _T("タイトルシーン:アイドル終了\nセレクトシーンへ移行します\n") );
				break;

			case Select_Config:
				pTitleKeyConfigString->SetIsDraw(TRUE);
				select_ = Select_Config;
				stateFunc_.setFunc( &cTitleScene::KeyConfig );
				MyOutputDebugString( _T("タイトルシーン:キーコンフィグを起動します。\n") );
				break;

			case Select_Exit:
				select_ = Select_Exit;
				stateFunc_.setFunc( &cTitleScene::End );
				MyOutputDebugString( _T("タイトルシーン:アイドル終了\nアプリケーションを終了します\n") );
				break;
		}
	}

	pTitleCursor->Updata();

	if( DxLib::GetWindowUserCloseFlag( TRUE ) && (MessageBox( DxLib::GetMainWindowHandle(),WindowText, WindowTitleText, MB_YESNO|MB_ICONQUESTION ) == IDYES) ){
		select_ = Select_Exit;
		stateFunc_.setFunc( &cTitleScene::End );
	}
}
 void ActiveWidget::Init()
 {
     _handlers = new MethodPool<ActiveWidget, const Widget::Request >;
     _handlers->Add( &ActiveWidget::AcceptInputCursor,    InputCursor()  );
     _handlers->Add( &ActiveWidget::AcceptInputButton,    InputButton()  );
     _handlers->Add( &ActiveWidget::AcceptDoubleClick,    DoubleClick()  );
     _handlers->Add( &ActiveWidget::AcceptInputWheel ,    InputWheel()   );
     _handlers->Add( &ActiveWidget::AcceptInputReset ,    InputReset()   );
     _handlers->Add( &ActiveWidget::AcceptInputKeyboard , InputKeyboard());
     _handlers->Add( &ActiveWidget::AcceptInputChar ,     InputChar()    );
     _handlers->Add( &ActiveWidget::AcceptInputFocus,     InputFocus()   );
     _handlers->Add( &ActiveWidget::AcceptInputAccel,     InputAccel()   );
 }
// Update
void Game_Interpreter::Update() {
	// 10000 based on: https://gist.github.com/4406621
	for (loop_count = 0; loop_count < 10000; ++loop_count) {
		/* If map is different than event startup time
		set event_id to 0 */
		if (Game_Map::GetMapId() != map_id) {
			event_id = 0;
		}

		/* If there's any active child interpreter, update it */
		if (child_interpreter) {

			child_interpreter->Update();

			if (!child_interpreter->IsRunning()) {
				child_interpreter.reset();
			}

			// If child interpreter still exists
			if (child_interpreter) {
				return;
			}
		}

		if (Game_Message::message_waiting) {
			return;
		}

		// If waiting for a move to end
		if (move_route_waiting) {
			if (Main_Data::game_player->GetMoveRouteForcing()) {
				return;
			}

			Game_Event* g_event;
			for (size_t i = 0; i < Game_Map::GetEvents().size(); i++) {
				g_event = Game_Map::GetEvents().find(i)->second.get();

				if (g_event->GetMoveRouteForcing()) {
					return;
				}
			}
			move_route_waiting = false;
		}

		if (button_input_variable_id > 0) {
			InputButton();
			return;
		}

		if (wait_count > 0) {
			wait_count--;
			return;
		}

		if (Game_Temp::forcing_battler != NULL) {
			return;
		}

		if (//Game_Temp::battle_calling ||
			Game_Temp::shop_calling ||
//			Game_Temp::inn_calling ||
			Game_Temp::name_calling ||
			Game_Temp::menu_calling ||
			Game_Temp::save_calling ||
			Game_Temp::to_title ||
			Game_Temp::gameover) {

			return;
		}

		if (continuation) {
			bool result = (this->*continuation)(list[index]);
			continuation = NULL;
			if (result)
				continue;
			else
				return;
		}

		if (list.empty()) {
			if (!Main_Data::game_player->IsTeleporting() && main_flag) {
				if (Game_Map::GetNeedRefresh()) {
					Game_Map::Refresh();
				}
			}

			if (list.empty()) {
				return;
			}
		}

		if (!ExecuteCommand()) {
			CloseMessageWindow();
			active = true;
			return;
		}

		active = false;

		// FIXME?
		// After calling SkipTo this index++ will skip execution of e.g. END.
		// This causes a different timing because loop_count reaches 10000
		// faster then Player does.
		// No idea if any game depends on this special case.
		index++;
	} // for

	// Executed Events Count exceeded (10000)
	active = true;
	Output::Debug("Event %d exceeded execution limit", event_id);
	CloseMessageWindow();
}