<commit_before>#include "pch.h"
#include "View.h"
#include "GameLayer.h"
#include "GameManager.h"
#include "StageManager.h"
#include "DataManager.h"




void Arthas::View::setViewPort(cocos2d::Layer* layer, cocos2d::Point playerPosInRoomLayer, cocos2d::Point anchorPoint)
{
	
	int curFloorIdx = GET_STAGE_MANAGER()->getStageNum();
	int curRoomIdx = GET_STAGE_MANAGER()->getRoomNum();

	if (curFloorIdx == -1 || curRoomIdx == -1) return;

	cocos2d::Size curRoomSize;
	cocos2d::Point curRoomLayerPos;
	cocos2d::Point playerPosInGameLayer;

	Arthas::RoomData curRoomData = GET_DATA_MANAGER()->getRoomData(curFloorIdx, curRoomIdx);
	cocos2d::Size tileSize = GET_DATA_MANAGER()->getTileSize();

	float windowWidth = cocos2d::Director::getInstance()->getWinSize().width;
	float windowHeight = cocos2d::Director::getInstance()->getWinSize().height;
 	float anchorX = windowWidth * anchorPoint.x;
	float anchorY = windowHeight * anchorPoint.y;

	curRoomLayerPos.x = curRoomData.x * tileSize.width;
	curRoomLayerPos.y = curRoomData.y * tileSize.height;

	curRoomSize.width = curRoomData.width * tileSize.width;
	curRoomSize.height = curRoomData.height * tileSize.height;

	playerPosInGameLayer.x = curRoomLayerPos.x + playerPosInRoomLayer.x;
	playerPosInGameLayer.y = curRoomLayerPos.y + playerPosInRoomLayer.y;

	if (playerPosInRoomLayer.x + anchorX > curRoomSize.width)
	{
		anchorX = playerPosInRoomLayer.x - (curRoomSize.width - windowWidth);
	}
	if (playerPosInRoomLayer.x - anchorX < 0)
	{
		//÷̾ Room   ִ  
		anchorX = playerPosInRoomLayer.x;
		//࿡ 0ϸ     ʴ´.  
		//anchorX = 0;
	}


	if (playerPosInRoomLayer.y + anchorY > curRoomSize.height)
	{
		anchorY = playerPosInRoomLayer.y - (curRoomSize.height - windowHeight);
	}
	if (playerPosInRoomLayer.y - anchorY < 0)
	{
		anchorY = playerPosInRoomLayer.y;
	}

	layer->setPosition(anchorX - playerPosInGameLayer.x, anchorY - playerPosInGameLayer.y);

//	layer->setPosition(anchorX - playerPosInRoomLayer.x, anchorY - playerPosInRoomLayer.y);
}
<commit_msg>view실험 한거 처리<commit_after>#include "pch.h"
#include "View.h"
#include "GameLayer.h"
#include "GameManager.h"
#include "StageManager.h"
#include "DataManager.h"




void Arthas::View::setViewPort(cocos2d::Layer* layer, cocos2d::Point playerPosInRoomLayer, cocos2d::Point anchorPoint)
{
	
	int curFloorIdx = GET_STAGE_MANAGER()->getStageNum();
	int curRoomIdx = GET_STAGE_MANAGER()->getRoomNum();

	if (curFloorIdx == -1 || curRoomIdx == -1) return;

	static bool isChangingAxisX = false;

	cocos2d::Size curRoomSize;
	cocos2d::Point curRoomLayerPos;
	cocos2d::Point playerPosInGameLayer;

	Arthas::RoomData curRoomData = GET_DATA_MANAGER()->getRoomData(curFloorIdx, curRoomIdx);
	cocos2d::Size tileSize = GET_DATA_MANAGER()->getTileSize();

	float windowWidth = cocos2d::Director::getInstance()->getWinSize().width;
	float windowHeight = cocos2d::Director::getInstance()->getWinSize().height;
 	float anchorX = windowWidth * anchorPoint.x;
	float anchorY = windowHeight * anchorPoint.y;

	curRoomLayerPos.x = curRoomData.x * tileSize.width;
	curRoomLayerPos.y = curRoomData.y * tileSize.height;

	curRoomSize.width = curRoomData.width * tileSize.width;
	curRoomSize.height = curRoomData.height * tileSize.height;

	playerPosInGameLayer.x = curRoomLayerPos.x + playerPosInRoomLayer.x;
	playerPosInGameLayer.y = curRoomLayerPos.y + playerPosInRoomLayer.y;


	/*if (playerPosInRoomLayer.x >= curRoomSize.width - windowWidth / 2 )
	{
	playerPosInRoomLayer.x = curRoomSize.width - windowWidth / 2;
	}
	else if (playerPosInRoomLayer.x <= windowWidth / 2)
	{
	playerPosInRoomLayer.x = windowWidth;
	}
	else
	{

	}*/
	//layer->setPosition(-curRoomLayerPos.x, -curRoomLayerPos.y);


	if (playerPosInRoomLayer.x + anchorX > curRoomSize.width)
	{
		anchorX = playerPosInRoomLayer.x - (curRoomSize.width - windowWidth);
	}
	if (playerPosInRoomLayer.x - anchorX < 0)
	{
		//÷̾ Room   ִ  
		anchorX = playerPosInRoomLayer.x;
		//࿡ 0ϸ     ʴ´.  
		//anchorX = 0;
	}


	if (playerPosInRoomLayer.y + anchorY > curRoomSize.height)
	{
		anchorY = playerPosInRoomLayer.y - (curRoomSize.height - windowHeight);
	}
	if (playerPosInRoomLayer.y - anchorY < 0)
	{
		anchorY = playerPosInRoomLayer.y;
	}

	layer->setPosition(anchorX - playerPosInGameLayer.x, anchorY - playerPosInGameLayer.y);

}

{'fraction_non_alphanumeric': 0.12985493682732804, 'fraction_numerical': 0.00772110435189518, 'mean_word_length': 4.979020979020979, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3070094', 'n_tokens_mistral': 1654, 'n_tokens_neox': 1583, 'n_words': 261}