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 - danielsega

Pages: [1]
1
General / [SOLVED]Experimenting with Background Tile, SFML book
« on: March 20, 2014, 11:42:23 pm »
I am trying to make the background tile to repeat itself from left to right, instead of going upwards. I can see how it works, I changed the mworldbound in the constructor,
mWorldBounds(0.f, 0.f, 2000.f, mWorldView.getSize().y)
so i set x to 2000f and y the same size of the screen, so the world bounds is changed, but i don't see how to it to make the texture scroll sideways.

I managed to get it working, i had my view moving in the opposite direction.

2
General / Re: SFML game dev. Book, chapter 3 textureholder
« on: March 10, 2014, 05:25:15 am »
The the aircraft doesn't know about ResourceHolder
Yes, it does. See Aircraft.cpp, line 2.

My bad, i somehow thought that was resourseidentifier.

3
General / Re: SFML game dev. Book, chapter 3 textureholder
« on: March 09, 2014, 06:58:51 pm »
It is defined at the point where it is used: in the header ResourceHolder.hpp.

ResourceIdentifiers.hpp just contains a forward declaration for the typedefs. Typedef doesn't require complete types.

I get that, but according to the book sample, there is no pre-processor operation that includes ResourceHolder on ResourceIdentifiers. The the aircraft doesn't know about ResourceHolder, it only knows about ResourceIdentifiers, so it does not know about ResourceHolder,  unless if it becomes static. I don't see how they are linked.

4
General / SFML game dev. Book, chapter 3 textureholder
« on: March 09, 2014, 05:16:18 am »
I am following the book and i started implementing the aircraft constructor, when i really got confused with the book:

//--Aircraft
Aircraft::Aircraft(Type type, const TextureHolder& textures) : mType(type), mSprite(textures.get(toTextureID(type)))
{
        sf::FloatRect bounds = mSprite.getLocalBounds();
        mSprite.setOrigin(bounds.width / 2.0f, bounds.height / quote);
}

//--ResourceIden
template <typename Resource, typename Identifier>
class ResourceHolder;

typedef ResourceHolder<sf::Texture, Textures::ID>       TextureHolder;
}

How does TextureHolder have access to a get function member, since ResourceHolder is not defined?

5
General / Re: Linker Error, unresolved external
« on: February 11, 2014, 10:57:18 pm »
I don't work with Microsoft Visual C++ and you seem to be using it. You should follow this tutorial and see if you linked your project to the SFML's libraries (the .lib files) and if SFML is compiled as static then you should also link your project to SFML's dependencies. Read more here, even if it's for MinGW its still applies to MSVC except the libraries are .lib files.

Like i said before i work perfectly well with the code in main, when i break it down into classes it gives the error. I'll try to use the dynamic library to see if it works.

Edit: I fixed it, i removed the destructor from my Game class and it works fine now.


6
General / Resolved: Linker Error, unresolved external
« on: February 11, 2014, 10:30:24 pm »
I just started looking into SFML and i decide to break down that simple program into a Game class, but i am getting this errors:

Quote

Error   1   error LNK2001: unresolved external symbol ...
Error   2   error LNK1120: 1 unresolved externals

Here is my game class, i also include SFML/graohics.hpp so i could initialize a renderwindow the the circle shape from the example:

Quote
#include<SFML\Graphics.hpp>

class Game
{
public:
   Game();
   ~Game();
   void Run();
private:
   //--Behaviour
   void Update();
   void Render();

   //--Data Members
   sf::RenderWindow mWindow;   
   sf::CircleShape mPlayer;
};

In my main all i have a game object and use the Run function, but i get that linker error. However  it works fine in the main class.

Pages: [1]
anything