<commit_before>#include "Mouse.hpp"
#include <iostream>
namespace mv
{
	Mouse *Mouse::instance;

	void Mouse::draw(sf::RenderTarget & target, sf::RenderStates states) const
	{
		target.draw(object, states);
	}

	void Mouse::positionUpdate()
	{
		sf::Vector2i pixelPos = sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow());
		sf::Vector2f worldPos = mv::Scene::getInstance().GetPointerToWindow()->mapPixelToCoords(pixelPos);
		object.setPosition(worldPos);
	}

	void Mouse::checkBorders()
	{
		auto windowDimensions = mv::Scene::getInstance().GetPointerToWindow()->getSize();
		
		if (windowDimensions.y - sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).y < tolerance.y)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::DOWN);
		}
		else if (sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).y < tolerance.y)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::TOP);
		}

		if (windowDimensions.x - sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).x < tolerance.x)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::RIGHT);
		}
			
		else if (sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).x < tolerance.x)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::LEFT);
		}

	}

	void Mouse::checkClick()
	{
		if (sf::Mouse::isButtonPressed(sf::Mouse::Right))
		{
			auto pos = Math::convertToUnitPosition(static_cast<sf::Vector2f>(sf::Mouse::getPosition()));
			std::cout << pos.x << "   " << pos.y << std::endl;
		}
	}

	Mouse::Mouse(const Mouse::TYPE & type, bool movingBorderPermission)
		:tolerance(mv::constants::defaults::BORDER_TOLERANCE.x, mv::constants::defaults::BORDER_TOLERANCE.y),
		Ticker(this), movingPermission(movingBorderPermission)
	{
		object.setTexture(cache.get("data/textures/mouseAtlas.png"));
		object.setTextureRect(sf::IntRect(static_cast<int>(type)*constants::defaults::MOUSE_DIMENSIONS.x, 0, constants::defaults::MOUSE_DIMENSIONS.x, constants::defaults::MOUSE_DIMENSIONS.y));
		object.setOrigin(object.getGlobalBounds().width / 2, object.getGlobalBounds().height / 2);
	}

	Mouse & Mouse::getInstance()
	{
		if (instance == 0)
			Logger::Log(constants::error::singleton::SINGLETON_NOT_INITED, Logger::STREAM::BOTH, Logger::TYPE::ERROR);

		return *instance;
	}

	void Mouse::createInstance(const Mouse::TYPE & type, bool movingBorderPermission)
	{
		if (instance == 0)
		{
			instance = new Mouse(type, movingBorderPermission);
		}<commit_msg>Fixed bug with detecting position<commit_after>#include "Mouse.hpp"
#include <iostream>
namespace mv
{
	Mouse *Mouse::instance;

	void Mouse::draw(sf::RenderTarget & target, sf::RenderStates states) const
	{
		target.draw(object, states);
	}

	void Mouse::positionUpdate()
	{
		sf::Vector2i pixelPos = sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow());
		sf::Vector2f worldPos = mv::Scene::getInstance().GetPointerToWindow()->mapPixelToCoords(pixelPos);
		object.setPosition(worldPos);
	}

	void Mouse::checkBorders()
	{
		auto windowDimensions = mv::Scene::getInstance().GetPointerToWindow()->getSize();
		
		if (windowDimensions.y - sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).y < tolerance.y)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::DOWN);
		}
		else if (sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).y < tolerance.y)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::TOP);
		}

		if (windowDimensions.x - sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).x < tolerance.x)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::RIGHT);
		}
			
		else if (sf::Mouse::getPosition(*mv::Scene::getInstance().GetPointerToWindow()).x < tolerance.x)
		{
			mv::Scene::getInstance().moveView(mv::Scene::DIRECTION::LEFT);
		}

	}

	void Mouse::checkClick()
	{
		if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
		{
			auto pos = Math::convertToUnitPosition(object.getPosition());
		}
	}

	Mouse::Mouse(const Mouse::TYPE & type, bool movingBorderPermission)
		:tolerance(mv::constants::defaults::BORDER_TOLERANCE.x, mv::constants::defaults::BORDER_TOLERANCE.y),
		Ticker(this), movingPermission(movingBorderPermission)
	{
		object.setTexture(cache.get("data/textures/mouseAtlas.png"));
		object.setTextureRect(sf::IntRect(static_cast<int>(type)*constants::defaults::MOUSE_DIMENSIONS.x, 0, constants::defaults::MOUSE_DIMENSIONS.x, constants::defaults::MOUSE_DIMENSIONS.y));
		object.setOrigin(object.getGlobalBounds().width / 2, object.getGlobalBounds().height / 2);
	}

	Mouse & Mouse::getInstance()
	{
		if (instance == 0)
			Logger::Log(constants::error::singleton::SINGLETON_NOT_INITED, Logger::STREAM::BOTH, Logger::TYPE::ERROR);

		return *instance;
	}

	void Mouse::createInstance(const Mouse::TYPE & type, bool movingBorderPermission)
	{
		if (instance == 0)
		{
			instance = new Mouse(type, movingBorderPermission);
		}
{'fraction_non_alphanumeric': 0.1797752808988764, 'fraction_numerical': 0.003009630818619583, 'mean_word_length': 6.82574568288854, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 12, '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': '4493922', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1627, 'n_words': 204}