Exemple #1
0
//==============================================================================
// Brief  : 破棄する要素の指定処理
// Return : void							: なし
// Arg    : unsigned int id				: 破棄するオブジェクトのID
//==============================================================================
void CExecutorDraw::ReleaseItem( unsigned int id )
{
	// クリティカルセクション開始
	EnterCriticalSection( &m_criticalSection );

	// 一致するIDの検索
	CItem*	pItemCurrent = nullptr;		// 対象オブジェクト
	for( pItemCurrent = m_pItemTop; pItemCurrent != nullptr; pItemCurrent = pItemCurrent->m_pNext )
	{
		if( pItemCurrent->m_id == id )
		{
			// 削除フラグを立てる
			pItemCurrent->m_isUnregistered = true;

			// クリティカルセクション終了
			LeaveCriticalSection( &m_criticalSection );
			return;
		}
	}

	// エラーメッセージ
	PrintDebugWnd( "指定された描画要素のIDがありません。:%d\n", id );

	// クリティカルセクション終了
	LeaveCriticalSection( &m_criticalSection );
}
Exemple #2
0
int ManagerResource< TypeItem >::Load( TCHAR* pNameFile )
{
	// エラーチェック
	Assert( pNameFile != nullptr, _T( "ファイルパスが不正です。" ) );

	// ファイルパスの作成
	TCHAR	pPath[ _MAX_PATH ] = {};		// ファイルパス
	_tcscpy_s( pPath, _MAX_PATH, pDirectory_ );
	_tcscat_s( pPath, _MAX_PATH, pNameFile );

	// 既に作られていないか検索
	int		index;		// 要素番号
	index = GetId( pPath );
	if( index != -1 )
	{
		return index;
	}

	// 格納場所の決定
	for( index = 0; index < maximumItem_; ++index )
	{
		if( !pBufferItem_[ index ].isEnable_ )
		{
			break;
		}
	}
	if( index >= maximumItem_ )
	{
		PrintDebugWnd( _T( "リソースの格納領域に空きがありません。" ) );
		return -1;
	}

	// リソースの読み込み
	int		result;		// 実行結果
	result = LoadResource( pPath, index );
	if( result != 0 )
	{
		return -1;
	}

	// 要素に値を設定
	pBufferItem_[ index ].id_ = index;
	_tcscpy_s( pBufferItem_[ index ].pPath_, _MAX_PATH, pPath );
	pBufferItem_[ index ].isEnable_ = true;

	// リソースIDを返す
	return index;
}
Exemple #3
0
//==============================================================================
// Brief  : 要素の登録処理
// Return : void							: なし
// Arg    : CGraphicSet* pGraphic			: 登録する描画クラスのアドレス
// Arg    : int priority					: 描画優先度
//==============================================================================
int CExecutorDraw::RegisterItem( CGraphicSet* pGraphic, int priority )
{
	// クリティカルセクション開始
	EnterCriticalSection( &m_criticalSection );

	// 優先度の低い場所を検索
	CItem*	pItemCurrent = nullptr;							// 対象オブジェクト
	int		idCurrent = static_cast< int >( m_idCurrent );	// 登録ID
	for( pItemCurrent = m_pItemTop; pItemCurrent != nullptr; pItemCurrent = pItemCurrent->m_pNext )
	{
		// 要素の追加
		if( pItemCurrent->m_priority < priority )
		{
			CItem*	pItem = nullptr;		// 登録する要素

			// 要素の追加
			pItem = new CItem( m_idCurrent, priority, pItemCurrent->m_pPrev, pItemCurrent, pGraphic );

			// 先頭に追加
			if( pItemCurrent == m_pItemTop )
			{
				m_pItemTop = pItem;
			}

			// IDの経過
			++m_idCurrent;

			// クリティカルセクション終了
			LeaveCriticalSection( &m_criticalSection );
			return idCurrent;
		}
		else if( pItemCurrent->m_pNext == nullptr )
		{
			CItem*	pItem = nullptr;		// 登録する要素

			// 要素の追加
			pItem = new CItem( m_idCurrent, priority, pItemCurrent, nullptr, pGraphic );

			// IDの経過
			++m_idCurrent;

			// クリティカルセクション終了
			LeaveCriticalSection( &m_criticalSection );
			return idCurrent;
		}
	}

	// 最初の登録
	if( m_pItemTop == nullptr )
	{
		// 要素の追加
		m_pItemTop = new CItem( m_idCurrent, priority, nullptr, nullptr, pGraphic );

		// IDの経過
		++m_idCurrent;

		// クリティカルセクション終了
		LeaveCriticalSection( &m_criticalSection );
		return idCurrent;
	}

	// エラーメッセージ
	PrintDebugWnd( "描画要素の登録に失敗しました。\n" );

	// クリティカルセクション終了
	LeaveCriticalSection( &m_criticalSection );
	return -1;
}