Example #1
0
void CImageLibrary::Sweep (void)

//	Sweep
//
//	Sweeps all unmarked/unused images

	{
	for (int i = 0; i < m_Library.GetCount(); i++)
		{
		CObjectImage *pImage = (CObjectImage *)m_Library.GetValue(i);
		pImage->Sweep();
		}
	}
Example #2
0
void CImageLibrary::ClearMarks (void)

//	ClearMarks
//
//	Clears the marks for all images

	{
	for (int i = 0; i < m_Library.GetCount(); i++)
		{
		CObjectImage *pImage = (CObjectImage *)m_Library.GetValue(i);
		pImage->ClearMark();
		}
	}
void CDesignCollection::ClearImageMarks (void)

//	ClearImageMarks
//
//	Clears marks on all images

	{
	int i;

	for (i = 0; i < GetCount(designImage); i++)
		{
		CObjectImage *pImage = CObjectImage::AsType(GetEntry(designImage, i));
		pImage->ClearMark();
		}
	}
void CDesignCollection::SweepImages (void)

//	SweepImages
//
//	Frees any images that are not marked

	{
	int i;

	for (i = 0; i < GetCount(designImage); i++)
		{
		CObjectImage *pImage = CObjectImage::AsType(GetEntry(designImage, i));
		pImage->Sweep();
		}
	}
Example #5
0
CG16bitImage *CImageLibrary::GetImage (DWORD dwUNID)

//	GetImage
//
//	Returns the image by UNID (loading it, if necessary)

	{
	//	Find the image in the library

	int iEntry;
	if (m_Library.LookupEx(dwUNID, &iEntry) != NOERROR)
		return NULL;

	CObjectImage *pImage = (CObjectImage *)m_Library.GetValue(iEntry);

	return pImage->GetImage();
	}
Example #6
0
CG16bitImage *CImageLibrary::GetImageCopy (DWORD dwUNID)

//	GetImageCopy
//
//	Returns a copy of the image by UNID (caller is responsible for
//	freeing the returned object)

	{
	//	Find the image in the library

	int iEntry;
	if (m_Library.LookupEx(dwUNID, &iEntry) != NOERROR)
		return NULL;

	CObjectImage *pImage = (CObjectImage *)m_Library.GetValue(iEntry);

	return pImage->CreateCopy();
	}
CG16bitImage *CDesignCollection::GetImage (DWORD dwUNID, bool bCopy)

//	GetImage
//
//	Returns an image

	{
	CDesignType *pType = m_AllTypes.FindByUNID(dwUNID);
	if (pType == NULL)
		return NULL;

	CObjectImage *pImage = CObjectImage::AsType(pType);
	if (pImage == NULL)
		return NULL;

	if (bCopy)
		return pImage->CreateCopy();
	else
		return pImage->GetImage();
	}
Example #8
0
CG32bitImage *CExtension::GetCoverImage (void) const

//	GetCoverImage
//
//	Returns the cover image (or NULL if none). The caller does NOT need to free
//	the image. However, the caller should not user the image past a SweepImages
//	call.

	{
	if (m_pCoverImage)
		return m_pCoverImage;

	//	Adventure desc overrides our UNID

	DWORD dwCoverUNID = m_dwCoverUNID;
	if (m_pAdventureDesc
			&& m_pAdventureDesc->GetBackgroundUNID() != 0)
		dwCoverUNID = m_pAdventureDesc->GetBackgroundUNID();

	if (dwCoverUNID == 0)
		return NULL;

	//	Find the image object

	CObjectImage *pObjImage = CObjectImage::AsType(m_DesignTypes.FindByUNID(dwCoverUNID));
	if (pObjImage == NULL)
		return NULL;

	//	Load the image

	g_pUniverse->SetLogImageLoad(false);
	m_pCoverImage = pObjImage->CreateCopy();
	g_pUniverse->SetLogImageLoad(true);

	//	Done

	return m_pCoverImage;
	}
Example #9
0
ALERROR CImageLibrary::AddImage (SDesignLoadCtx &Ctx, CXMLElement *pDesc)

//	AddImage
//
//	Add an image to the library

	{
	ALERROR error;

	//	Create the image desc

	CObjectImage *pNewImage;
	if (error = CObjectImage::CreateFromXML(Ctx, pDesc, &pNewImage))
		return error;

	//	If we defer loading, at least make sure that the images exist

	if (pDesc->GetAttributeBool(LOAD_ON_USE_ATTRIB))
		{
		if (error = pNewImage->Exists(Ctx))
			{
			delete pNewImage;
			return error;
			}
		}

	//	Otherwise, load and lock the image

	else
		{
		if (error = pNewImage->Lock(Ctx))
			{
			delete pNewImage;
			return error;
			}
		}

	//	Add to the library

	if (error = m_Library.AddEntry(pNewImage->GetUNID(), (CObject *)pNewImage))
		{
		if (FindImage(pNewImage->GetUNID()))
			Ctx.sError = strPatternSubst(CONSTLIT("Duplicate UNID: %x"), pNewImage->GetUNID());
		else
			Ctx.sError = strPatternSubst(CONSTLIT("Unable to add image to library: %x"), pNewImage->GetUNID());
		delete pNewImage;
		return error;
		}

	return NOERROR;
	}
Example #10
0
CG32bitImage *CDesignCollection::GetImage (DWORD dwUNID, DWORD dwFlags)

//	GetImage
//
//	Returns an image

	{
	CDesignType *pType = m_AllTypes.FindByUNID(dwUNID);
	if (pType == NULL)
		return NULL;

	CObjectImage *pImage = CObjectImage::AsType(pType);
	if (pImage == NULL)
		return NULL;

	if (dwFlags & FLAG_IMAGE_COPY)
		return pImage->CreateCopy();
	else
		{
		CString sError;
		CG32bitImage *pRawImage = pImage->GetImage(strFromInt(dwUNID), &sError);

		if (pRawImage == NULL)
			kernelDebugLogMessage(sError);

		//	Lock, if requested. NOTE: Since we obtained the image above,
		//	this call is guaranteed to succeed.

		if (dwFlags & FLAG_IMAGE_LOCK)
			pImage->Lock(SDesignLoadCtx());

		//	Done

		return pRawImage;
		}
	}
Example #11
0
//==============================================================================
// Brief  : 要素の生成処理
// Return : int							: 登録ID
// Arg    : int type						: 種類
// Arg    : int priorityUpdate				: 更新優先度
// Arg    : int priorityDraw				: 描画優先度
//==============================================================================
int CManagerObjectImage::Create( int type, int priorityUpdate, int priorityDraw )
{
	// 種類ごとの処理
	CTexture*	pTexture = nullptr;
	switch( type )
	{
	// タイトル・ロゴ
	case TYPE_TITLE_LOGO:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "title/title_logo.png" ) ) );
		break;

	// タイトル・プレスキー
	case TYPE_TITLE_PRESS_KEY:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "title/PressStart.png" ) ) );
		break;

	// タイトル・ゲームスタート
	case TYPE_TITLE_GAME_START:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "title/GameStart.png" ) ) );
		break;

	// タイトル・チュートリアル
	case TYPE_TITLE_GAME_TUTORIAL:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "title/Tutorial.png" ) ) );
		break;

	// タイトル・ランキング
	case TYPE_TITLE_GAME_RANKING:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "title/Ranking.png" ) ) );
		break;

	// タイトル・設定
	case TYPE_TITLE_GAME_OPTION:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "title/Option.png" ) ) );
		break;

	// タイトル・終了
	case TYPE_TITLE_GAME_EXIT:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "title/Exit.png" ) ) );
		break;

	// リザルト・ロゴ
	case TYPE_RESULT_LOGO:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "result/Result.png" ) ) );
		break;

	// ポーズ・ロゴ
	case TYPE_PAUSE_LOGO:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "game/PauseLogo.png" ) ) );
		break;

	// ポーズ・メニュー
	case TYPE_PAUSE_MENU:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "game/PauseMenu.png" ) ) );
		break;

	// ポーズ・カーソル
	case TYPE_PAUSE_CURSOR:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "game/pause_arrow.png" ) ) );
		break;


	//	NAGASAKI追加
	//	丸いエフェクト
	case TYPE_EFFECT:
		pTexture = m_pTexture->Get( m_pTexture->Load( _T( "game/effect.jpg" ) ) );
		break;

	// その他
	default:
		break;
	}

	// オブジェクトの生成
	CObjectImage*	pObject = nullptr;
	pObject = new CObjectImage();
	if( pObject == nullptr )
	{
		ThrowExceptionBadAllocation();
	}
	pObject->SetSize( pTexture->m_width, pTexture->m_height );

	// ステートテーブルの設定
	pObject->SetStateTable( m_ppTableState );

	// 種類ごとの処理
	switch( type )
	{
	// ポーズカーソル
	case TYPE_PAUSE_CURSOR:
		pObject->ShiftState( CObjectImage::STATE_CURSOR );
		break;

	// その他
	default:
		pObject->ShiftState( CObjectImage::STATE_NONE );
		break;
	}

	// 描画オブジェクトの生成
	CGraphicSet2D*		pGraphic = nullptr;
	pGraphic = new CGraphicSet2D( 1, m_pRenderMatrix, m_pDraw->GetGraphicDevice(), m_pPolygon, pTexture );
	if( pGraphic == nullptr )
	{
		ThrowExceptionBadAllocation();
	}
	pGraphic->SetRenderParameter( 0, m_pRenderParameterPolygon );
	pObject->SetGraphic( pGraphic );

	// 更新リストへ登録
	pObject->SetIdUpdate( m_pUpdate->RegisterItem( pObject, priorityUpdate ) );

	// 描画リストへ登録
	pObject->SetIdDraw( m_pDraw->RegisterItem( pGraphic, priorityDraw ) );

	// 要素の登録
	int		idRegister = m_idCurrent;		// 返却ID
	m_pImage->Register( m_idCurrent, type, pObject, pGraphic );
	++m_idCurrent;
	return idRegister;
}