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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - BiiXteR

Pages: 1 [2]
16
General / Re: Trying to read the value of a sf::String causes crash
« on: August 17, 2016, 01:49:36 pm »
Oh, alright. Thank you :P

17
General / Re: Trying to read the value of a sf::String causes crash
« on: August 17, 2016, 01:45:50 am »
Quote
This is not how SFML should be used.

Uhm, sorry again if this is a stupid question, but why should it not be used like that?

18
General / Trying to read the value of a sf::String causes crash
« on: August 16, 2016, 11:22:25 pm »
(Note : I'm still a beginner when it comes to programming, so sorry if it's something obvious)

So, when I try to print out the value of one of my function arguments of the type sf::String my entire application crashes with the error message ;

Quote
Exception thrown at 0x0FDE6D16 (msvcp140d.dll) in SwEngine.exe: 0xC0000005: Access violation reading location 0xCCCCCCCC.

If there is a handler for this exception, the program may be safely continued.

I believe  that a conversion between a std::String (which I send in to the function parameter of the type sf::String) fails, which leads to a crash, because when i try to use this sf::String value as a window title, the title is blank.

Here's some code :

This is the function which contains the sf::String value, and here's where the program crashes.

void Window::Create(unsigned int width, unsigned int height, sf::String title)
{

        std::cout << title.toAnsiString() << std::endl; // Crashes here.

}
 

And here's how I call that function :

Window::GetInstance().Create(1024, 720, globals::GAME_NAME);

And this is what the GAME_NAME variable is :

namespace globals
{

        // The name of the game the engine is currently running.
        const std::string GAME_NAME = "SwEngine Testing";

}
 

I'm pretty confused since it says in the SFML page that it handles conversions between the 2 string automatically, so, am I doing something very wrong here? :o

19
Graphics / Re: sf::Sprite is not a drawable?
« on: January 11, 2016, 07:49:03 pm »
The draw function accepts sf::Sprite, but not pointers to sf::Sprite. And i.second is a pointer to an sf::Sprite.
You need to dereference your pointer.
window->draw(*i.second);

I could have sworn I already tried that... But anyways, it worked!  :)
Thank you!

Also, new to this forum, do you know how accepting/marking an answer works?

20
Graphics / [SOLVED] - sf::Sprite is not a drawable?
« on: January 11, 2016, 06:58:54 pm »
So, currently I have this :


std::map<std::string, sf::Sprite*> sprites;


and I loop trough it like this :
        for (auto const& i : sprites)
        {
                window->draw(i.second);
        }
 
But when I try to run it, it tells me that :

illegal indirection
 void sf::RenderTarget::draw(const sf::Vertex *,size_t,sf::PrimitiveType,const sf::RenderStates &)': cannot convert argument 1 from 'sf::Sprite *const ' to 'const sf::Drawable &

Reason: cannot convert from 'sf::Sprite *const ' to 'const sf::Drawable'
No constructor could take the source type, or constructor overload resolution was ambiguous



Note :
I'm pretty new to both C++ and SFML so it might be obvious.
It might not even be a SFML problem.
 :P

Pages: 1 [2]
anything