//---------------------------------------------------- //---------------------------------------------------- void PointerSystem::OnTouchDown(s32 in_systemId, const ChilliSource::Vector2& in_location) { ChilliSource::Vector2 touchLocation(in_location.x, m_screen->GetResolution().y - in_location.y); ChilliSource::Pointer::Id pointerId = AddPointerCreateEvent(touchLocation); AddPointerDownEvent(pointerId, ChilliSource::Pointer::InputType::k_touch); m_systemIdToPointerIdMap.emplace(in_systemId, pointerId); }
//------------------------------------------------ //------------------------------------------------ void PointerSystem::OnInit() { m_screen = ChilliSource::Application::Get()->GetSystem<ChilliSource::Screen>(); CS_ASSERT(m_screen != nullptr, "Cannot find system required by PointerSystem: Screen."); auto screenResolution = m_screen->GetResolution(); SFMLWindow::Get()->SetMouseDelegates(ChilliSource::MakeDelegate(this, &PointerSystem::OnMouseButtonEvent), ChilliSource::MakeDelegate(this, &PointerSystem::OnMouseMoved), ChilliSource::MakeDelegate(this, &PointerSystem::OnMouseWheeled)); //create the mouse pointer ChilliSource::Integer2 mousePosi = SFMLWindow::Get()->GetMousePosition(); ChilliSource::Vector2 mousePos((f32)mousePosi.x, screenResolution.y - (f32)mousePosi.y); m_pointerId = AddPointerCreateEvent(mousePos); }