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

Author Topic: issues with sf::Int8  (Read 2843 times)

0 Members and 1 Guest are viewing this topic.

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
issues with sf::Int8
« on: December 22, 2013, 05:36:03 am »
I initially thought this was a issue with networking..

int main()
{

        sf::Int8 i = 1;
        std::cout << i;
        std::cin.get();
}

This piece of code prints a smiley face to the console screen, not 1

windows 8.1 visual studio 2013
« Last Edit: December 22, 2013, 05:44:18 am by iride »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: issues with sf::Int8
« Reply #1 on: December 22, 2013, 05:46:50 am »
I was about to reply to your original post that sf::Int8 is actually a char typedef so it prints as ASCII not as number.
Back to C++ gamedev with SFML in May 2023

iride

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: issues with sf::Int8
« Reply #2 on: December 22, 2013, 06:26:45 am »
thanks!

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: issues with sf::Int8
« Reply #3 on: December 22, 2013, 06:35:17 am »
So cast to int or short or something, obviously: ;)
int main()
{
    sf::Int8 i = 1;
    std::cout << static_cast<int>(i);
}
« Last Edit: December 22, 2013, 06:41:50 am by FRex »
Back to C++ gamedev with SFML in May 2023

 

anything