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

Pages: 1 ... 6 7 [8] 9
106
Feature requests / Can sf::Transformable have a alignOrigin function?
« on: July 04, 2014, 10:17:17 am »
Hi there,

in my recent projects experimenting with 2D Game Engines, I always end up writing utility-functions for aligning the origin of sfml objects like sf::Text, sf::Shape and sf::Sprite relatively to the sprite size, like e.g set the origin to the center, or Top-Right, Bottom-Left etc.

Here's my reference code

Centering the origin relatively to the entity size is very often used, and I use the other relative alignments for displaying GUI-Objects. It would come in really handy if sf::Transformable would have an abstract function alignOrigin( Alignment align) which then gets implemented by the child classes like shape, text etc., and if one designs his own entities with sf::Transformable, he could implement it for his own classes.

So accompanying sf::Transformable::setOrigin for setting the absolut origin, a alignOrigin for setting the relative origin would be a valuable addition in my opinion.

Thanks in advance!

107
General discussions / Re: SFML Game Development -- A book on SFML
« on: July 02, 2014, 10:39:15 am »
Just found the compiler bug related to std::bind via Google. Tried the github-code, works fine. Thanks for clearing this so fast. ;)

Cheers!

108
General discussions / Re: SFML Game Development -- A book on SFML
« on: July 02, 2014, 09:46:39 am »
Hey Guys,

I have a problem with the code from chapter 7. I followed the book correctly but I cannot compile the Player-Class because of the following error:
Code: [Select]
1>  Player.cpp
1>c:\development\downloads\sfml game development\07_gameplay\include\book\command.hpp(33): error C3848: expression having type 'const std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Aircraft::* )(void),void,Aircraft,>,std::_Ph<1> &>' would lose some const-volatile qualifiers in order to call 'void std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Aircraft::* )(void),void,Aircraft,>,std::_Ph<1> &>::operator ()<GameObject&,sf::Time&>(GameObject &,sf::Time &)'
1>          with
1>          [
1>              GameObject=Aircraft
1>          ]

I use VC2013 with Update 2 to compile this.
What I figured out until now, is that if I comment out the lines 111 and 112 from Player.cpp
        mActionBinding[Fire].action          = derivedAction<Aircraft>(std::bind(&Aircraft::fire, _1));
        mActionBinding[LaunchMissile].action = derivedAction<Aircraft>(std::bind(&Aircraft::launchMissile, _1));
it compiles. The problem lies somehow in the std::bind.

Also in DataTables.cpp I get the following error for the std::bind-statements:
data[Pickup::HealthRefill].texture = Textures::HealthRefill;
        data[Pickup::HealthRefill].action = std::bind(&Aircraft::repair, _1, 25);
       
        data[Pickup::MissileRefill].texture = Textures::MissileRefill;
        data[Pickup::MissileRefill].action = std::bind(&Aircraft::collectMissiles, _1, 3);
       
        data[Pickup::FireSpread].texture = Textures::FireSpread;
        data[Pickup::FireSpread].action = std::bind(&Aircraft::increaseSpread, _1);
       
        data[Pickup::FireRate].texture = Textures::FireRate;
        data[Pickup::FireRate].action = std::bind(&Aircraft::increaseFireRate, _1);

Code: [Select]
1>  DataTables.cpp
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(1241): error C2100: illegal indirection
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(1149) : see reference to function template instantiation '_Rx std::_Pmf_wrap<void (__thiscall Entity::* )(int),_Rx,Entity,int>::operator ()<Aircraft>(_Wrapper &,int) const' being compiled
1>          with
1>          [
1>              _Rx=void
1>  ,            _Wrapper=Aircraft
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(1149) : see reference to function template instantiation '_Rx std::_Pmf_wrap<void (__thiscall Entity::* )(int),_Rx,Entity,int>::operator ()<Aircraft>(_Wrapper &,int) const' being compiled
1>          with
1>          [
1>              _Rx=void
1>  ,            _Wrapper=Aircraft
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(1137) : see reference to function template instantiation 'void std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>::_Do_call<Aircraft,0,1>(std::tuple<Aircraft &>,std::_Arg_idx<0,1>)' being compiled
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(1137) : see reference to function template instantiation 'void std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>::_Do_call<Aircraft,0,1>(std::tuple<Aircraft &>,std::_Arg_idx<0,1>)' being compiled
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xrefwrap(283) : see reference to function template instantiation 'void std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>::operator ()<Aircraft&>(Aircraft &)' being compiled
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xrefwrap(283) : see reference to function template instantiation 'void std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>::operator ()<Aircraft&>(Aircraft &)' being compiled
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(228) : see reference to function template instantiation '_Ret std::_Callable_obj<std::_Bind<true,_Ret,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>,false>::_ApplyX<_Rx,Aircraft&>(Aircraft &)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Rx=void
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(228) : see reference to function template instantiation '_Ret std::_Callable_obj<std::_Bind<true,_Ret,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>,false>::_ApplyX<_Rx,Aircraft&>(Aircraft &)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Rx=void
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(226) : while compiling class template member function 'void std::_Func_impl<_MyWrapper,_Alloc,_Ret,Aircraft &>::_Do_call(Aircraft &)'
1>          with
1>          [
1>              _Alloc=std::allocator<std::_Func_class<void,Aircraft &>>
1>  ,            _Ret=void
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(495) : see reference to class template instantiation 'std::_Func_impl<_MyWrapper,_Alloc,_Ret,Aircraft &>' being compiled
1>          with
1>          [
1>              _Alloc=std::allocator<std::_Func_class<void,Aircraft &>>
1>  ,            _Ret=void
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(396) : see reference to function template instantiation 'void std::_Func_class<_Ret,Aircraft &>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Ty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Alloc=std::allocator<std::_Func_class<void,Aircraft &>>
1>  ,            _Fty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(396) : see reference to function template instantiation 'void std::_Func_class<_Ret,Aircraft &>::_Do_alloc<_Myimpl,_Ty,_Alloc>(_Fty &&,_Alloc)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Ty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Alloc=std::allocator<std::_Func_class<void,Aircraft &>>
1>  ,            _Fty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(385) : see reference to function template instantiation 'void std::_Func_class<_Ret,Aircraft &>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,Aircraft &>>>(_Fty &&,_Alloc)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Ty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Fty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Alloc=std::allocator<std::_Func_class<void,Aircraft &>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(385) : see reference to function template instantiation 'void std::_Func_class<_Ret,Aircraft &>::_Reset_alloc<_Ty,std::allocator<std::_Func_class<_Ret,Aircraft &>>>(_Fty &&,_Alloc)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Ty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Fty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Alloc=std::allocator<std::_Func_class<void,Aircraft &>>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(688) : see reference to function template instantiation 'void std::_Func_class<_Ret,Aircraft &>::_Reset<_Ty>(_Fty &&)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Ty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Fty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>          ]
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional(688) : see reference to function template instantiation 'void std::_Func_class<_Ret,Aircraft &>::_Reset<_Ty>(_Fty &&)' being compiled
1>          with
1>          [
1>              _Ret=void
1>  ,            _Ty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>  ,            _Fty=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>          ]
1>          c:\development\downloads\sfml game development\07_gameplay\source\datatables.cpp(64) : see reference to function template instantiation 'std::function<void (Aircraft &)> &std::function<void (Aircraft &)>::operator =<std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>>(_Fx &&)' being compiled
1>          with
1>          [
1>              _Fx=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>          ]
1>          c:\development\downloads\sfml game development\07_gameplay\source\datatables.cpp(64) : see reference to function template instantiation 'std::function<void (Aircraft &)> &std::function<void (Aircraft &)>::operator =<std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>>(_Fx &&)' being compiled
1>          with
1>          [
1>              _Fx=std::_Bind<true,void,std::_Pmf_wrap<void (__thiscall Entity::* )(int),void,Entity,int>,std::_Ph<1> &,int>
1>          ]

When commenting out the lines with the std::bind, everything compiles fine.


I also tried the code from the official download, same problem. Haven't tried the github-code but will do so.
But maybe in the meantime anyone knows why this happens?

Thanks in advance

109
General discussions / Re: Visual Studio "14"
« on: June 16, 2014, 08:58:52 am »
Haven't tried it and won't until final release. I'm happy with VS2013 atm. and I do not want to set up a new dev machine for that, like you. And I have no use for the new C++14 features atm. as I'm still learning all the C++11 stuff ;)

More interesting for me is the question, has Microsoft again screwed the UI of VS2014 or is it as good as the VS2013 UI?

110
General discussions / Re: SFML Game Development -- A book on SFML
« on: June 16, 2014, 08:40:51 am »
Yeah overloading bitwise operators seems like a good idea. I will put it on the "to-research"-list and will come back later to it. For now I stick with storing categories as unsigned int as in the book, because it's a very easy and pragmatic implementation.

Thanks for the answers so far
Cheers!

111
General discussions / Re: SFML Game Development -- A book on SFML
« on: June 13, 2014, 11:27:10 am »
Heck, completely missed the part on strongly typed enum's in your book, should read more carefully and browse code less.
OK, question answered, my next implementation will make use of enum classes. ;)

But with that the next question arises:
The command system uses an enum for the receiver categories, where only one bit is set per enum member. The purpose is clear to construct compound categories via &-operator and to check compound categories via |-operator. I know I can contruct such a enum class with bitwise members, but do the bitwise operators still function the same way as with normal enums?

112
General discussions / Re: SFML Game Development -- A book on SFML
« on: June 13, 2014, 10:30:34 am »
I was just looking over the implementation of the ResourceHolder class again yesterday and recognized that ResourceIdentifiers.hpp uses enums nested in namespaces. I think the main purpose of this would be to "emulate" strongly typed enums (as of  c++ enums are not strongly typed) so that no name conflicts arise.

C++11 offers enum classes which serve the purpose of strongly typed enums, so that one is enforced to use the strong name of an enum member.

So my question is, could the following code
namespace Textures
{
        enum ID
        {
                Eagle,
                Raptor,
                Desert,
        };
}

be rewritten to
enum class TextureID
{
        Eagle,
        Raptor,
        Desert,
};
 

to accomplish the same goal? One must then reference to a member of this enum class via TextureID::Eagle instead of Texture::Eagle.
I don't want to do this just for the features sake, but to eliminate the additional namespace, because I think it's a not intended use for a namespace, and an enum class is a real type compared to a classical enum.
I think this is a worthwhile refactor, but would like to here more expert opinions on this.

Thanks in advance.

113
General discussions / Re: Debian/Ubuntu packages for SFML
« on: June 11, 2014, 08:46:19 am »
@amhndu: Hm I did not need to install libudev-dev, must check if something has preinstalled it, but could be a difference between 12.04 and 14.04. I will do another clean 14.04 install on my test system and check the tutorial again, maybe I oversaw something.
For the library path, I had no problem with linking although my sfml libs reside in /usr/local/lib. Maybe Code::Blocks 13.11 added it to the standard search path. Will check it also.

But good points you mentioned, will check them and update the tutorial appropriately.

@Tank: I did not know about apt-get build-dep command, looks promising. Will check it definitely, maybe it eases up the whole process. Thanks for pointing me to it.

Cheers!

114
General discussions / Re: Debian/Ubuntu packages for SFML
« on: May 28, 2014, 09:36:39 am »
When you are like me and have problems building SFML on Linux with the official tutorial, here is now my tutorial on how to build SFML on Ubuntu correctly with every dependency:

How to setup SFML on Ubuntu 14.04 LTS

I wrote this post two months ago, but with the release of 14.04 LTS, I decided to postpone the release of the tutorial and update it for 14.04 LTS, which I done yesterday. So here you are ;)

115
General discussions / Re: Question about game performance
« on: May 14, 2014, 09:26:03 am »
A better solution to this, is to set the working directory correctly in the VS project properties to the output directory of the .exe file. Then starting debugging in VS works ;)

116
General discussions / Re: Question about game performance
« on: May 12, 2014, 08:21:49 am »
Also the Intel 3000 HD Graphics is known to have a poor OpenGL Performance and SFML relies on OpenGL, therefore this also could be a problem.
I also build the game from the book, and on my gaming machine it runs with over 300fps, (Core 2 Duo E6850, 8 GB RAM, GeForce GTX 260, running on Ubuntu 14.04) even with the unoptimized collision detection algorithm.

Try (re)installing your graphics drivers.
After this use a profiler.

Good Luck ;)

117
General / Re: Top-Down Roguelike Game, some doubts and thoughts.
« on: May 06, 2014, 01:04:07 pm »
Hey gabrieljt,
I am very much doing the same thing, also based on the book SFML Game Development ;)
I'm not as far as your project, I'm still stuck in the basic framework and will start the dungeon topic in a few days hopefully. About the basic framework we are both doing things equally and I'm looking forward to read your dungeon class ;)
Maybe I will fork your project, here is mine if interested https://github.com/SeriousITGuy

Cheers


118
General discussions / Re: Source code consistency
« on: March 06, 2014, 11:30:36 am »
Yeah it matters heavily to me. It makes code more readable to me AND I make less errors. I took a look at some good examples and tailored my own coding style from it. Here are my most important coding rules:

- Use speaking names for variables/functions and use correct camel casing (starting with a lower case and every new word with an upper case). Avoid abbreviations!
- Avoid vertical space waste, opening curly braces are on the same line then the statement: if( _isPaused ) { ...
- Indent only inside braces  if( _isPaused )
- One line conditional statements are always enclosed by curly bracers
- In class definitions public interface comes first, followed by public members, then protected functions and members, then private functions and at last private members.
- Private class member names start with an underscore: sf::RenderWindow _window; (I don't like the often used m as a starting character)
- Indent member names in class definitions to make nice looking columns, but only in each public, protected, private block
- Always use #pragma once in the beginning of every code file (traditional include guards are ugly and serve no purpose anymore since every prominent compiler uses #pragma once)
- Use multiple namespaces for the project to separate e.g. engine, entities, game states etc.
- Always use STL algorithms and containers, use smart pointers and RAII, avoid manual memory management like the plague
- Use const as much as possible! It helps avoiding stupid bugs!

I have more rules, but these are the most important to me. Since following them, my code became much cleaner and more bug free. Especially the use of const helped me much ;)

Good luck in finding your own style.

119
I was wondering about the same "problem" the last days. The approach in the SFML dev Book is really nice, and I will definitely extend it to mouse and gamepad with additional std::map's to add those bindings as well.
After that I think Thor will be the next step for me to learn ;)

Thanks again Nexus!

120
General discussions / Re: Debian/Ubuntu packages for SFML
« on: January 17, 2014, 01:04:25 pm »
 :o Ok, I understand, that would be the obvious solution to all the problems  ;D
TGIF and I can give it a shot this weekend.

Thanks in advance  :-*

Btw. I did came up with the solution to my other problem, I build a 32bit version of libGLEW instead of a 64bit version. Shame on me. This cries for a tutorial "How to setup SFML2.1 on Ubuntu correctly" ;)
Maybe I do such a tutorial after I solved my problems.

Cheers!

Pages: 1 ... 6 7 [8] 9
anything