Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Vector2 Problem  (Read 5851 times)

0 Members and 1 Guest are viewing this topic.

SmashMaster

  • Newbie
  • *
  • Posts: 3
    • View Profile
Vector2 Problem
« on: November 30, 2009, 10:14:20 am »
Code: [Select]

//part 1
float Face(sf::Vector2<float> PosA, sf::Vector2<float> PosB)
{
    return 45.; //to be finished
}


// part 2
if (Event.Type == sf::Event::MouseMoved)
{
         sf::Vector2<float> PosMouse = sf::Vector2<float>(Event.MouseMove.X, Event.MouseMove.Y);
         Sprite.SetRotation(Face(Sprite.GetPosition, PosMouse));
}


I want to set up the function Face() to operate on two vectors and return a float, but it's giving me this error:

Main.cpp|55|error: conversion from `<unknown type>' to non-scalar type `sf::Vector2<float>' requested|

Also, I'm not sure if this belongs in Graphics, Window, or System, because I don't know which one sf:Vector2 belongs to.

EDIT: I guess it really belongs in general because it's more of a general C++ problem than it is a problem with me using SFML.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Vector2 Problem
« Reply #1 on: November 30, 2009, 11:33:45 am »
you forgot () ->
prite.SetRotation(Face(Sprite.GetPosition(), PosMouse));
SFML / OS X developer