Example #1
0
RImage* QSLItemData::Load(
	CString& strDocPathname,		// @parm string containing document pathname
	BOOL     fDescOnly )
{
    USES_CONVERSION;

	LPSTORAGE	pIStorage = NULL;

	// get path name in Unicode
	const WCHAR *pDocPathname = T2COLE((LPCTSTR)strDocPathname.GetBuffer (10));
	strDocPathname.ReleaseBuffer();

	// open storage
	StgOpenStorage( pDocPathname, NULL, STGM_DIRECT | STGM_READ | STGM_SHARE_EXCLUSIVE, NULL, 0, &pIStorage );

	if (!pIStorage)
		return NULL ;

	RImage* pImage = Load2( pIStorage, fDescOnly );
	
	if (dynamic_cast<RBitmapImage *>( pImage ))
		((RBitmapImage *) pImage)->LockImage();

	// release storage
	pIStorage->Release();

	return( pImage );
}
Example #2
0
void ActorScroller::LoadFromNode( const XNode *pNode )
{
	ActorFrame::LoadFromNode( pNode );

	Load2();

	float fNumItemsToDraw = 0;
	if( pNode->GetAttrValue("NumItemsToDraw", fNumItemsToDraw) )
		SetNumItemsToDraw( fNumItemsToDraw );

	float fSecondsPerItem = 0;
	if( pNode->GetAttrValue("SecondsPerItem", fSecondsPerItem) )
		ActorScroller::SetSecondsPerItem( fSecondsPerItem );

	Lua *L = LUA->Get();
	pNode->PushAttrValue( L, "TransformFunction" );
	{
		LuaReference ref;
		ref.SetFromStack( L );
		if( !ref.IsNil() )
			SetTransformFromReference( ref );
	}
	LUA->Release( L );

	int iSubdivisions = 1;
	if( pNode->GetAttrValue("Subdivisions", iSubdivisions) )
		ActorScroller::SetNumSubdivisions( iSubdivisions );

	bool bUseMask = false;
	pNode->GetAttrValue( "UseMask", bUseMask );

	if( bUseMask )
	{
		pNode->GetAttrValue( "MaskWidth", m_fMaskWidth );
		pNode->GetAttrValue( "MaskHeight", m_fMaskHeight );
		EnableMask( m_fMaskWidth, m_fMaskHeight );
	}

	pNode->GetAttrValue( "QuantizePixels", m_fQuantizePixels );
}
Example #3
0
DrImage::DrImage(int argc, char *argv){
  NFile = 0;
  NWidth = 0;
  NHeight = 0;
  for(int c=0;c<argc;c++){
    if(!strncmp(argv[i],"-",1)){
      continue;
    }

    NFile++;
  }
  FileList = (char **)calloc(NFile,sizeof(char));
  for(int c=0,f=0;c<argc;c++){
    if(!strncmp(argv[i],"-",1)){
      continue;
    }
    FileList[f] = (char *)calloc(120,sizeof(char));
    sprintf(FileList[f],argv[c]);
    f++;
  }
  Load(FileList[0]);
  Load2(FileList[NFile-1]);
}
bool LoadState::Input()
{
	SGD::InputManager* pInput = SGD::InputManager::GetInstance();

	if (pInput->IsKeyPressed(SGD::Key::Escape) || pInput->IsButtonDown(0, 6))
	{
		Game::GetInstance()->RemoveState();
	}

	if (pInput->GetCursorMovement().x || pInput->GetCursorMovement().y)
	{
		if (pInput->GetCursorPosition().IsPointInRectangle(newRect))
			m_nCursor = 0;
		else if (pInput->GetCursorPosition().IsPointInRectangle(saveslot1))
			m_nCursor = 1;
		else if (pInput->GetCursorPosition().IsPointInRectangle(saveslot2))
			m_nCursor = 2;
		else if (pInput->GetCursorPosition().IsPointInRectangle(saveslot3))
			m_nCursor = 3;
		else if (pInput->GetCursorPosition().IsPointInRectangle(exit))
			m_nCursor = 4;
		else
			m_nCursor = -1;
	}
	if (m_fArcadeTimer >= 1.0f)
	{
		if (pInput->IsKeyPressed(SGD::Key::Left) || pInput->IsKeyPressed(SGD::Key::A) || pInput->GetLeftJoystick(0).x == -1)
		{
			m_nCursor--;
			if (m_nCursor < 0)
				m_nCursor = 4;

			m_fArcadeTimer = 0.0f;

		}
		else if (pInput->IsKeyPressed(SGD::Key::Right) || pInput->IsKeyPressed(SGD::Key::D) || pInput->GetLeftJoystick(0).x == 1)
		{
			m_nCursor++;
			if (m_nCursor > 4)
				m_nCursor = 0;

			m_fArcadeTimer = 0.0f;

		}
		else if (pInput->IsKeyPressed(SGD::Key::Up) || pInput->IsKeyPressed(SGD::Key::W) || pInput->GetLeftJoystick(0).y == -1)
		{
			m_nCursor--;
			if (m_nCursor < 0)
				m_nCursor = 4;

			m_fArcadeTimer = 0.0f;

		}
		else if (pInput->IsKeyPressed(SGD::Key::Down) || pInput->IsKeyPressed(SGD::Key::S) || pInput->GetLeftJoystick(0).y == 1)
		{
			m_nCursor++;
			if (m_nCursor > 4)
				m_nCursor = 0;

			m_fArcadeTimer = 0.0f;

		}
	}

	if (pInput->IsKeyPressed(SGD::Key::Enter) || pInput->IsKeyPressed(SGD::Key::MouseLeft) || pInput->IsButtonDown(0, 0))
	{
		switch (m_nCursor)
		{
		case 0:
			Game::GetInstance()->AddState(GameplayState::GetInstance());
			break;
		case 1:
			Load("resource/Save/Save.xml");
			break;
		case 2:
			Load2("resource/Save/Save2.xml");
			break;
		case 3:
			Load3("resource/Save/Save3.xml");
			break;
		case 4:
			Game::GetInstance()->RemoveState();
			break;
		default:
			break;
		}
	}

	return true;
}