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

Pages: [1]
1
SFML projects / Re: Spinning Card
« on: September 24, 2014, 09:10:06 pm »
Thank you so much for this! I just got to the point in my card game where I was thinking, "Hmm... Now how do I flip the card over?" You were inspired.   :D

2
General / Re: Thor ResourceCache access
« on: August 30, 2014, 08:46:32 pm »
Hmm... When I try and do as you suggested, I am getting a strange error. In Visual Studio 2013 express, I get an "error C2512: 'thor::ResourceKey<sf::Texture>': no appropriate default constructor available."

The output is:
1>------ Build started: Project: Hand and Foot, Configuration: Debug Win32 ------
1>  Round.cpp
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\tuple(746): error C2512: 'thor::ResourceKey<sf::Texture>' : no appropriate default constructor available
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\tuple(762) : see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<std::tuple<Round::TextureType &&>,std::tuple<>,0,>(_Tuple1 &,_Tuple2 &,std::_Arg_idx<0>,std::_Arg_idx<>)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>  ,            _Tuple1=std::tuple<Round::TextureType &&>
1>  ,            _Tuple2=std::tuple<>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\tuple(762) : see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<std::tuple<Round::TextureType &&>,std::tuple<>,0,>(_Tuple1 &,_Tuple2 &,std::_Arg_idx<0>,std::_Arg_idx<>)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>  ,            _Tuple1=std::tuple<Round::TextureType &&>
1>  ,            _Tuple2=std::tuple<>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0(600) : see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<Round::TextureType&&,>(std::piecewise_construct_t,std::tuple<Round::TextureType &&>,std::tuple<>)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0(600) : see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<Round::TextureType&&,>(std::piecewise_construct_t,std::tuple<Round::TextureType &&>,std::tuple<>)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0(723) : see reference to function template instantiation 'void std::allocator<_Other>::construct<_Objty,const std::piecewise_construct_t&,_Ty,std::tuple<>>(_Objty *,const std::piecewise_construct_t &,_Ty &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Other=std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>
1>  ,            _Objty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>  ,            _Ty=std::tuple<Round::TextureType &&>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0(723) : see reference to function template instantiation 'void std::allocator<_Other>::construct<_Objty,const std::piecewise_construct_t&,_Ty,std::tuple<>>(_Objty *,const std::piecewise_construct_t &,_Ty &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Other=std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>
1>  ,            _Objty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>  ,            _Ty=std::tuple<Round::TextureType &&>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0(872) : see reference to function template instantiation 'void std::allocator_traits<_Alloc>::construct<_Ty,const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(std::allocator<_Other> &,_Objty *,const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Alloc=std::allocator<std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>>
1>  ,            _Ty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>  ,            _Other=std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>
1>  ,            _Objty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0(872) : see reference to function template instantiation 'void std::allocator_traits<_Alloc>::construct<_Ty,const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(std::allocator<_Other> &,_Objty *,const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Alloc=std::allocator<std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>>
1>  ,            _Ty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>  ,            _Other=std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>
1>  ,            _Objty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(933) : see reference to function template instantiation 'void std::_Wrap_alloc<std::allocator<_Other>>::construct<_Ty,const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(_Ty *,const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Other=std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>
1>  ,            _Ty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(933) : see reference to function template instantiation 'void std::_Wrap_alloc<std::allocator<_Other>>::construct<_Ty,const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(_Ty *,const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Other=std::_Tree_node<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>,void *>
1>  ,            _Ty=std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1184) : see reference to function template instantiation 'std::_Tree_node<std::pair<const _Kty,_Ty>,void *> *std::_Tree_buy<std::pair<const _Kty,_Ty>,std::allocator<std::pair<const _Kty,_Ty>>>::_Buynode<const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xtree(1184) : see reference to function template instantiation 'std::_Tree_node<std::pair<const _Kty,_Ty>,void *> *std::_Tree_buy<std::pair<const _Kty,_Ty>,std::allocator<std::pair<const _Kty,_Ty>>>::_Buynode<const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\map(181) : see reference to function template instantiation 'std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>> std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::emplace_hint<const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>,const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>  ,            _Pr=std::less<Round::TextureType>
1>  ,            _Alloc=std::allocator<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\map(181) : see reference to function template instantiation 'std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>> std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>::emplace_hint<const std::piecewise_construct_t&,std::tuple<Round::TextureType &&>,std::tuple<>>(std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>,const std::piecewise_construct_t &,std::tuple<Round::TextureType &&> &&,std::tuple<> &&)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>  ,            _Pr=std::less<Round::TextureType>
1>  ,            _Alloc=std::allocator<std::pair<const Round::TextureType,thor::ResourceKey<sf::Texture>>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\map(173) : while compiling class template member function 'thor::ResourceKey<sf::Texture> &std::map<Round::TextureType,thor::ResourceKey<sf::Texture>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>::operator [](Round::TextureType &&)'
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>          ]
1>          c:\users\jordan w\documents\visual studio 2013\projects\hand and foot - copy\hand and foot\round.cpp(51) : see reference to function template instantiation 'thor::ResourceKey<sf::Texture> &std::map<Round::TextureType,thor::ResourceKey<sf::Texture>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>::operator [](Round::TextureType &&)' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>          ]
1>          c:\users\jordan w\documents\visual studio 2013\projects\hand and foot - copy\hand and foot\round.h(62) : see reference to class template instantiation 'std::map<Round::TextureType,thor::ResourceKey<sf::Texture>,std::less<_Kty>,std::allocator<std::pair<const _Kty,_Ty>>>' being compiled
1>          with
1>          [
1>              _Kty=Round::TextureType
1>  ,            _Ty=thor::ResourceKey<sf::Texture>
1>          ]
 

The out put references two lines of code from my file.

Line 62 from Round.h, in the "private:" section:
std::map<TextureType, thor::ResourceKey<sf::Texture>>   mKeys;
 

and line 51 from Round.cpp, in the function "buildScene()", which is called after "loadTextures()":
std::shared_ptr<sf::Texture> tableTexture = mTextures.search(mKeys[TextureType::Table]);
 

Any ideas what might be going on? I am running Windows 7, and have the libraries statically linked, if that is helpful information at all.

3
General / Re: Thor ResourceCache access
« on: August 30, 2014, 06:25:11 pm »
Thanks, Nexus! That was exactly what I needed.

4
General / Thor ResourceCache access
« on: August 30, 2014, 04:27:47 am »
I have a question about the proper way to use the resource management system found in the Thor library. The examples I have found have used ResourceCache and ResourceKey in the same scope- but what if I want to be able to access the resources stored in the ResourceCache in a different function?

For example, I have a class that has a private member mTextures, which is a thor::ResourceCache<sf::Texture>.

I have a function, loadResources, that is:
void Round::loadResourses()
{
thor::ResourceKey<sf::Texture> TextureBack = thor::Resources::fromFile<sf::Texture>("Media/Textures/Back.png");

mTextures.acquire(TextureBack);
}
 

And then, in the buildScene function, I want to access the texture referenced by TextureBack, like so:

std::shared_ptr<sf::Texture> background = mTextures.search(TextureBack);
 

But the compiler doesn't know what TextureBack is, because it is in a different scope. What is the proper way to access the resource management system from other parts of the function, or from other functions, if I have passed a reference to the ResourceCache through?

Thank you for your help in advance (and also thanks to those who work so hard to make us such cool libraries!)

5
General discussions / Re: SFML Game Development -- A book on SFML
« on: January 12, 2014, 05:59:55 pm »
That fixed it! Not sure how I missed that. Now I know there is a problem with my code somewhere, and I will track it down. Thanks!

6
General discussions / Re: SFML Game Development -- A book on SFML
« on: January 12, 2014, 05:03:59 pm »
You're the first to report this, so it's probably an issue with your build. But you need CMake for both the GitHub and original files, so how did you build it?

If I were you, I would try to get CMake running, I don't think it makes sense to search for bugs when it might be a simple configuration problem. Have you read the ReadMe.txt on GitHub? What doesn't work?


Thanks for the quick reply! I did read the ReadMe.txt, and followed it. I am using Visual Studio 2012 Express (Visual Studio 11), so I chose that as my compiler, found the SFML directory, chose static, and generated. When I try to run the release build, I  get the error shown in the attachment. "Unable to start the program 'C:\<filepath>\07_Gameplay\Source\Release\ALL_BUILD'.   The system cannot find the file specified."

Any ideas?

I built my project originally by creating a new project in Visual Studio 11 so I could get practice linking SFML and coding the project myself. To make sure I got the code correct, I would open up the code I downloaded from the github and compare across.

I've really been enjoying the book, by the way!

7
General discussions / Re: SFML Game Development -- A book on SFML
« on: January 12, 2014, 06:28:40 am »
I just finished chapter 7, and my missiles are behaving weirdly. They only appear if an enemy is on the screen- if there are no enemies, a missile is "expended" (the missile total goes down by 1), but no graphic is put on the screen. No missile goes firing off. If an enemy is on the screen, the missile jumps forward super fast ( either that, or it appears at the same y coordinate as the  enemy, but with my x coordinate.) It is just suddenly at the same height as the enemy, but as far over in the x direction as I am. If I am directly below the enemy, it is instantly dead. If I am to the side and below the enemy, the missile jumps to the enemy's height and slowly turns until it is facing the enemy and tries to slowly move to the enemy. It usually fails.

Is anyone else getting this behavior? I wasn't able to get the CMake to work for me, so I haven't yet tried running the github files, but I have checked over my work carefully. I have even copy and pasted the contests of Aircraft.hpp, Aircraft.cpp, World.hpp, World.cpp, Projectile.hpp, Projectile.cpp, Entity.hpp, and Entity.cpp, just to be sure (those seemed to be the ones that might be effecting the missiles). If no one else is getting that behavior, any idea as to where to look to fix it in my code? I've been scratching my head over it all evening. Any insight you have would be greatly appreciated, and thanks in advance!

8
General discussions / Re: SFML Game Development -- A book on SFML
« on: October 30, 2013, 04:51:54 am »
I'm loving the book so far!

I had a quick question. How does the second toString function, in chapter 6's Utility.hpp file, work? I can't figure out what, exactly,
 #define BOOK_KEYTOSTRING_CASE(KEY) case sf::Keyboard::KEY: return #KEY;
does. Any help would be appreciated!


Pages: [1]
anything