Exemple #1
0
void CStageDynamic::Astar_Move()
{
	list<int>* pBestList = GET_SINGLE(CAstar)->GetBestList();
	if (pBestList->empty()) //비어있으면 리턴 
	{
		return;
	}

	const vector<TILE*>* pVecTile = GET_SINGLE(CObjMgr)->GetTileInfo();

	int nDestIdx = pBestList->front();
	m_Info.vDir = (*pVecTile)[nDestIdx]->vPos - m_Info.vPos;

	float fDistance = D3DXVec3Length(&m_Info.vDir);

	D3DXVec3Normalize(&m_Info.vDir,&m_Info.vDir);

	m_Info.vPos += m_Info.vDir * 100.f * GET_SINGLE(CTimeMgr)->GetTime();
	
	if (fDistance < 5.f)
	{
		pBestList->pop_front();
	}


}
Exemple #2
0
void CObj::drawTexture(CInfo_Obj* inputInfo, RefPos option_RF, int iCnt, const TCHAR * in_pObjType, const TCHAR * in_pObjName, const TCHAR * in_pTextureName, const TCHAR * in_pStateKey,
	int opacity)
{
	const TEXINFO* pTexInfo = GET_SINGLE(CTextureMgr)->GetTexture(in_pObjType, in_pObjName, in_pTextureName, in_pStateKey, iCnt);
	if (pTexInfo == NULL)
	{
		TRACE(L"GetTexture 실패 (%s %s %s %s)\n", in_pObjType, in_pObjName, in_pTextureName, in_pStateKey);
		return;
	}

	GET_SINGLE(CDeviceMgr)->GetSprite()->SetTransform(&inputInfo->getMatWorld());
	

	if (opacity > 255 || opacity < 0)	{ //투명도 범위 체크
		ERR_MSG(g_hWnd, L"Opacity 수치 확인 바람. 0 <= opacity <= 255 를 반드시 충족해야 함.");
		return;
	}
		

	switch (option_RF)
	{
	case RefPos_LeftTop:
		GET_SINGLE(CDeviceMgr)->GetSprite()->Draw(pTexInfo->pTexture, NULL, NULL, NULL,  D3DCOLOR_ARGB(opacity, 255, 255, 255));
		break;
	
	case RefPos_Center:
		inputInfo->setCenter(D3DXVECTOR3(pTexInfo->ImgInfo.Width / 2.f, pTexInfo->ImgInfo.Height / 2.f, 0.f));
		GET_SINGLE(CDeviceMgr)->GetSprite()->Draw(pTexInfo->pTexture, NULL, &inputInfo->getCenter(), NULL, D3DCOLOR_ARGB(opacity, 255, 255, 255));
		break;
	}
}
void CMy150716MapToolmfcView::OnDraw(CDC* /*pDC*/)
{
	CMy150716MapToolmfcDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: 여기에 원시 데이터에 대한 그리기 코드를 추가합니다.

	/*const TEXINFO* pTexInfo = GET_SINGLE(CTextureMgr)->GetTexture(L"Test");

	if (pTexInfo == NULL)
	{
		return;
	}	*/

	GET_SINGLE(CDevice)->Render_Begin();

	//for (unsigned int i = 0; i<m_vecTile.size(); ++i)
	for(int i = 0; i<18+1; ++i)
	{
		for (int j =0; j<6+1; ++j)
		{
			int nIndex =  (i + GetScrollPos(1)/(TILESIZEY/2)) * TILECNTX + ( j + (GetScrollPos(0)/(TILESIZEX)));

			if (nIndex >= TILECNTX * TILECNTY || nIndex < 0)
			{
				continue;
			}

			const TEXINFO* pTexInfo = GET_SINGLE(CTextureMgr)->GetTexture(L"BackGround",L"Tile"
				,m_vecTile[nIndex]->byDrawId);

			if(pTexInfo == NULL)
				return;

			D3DXMATRIX matWorld;
			D3DXMATRIX matTrans;
			D3DXMatrixTranslation(&matTrans,m_vecTile[nIndex]->vPos.x - GetScrollPos(0), m_vecTile[nIndex]->vPos.y - GetScrollPos(1), m_vecTile[nIndex]->vPos.z);

			//크자이공부
			matWorld = matTrans;

			GET_SINGLE(CDevice)->GetSprite()->SetTransform(&matWorld);
			GET_SINGLE(CDevice)->GetSprite()->Draw(pTexInfo->pTexture, NULL, &D3DXVECTOR3(65, 34,0),NULL,D3DCOLOR_ARGB(255,255,255,255));
		}
	}

	GET_SINGLE(CDevice)->Render_End(m_hWnd);

	CMainFrame* pMainFrm = (CMainFrame*)AfxGetMainWnd();
	
	pMainFrm->m_pMiniView->Invalidate(FALSE);
	

}
Exemple #4
0
void CLogo::Progress( void )
{	
	GET_SINGLE(CTimeMgr)->SetTime();
	SCENE SceneID = GET_SINGLE(CObjMgr)->Progress();

	if(SceneID >= 0)
	{
		GET_SINGLE(CSceneMgr)->InitScene(SceneID);
		return;
	}
}
Exemple #5
0
void CStage::Progress()
{
	GET_SINGLE(CTimeMgr)->SetTime();

	SCENE SceneID = GET_SINGLE(CObjMgr)->Progress();

	if (SceneID >= 0) //다른씬이 생기면 넘어갈수 있게함
	{
		GET_SINGLE(CSceneMgr)->InitScene(SceneID);
		return;
	}
	
}
void CMy150716MapToolmfcView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();
	
	m_nSelDrawID = 0;
	SetScrollSizes(MM_TEXT,CSize(TILESIZEX * TILECNTX , TILESIZEY * TILECNTY/2));
	
	
	// TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다.

	if (FAILED(GET_SINGLE(CDevice)->InitDevice(m_hWnd)))
	{
		return;
	}

	if (FAILED(GET_SINGLE(CTextureMgr)->InsertTexture(L"../Resource/Texture/Tile/Tile37.png",L"Test",TEXTYPE_SINGLE)))
	{
		AfxMessageBox(L"이미지 로드 실패1");
		return;
	}

	if(FAILED(GET_SINGLE(CTextureMgr)->InsertTexture(L"../Resource/Texture/Tile/Tile%d.png"
		,L"BackGround",TEXTYPE_MULTI,L"Tile",38)))
	{
		AfxMessageBox(L"이미지 로드 실패2");
		return;
	}


	//mainframe mfc를 전체적으로 관리하고 있는 애 
	CMainFrame* pMainFrm =(CMainFrame*)AfxGetMainWnd(); 
	
	RECT rcWindow;
	pMainFrm->GetWindowRect(&rcWindow); //w전체 윈도우의 rect를 얻어올수있음

	SetRect(&rcWindow,0,0,rcWindow.right - rcWindow.left,
		rcWindow.bottom - rcWindow.top);

	RECT rcMainView;
	GetClientRect(&rcMainView); //view 좌표 , 클라이언트의 rect

	float fRowFrm = rcWindow.bottom - rcMainView.bottom;
	float fColFrm = rcWindow.right - rcMainView.right;

	pMainFrm->SetWindowPos(NULL,0,0,800+fColFrm,600+fRowFrm,SWP_NOZORDER);
	


	InitTile();

}
Exemple #7
0
void CStageBack::MapScroll()
{
	POINT ptMouse;

	GetCursorPos(&ptMouse);
	ScreenToClient(g_hWnd,&ptMouse);

	if(WINSIZEX - 2  <= ptMouse.x)
		m_vScroll.x -= 100.f * GET_SINGLE(CTimeMgr)->GetTime();
	if(2>= ptMouse.x)
		m_vScroll.x += 100.f * GET_SINGLE(CTimeMgr)->GetTime();
	if(WINSIZEY - 2 <= ptMouse.y )
		m_vScroll.y -= 100.f * GET_SINGLE(CTimeMgr)->GetTime();
	if(2 >= ptMouse.y)
		m_vScroll.y += 100.f * GET_SINGLE(CTimeMgr)->GetTime();
}
Exemple #8
0
void CObj::Frame_Move(const float& fCnt
					  , const float& fMax)
{
	m_fFrame += fCnt * GET_SINGLE(CTimeMgr)->GetTime();

	if(m_fFrame > fMax)
		m_fFrame = 0.f;	
}
Exemple #9
0
void CLogo_Button::Render( void )
{
	if(m_bRenderCheck == true)
	{
			const TEXINFO*	pTexInfo = GET_SINGLE(CTextureMgr)->GetTexture(m_pObjKey);

		if(pTexInfo == NULL)
			return;

		m_Info.vCenter = D3DXVECTOR3(pTexInfo->ImgInfo.Width / 2.f
			, pTexInfo->ImgInfo.Height / 2.f, 0.0f);

		GET_SINGLE(CDevice)->GetSprite()->SetTransform(&m_Info.matWorld);
		GET_SINGLE(CDevice)->GetSprite()->Draw(pTexInfo->pTexture, NULL
			, &m_Info.vCenter, NULL, D3DCOLOR_ARGB(255, 255, 255, 255));
	}

}
Exemple #10
0
void CStageDynamic::Chase_Move( const OBJINFO& DestInfo )
{
	m_Info.vDir = DestInfo.vPos - m_Info.vPos; //방향 
	
	D3DXVec3Normalize(&m_Info.vDir,&m_Info.vDir);

	m_Info.vPos += m_Info.vDir * 100.f * GET_SINGLE(CTimeMgr)->GetTime();

}
Exemple #11
0
HRESULT CLogo::Initialize( void )
{
	GET_SINGLE(CTimeMgr)->InitTimeMgr();


	// 객체를 생성하기위한 준비
	m_pPrototype = new CLogoObjProto;
	if(FAILED(m_pPrototype->InitProtoInstance()))
	{
		ERR_MSG(g_hWnd, L"원형객체생성실패");
		return E_FAIL;
	}

	if(FAILED(GET_SINGLE(CObjMgr)->AddObject(m_pPrototype, L"LogoBack")))
	{
		ERR_MSG(g_hWnd, L"객체생성실패");
		return E_FAIL;
	}

	if(FAILED(GET_SINGLE(CObjMgr)->AddObject(m_pPrototype, L"LogoButton")))
	{
		ERR_MSG(g_hWnd, L"객체생성실패");
		return E_FAIL;
	}

	if(FAILED(GET_SINGLE(CTextureMgr)->InsertTexture(L"../Resource/Texture/Logo/BackGround.png"
		, L"LogoBack", TEXTYPE_SINGLE)))
	{
		ERR_MSG(g_hWnd, L"LogoBackTexture Loading Failed");
		return E_FAIL;
	}

	if(FAILED(GET_SINGLE(CTextureMgr)->InsertTexture(L"../Resource/Texture/Logo/Login.png"
		, L"LogoButton", TEXTYPE_SINGLE)))
	{
		ERR_MSG(g_hWnd, L"BallTexture Loading Failed");
		return E_FAIL;
	}

	return S_OK;
}
Exemple #12
0
HRESULT CStage::Initialize()
{
	GET_SINGLE(CTimeMgr)->InitTimeMgr();

	//객체를 생성하기 위한 준비
	m_pPrototype = new CStageObjProto;
	if (FAILED(m_pPrototype->InitProtoInstance()))
	{
		ERR_MSG(g_hWnd,L"원형 객체 생성 실패");
		return E_FAIL;
	}

	if (FAILED(GET_SINGLE(CObjMgr)->AddObject(m_pPrototype,L"StageBack")))
	{
		ERR_MSG(g_hWnd,L"객체 생성 실패");
		return E_FAIL;
	}

	if (FAILED(GET_SINGLE(CObjMgr)->AddObject(m_pPrototype,L"Player")))
	{
		ERR_MSG(g_hWnd,L"객체 생성 실패");
		return E_FAIL;
	}

	if (FAILED(GET_SINGLE(CTextureMgr)->InsertTexture(L"../Resource/Texture/Tile/Tile%d.png",L"StageBack",TEXTYPE_MULTI,L"Tile",38)))
	{
		ERR_MSG(g_hWnd,L"StageTileTexture 실패");
		return E_FAIL;
	}

	if (FAILED(GET_SINGLE(CTextureMgr)->InsertTexture(L"../Resource/Texture/Stage/Player/Stand/archon%04d.bmp",L"Player",TEXTYPE_MULTI,L"Stand",27)))
	{
		ERR_MSG(g_hWnd,L"Player Texture 실패");
		return E_FAIL;
	}


	return S_OK;
}
Exemple #13
0
int CObj::GetTileIndex(const D3DXVECTOR3& vPos)
{
	const vector<TILE*>* pVecTile = GET_SINGLE(CObjMgr)->GetTileInfo();

	for (unsigned int i = 0; i < pVecTile->size(); ++i)
	{
		if(CollisionMouseToTile(vPos, (*pVecTile)[i]))
		{
			return i;
		}
	}	
	return -1;
}
void CMy150716MapToolmfcView::OnDestroy()
{
	CScrollView::OnDestroy();

	GET_SINGLE(CDevice)->DestroyInstance();

	for (unsigned int i = 0; i<m_vecTile.size(); ++i)
	{
		delete m_vecTile[i];
		m_vecTile[i] = NULL;
	}
	m_vecTile.clear();


	// TODO: 여기에 메시지 처리기 코드를 추가합니다.
}
Exemple #15
0
void CStageDynamic::Astar_start( const D3DXVECTOR3& vDestPos, const D3DXVECTOR3& vSourPos )
{
	int nStartId = GetTileIndex(vDestPos);

	if (nStartId < 0)
	{
		return;
	}

	int nGoalIdx = GetTileIndex(vSourPos);

	if (nGoalIdx < 0)
	{
		return;
	}
	
	GET_SINGLE(CAstar)->AstarStart(nStartId,nGoalIdx);
}
Exemple #16
0
HRESULT CSingleTexture::InsertTexture( const TCHAR* pFileName 
									  , const TCHAR* pStateKey/* = 0*/, const int& iCnt/* = 0*/)
{
	m_pTexInfo = new TEXINFO;
	ZeroMemory(m_pTexInfo, sizeof(TEXINFO));

	if(FAILED(D3DXGetImageInfoFromFile(pFileName, &m_pTexInfo->ImgInfo)))
		return E_FAIL;

	if(FAILED(D3DXCreateTextureFromFileEx(GET_SINGLE(CDevice)->GetDevice()
		, pFileName, m_pTexInfo->ImgInfo.Width
		, m_pTexInfo->ImgInfo.Height, m_pTexInfo->ImgInfo.MipLevels
		, 0, m_pTexInfo->ImgInfo.Format
		, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT
		, D3DCOLOR_ARGB(255, 255, 0, 0)
		, &m_pTexInfo->ImgInfo
		, NULL, &m_pTexInfo->pTexture)))
		return E_FAIL;
	return S_OK;
}
Exemple #17
0
void CLogo::Render( void )
{
	GET_SINGLE(CObjMgr)->Render();
}
Exemple #18
0
void CStage::Render()
{
	GET_SINGLE(CObjMgr)->Render();


}
Exemple #19
0
void CStageBack::Render()
{
	D3DXMATRIX matTrans;

	TCHAR szTmp[128] = L"";

	//for (unsigned int i=0; i<m_vecTile.size(); ++i)
	
	for (int i = 0; i< 19; ++i)
	{
		for (int j = 0; j<8; ++j)
		{
			int nIndex = (i + -int(m_vScroll.y)/(TILESIZEY/2)) * TILECNTX + (j + -int(m_vScroll.x)/TILESIZEX);
					
					
			if(nIndex >= TILECNTX * TILECNTY || nIndex<0 )
				continue;

			const TEXINFO* pTexInfo= GET_SINGLE(CTextureMgr)->GetTexture(m_pObjKey,m_pStateKey,m_vecTile[nIndex]->byDrawId);

			if (pTexInfo == NULL)
			{
				return;
			}			

			D3DXMatrixTranslation(&matTrans,m_vecTile[nIndex]->vPos.x+m_vScroll.x, m_vecTile[nIndex]->vPos.y+m_vScroll.y, m_vecTile[nIndex]->vPos.z);

			m_Info.matWorld = matTrans;


			m_Info.matWorld = matTrans;

			m_Info.vCenter = D3DXVECTOR3(65.f, 34.f, 0.f);

			GET_SINGLE(CDevice)->GetSprite()->SetTransform(&m_Info.matWorld);
			GET_SINGLE(CDevice)->GetSprite()->Draw(pTexInfo->pTexture, NULL,&m_Info.vCenter, NULL, D3DCOLOR_ARGB(255,255,255,255));

			wsprintf(szTmp,L"%d",nIndex);

			RECT	rcRect = {0};
			GET_SINGLE(CDevice)->GetFont()->DrawTextW(GET_SINGLE(CDevice)->GetSprite(),szTmp,lstrlen(szTmp),&rcRect,DT_NOCLIP,D3DCOLOR_ARGB(255,0,0,0));

		}		
	}

	D3DXVECTOR2 vPoint[4];

	vPoint[0] = D3DXVECTOR2(400.f, 300.f);
	vPoint[1] = D3DXVECTOR2(500.f, 400.f);
	vPoint[2] = D3DXVECTOR2(300.f, 400.f);
	vPoint[3] = D3DXVECTOR2(400.f, 300.f);

	GET_SINGLE(CDevice)->GetSprite()->End();
	GET_SINGLE(CDevice)->GetDevice()->EndScene();

	GET_SINGLE(CDevice)->GetDevice()->BeginScene();
	GET_SINGLE(CDevice)->GetSprite()->Begin(D3DXSPRITE_ALPHABLEND);

	GET_SINGLE(CDevice)->GetLine()->SetWidth(10.f);
	GET_SINGLE(CDevice)->GetLine()->Draw(vPoint,4,D3DCOLOR_ARGB(255,255,0,0));

	GET_SINGLE(CDevice)->GetSprite()->End();
	GET_SINGLE(CDevice)->GetDevice()->EndScene();

	GET_SINGLE(CDevice)->GetDevice()->BeginScene();
	GET_SINGLE(CDevice)->GetSprite()->Begin(D3DXSPRITE_ALPHABLEND);



}