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

Author Topic: Comparing Images  (Read 1101 times)

0 Members and 1 Guest are viewing this topic.

Mr. House

  • Newbie
  • *
  • Posts: 4
    • AOL Instant Messenger - 7754+Meridian+St
    • View Profile
Comparing Images
« on: December 31, 2011, 02:52:25 pm »
Hello,

I'm trying to check if one image matches another for a platforming game (to check if the tile is solid).

I have this snippet of code

Code: [Select]
if(TileMapObj->TileMapVect[i].GetImage() == TileMapObj->TileVect[1])

and it is giving me the error "no match for operator== in ...."

TileMapVect is a vector that contains sf::Sprites while TileVect is a vector that contains objects of type sf::Image.

So yea, I'm probably trying to compare apples and oranges.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Comparing Images
« Reply #1 on: December 31, 2011, 03:22:02 pm »
There is no such operator== overload in SFML. And if it were implemented pixel-wise, it would be very slow, especially for many checks per frame.

Why don't you store the property if the tile is solid as a bool?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: