void CStage::Render()
{
/*
맵은 스크톨 처리하여, 현재 플레이어가 이동한 위치로부터 맵을 출력해줌
출력 크기는 세로 4칸 가로 10칸으로 해줌
0 : 벽
1 : 길
2 : 시작점
3 : 도착점
4 : 코인
*/
CPlayer* pPlayer = CObjectManager::GetInst()->GetPlayer();
int player_Coin = pPlayer->GetCoin();
//플레이어의 x,y 좌표를 얻어온다
int player_iX = pPlayer->GetX();
int player_iY = pPlayer->GetY();
// 맵의 출력은 플레이어의 위치를 중심으로 출력
// 세로는 플레이어 2칸위부터 한칸 아래까지 출력
// 총 4줄이 출력되는것이다
// 가로는 플레이어 위치부터 오른쪽 10칸 까지 출력함
constexpr int iClientPadding_left = 0;
constexpr int iClientPadding_Top = -2;
constexpr int iClientPadding_Right = 9;
constexpr int iClientPadding_Bottom = 1;
int iClientHeight_start = player_iY + iClientPadding_Top;
int iClientHeight_end = player_iY + iClientPadding_Bottom;
int iClientWidth_start = player_iX + iClientPadding_left;
int iClientWidth_end = player_iX + iClientPadding_Right;
//맵 끝에 거의 도달했을때 가로 스크롤 멈춤
if (iClientWidth_start >= g_iMAP_WIDTH - iClientPadding_Right)
{
iClientWidth_start = g_iMAP_WIDTH - iClientPadding_Right;
}
if (iClientWidth_end > g_iMAP_WIDTH)
{
iClientWidth_end = g_iMAP_WIDTH;
}
for (int i = iClientHeight_start; i <= iClientHeight_end; ++i)
{
for (int j = iClientWidth_start; j < iClientWidth_end; ++j)
{
if (i == player_iY && j == player_iX)
{
std::cout << "§";
}
else if (m_cStage[i][j] == SBT_WALL)
{
std::cout << "■";
}
else if (m_cStage[i][j] == SBT_ROAD)
{
std::cout << " ";
}
else if (m_cStage[i][j] == SBT_START)
{
std::cout << "☆";
}
else if (m_cStage[i][j] == SBT_END)
{
std::cout << "★";
}
else if (m_cStage[i][j] == SBT_COIN)
{
std::cout << "◎";
}
}
std::cout << std::endl;
}
std::cout << "coin : "<< player_Coin << std::endl;
std::cout << "Left : ← " << " Right : → " << std::endl;
std::cout << "Jump : space bar "<< std::endl;
}