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

Author Topic: SFML Thor BigSprite Abstract class error  (Read 2588 times)

0 Members and 2 Guests are viewing this topic.

Trampeltier

  • Newbie
  • *
  • Posts: 8
    • View Profile
SFML Thor BigSprite Abstract class error
« on: March 21, 2014, 06:47:42 pm »
Hi,
I  am using thor::BigSprite class (http://www.bromeon.ch/libraries/thor/v1.1/doc/classthor_1_1_big_sprite.html)
When i try to use this class as an object, there come multiple error messages:


#ifndef BACKGROUND_H
#define BACKGROUND_H

#include <SFML\Graphics.hpp>
#include <Thor\Multimedia.hpp>
#include <string>

namespace classes
{
        namespace gui
        {
                class Background
                {
                public:
                        Background() {state = false;}

                        // Constructor with arguments
                        Background(std::string TexturePath, sf::Vector2f WindowSize);

                        //Changes picture
                        void SetTextureFromFile (std::string TexturePath);

                        //Scaling background to window
                        void ScaleToWindow(sf::Vector2f WindowSize);

                        //Draw
                        void Draw(sf::RenderWindow &window);

                        //Sets the state
                        void SetState(bool Bool);

                        //returns the state
                        bool GetState();
                private:
                        thor::BigTexture texture;
                        thor::BigSprite sprite;  // "sprite" is red underlined
                        bool state;
                };
        }
}
#endif // BACKGROUND_H

#include "Background.h"

namespace classes
{
        namespace gui
        {
                Background::Background(std::string TexturePath,sf::Vector2f WindowSize)
                {
                        state = false;
                        SetTextureFromFile(TexturePath);
                        ScaleToWindow(WindowSize);
                }
                void Background::SetTextureFromFile (std::string TexturePath)
                {
                        this->texture.LoadFromFile(TexturePath);
                        this->sprite.SetTexture(texture);
                }
                void Background::ScaleToWindow(sf::Vector2f WindowSize)
                {
                        this->sprite.setScale( (WindowSize.x / this->texture.GetWidth()), (WindowSize.y / this->texture.GetHeight()));
                }
                void Background::Draw(sf::RenderWindow &window)
                {
                        window.draw(this->sprite);
                }
                void Background::SetState(bool Bool)
                {
                        state = Bool;
                }
                bool Background::GetState()
                {
                        return state;
                }
        }
}

1>c:\dropbox\c++ vr\sfml-2.1\include\thor\multimedia\shapes.hpp(111): error C2259: 'thor::ConcaveShape': Instanz von abstrakter Klasse kann nicht erstellt werden
1>          aufgrund folgender Member:
1>          "void sf::Drawable::draw(sf::RenderTarget &,sf::RenderStates) const": ist abstrakt
1>          c:\dropbox\c++ vr\sfml-2.1\include\sfml\graphics\drawable.hpp(69): Siehe Deklaration von 'sf::Drawable::draw'
1>c:\dropbox\c++ vr\click-game\click-game\click-game\background.h(36): error C2259: 'thor::BigSprite': Instanz von abstrakter Klasse kann nicht erstellt werden
1>          aufgrund folgender Member:
1>          "void sf::Drawable::draw(sf::RenderTarget &,sf::RenderStates) const": ist abstrakt
1>          c:\dropbox\c++ vr\sfml-2.1\include\sfml\graphics\drawable.hpp(69): Siehe Deklaration von 'sf::Drawable::draw'
1>  ScoreManager.cpp

My Visual Studio 2010 is German, sorry about that.

So it say that the thor::BigSprite class is an abstract class because of sf::Drawable::draw().
Doesn't thor::BigSprite have its own definition of draw() ?
So what reason could be this error?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML Thor BigSprite Abstract class error
« Reply #1 on: March 21, 2014, 07:34:38 pm »
The classes are not abstract, for BigSprite you see the draw() function overridden here.

But judging from texture.GetWidth() and <Thor/Multimedia.hpp> (use forward slashes!), you're using an ancient version of both SFML and Thor. But apparently they're not compatible, since draw() was called Draw() back then.

Is there a reason why you don't use the latest versions from GitHub (see also the notice on the download page)?
« Last Edit: March 21, 2014, 07:41:01 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Trampeltier

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Thor BigSprite Abstract class error
« Reply #2 on: March 21, 2014, 09:06:58 pm »
So how can I compile the latest thor version with SFML 2.1 without using CMake?
CMake doesn't work for me for some reason...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: SFML Thor BigSprite Abstract class error
« Reply #3 on: March 21, 2014, 09:35:56 pm »
You rather find out how to get CMake to work then, because it's a rather important tool and while it's possible to compile Thor and SFML without CMake, you'd need more knowledge on building things that by the time you'd have caught up, the CMake issue might seem trivial. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Trampeltier

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Thor BigSprite Abstract class error
« Reply #4 on: March 21, 2014, 10:56:33 pm »
So here is the CMake error:
  LINK : fatal error LNK1123: Fehler bei der Konvertierung in COFF: Datei ist ungültig oder beschädigt. [E:\docs\c++\SFML\SFML-master\Build\CMakeFiles\CMakeTmp\cmTryCompileExec3242043022.vcxproj]


Maybe you can help me out.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: SFML Thor BigSprite Abstract class error
« Reply #5 on: March 22, 2014, 12:02:27 am »
Sounds like you need to install the VS 2010 SP1. I wonder in which parallel universe people are actually googling their error messages. :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Trampeltier

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Thor BigSprite Abstract class error
« Reply #6 on: March 22, 2014, 12:31:16 am »
Actually I was too lazy to google it  :P

Edit: Downloaded and installed VS2010 SP1, works fine now.
« Last Edit: March 22, 2014, 01:19:06 am by Trampeltier »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: SFML Thor BigSprite Abstract class error
« Reply #7 on: March 22, 2014, 09:43:38 am »
Actually I was too lazy to google it  :P
Don't. It's really unpolite to let others do the simple work for you. Otherwise you should pay me.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Trampeltier

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: SFML Thor BigSprite Abstract class error
« Reply #8 on: March 22, 2014, 03:23:24 pm »
:D Yes, you are right.
I don't know why I didn't google it myself, maybe I didn't see any hope in it doing that.
Whatever, works now and everybody is happy (maybe you are not happy because you worked for me but someday who knows, I will work for you?)

 

anything