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

Pages: 1 2 3 [4]
46
General discussions / Re: SFML Game Development -- A book on SFML
« on: November 30, 2013, 04:37:50 pm »
The diagram you used to demonstrate the flow of commands in Ch 4 was very helpful.  It's what made me realize it be really helpful to have a visual representation of classes and their interactions.  That got me wondering whether there was an popularized convention for diagramming different aspects of code?

Also, could you respond to the std::placeholders question?  I looked up a number of references, but still don't understand why a placeholder is being set for a function that doesn't have a parameter.

47
General discussions / Re: SFML Game Development -- A book on SFML
« on: November 30, 2013, 01:27:08 pm »
I have a few questions related to the book.

First, I am looking for a way to draw/visualize the systems used in the book.  For example, I have read and reread how commands are applied to the SceneGraph.  However, I just keep forgetting how they interact and this is true of a number of systems.  I need a technique to draw the interactions, so I can reference them now and then until they sink in.  Do you have any recommendations for this type of approach?

Next, I have a couple c++ 11 questions. 

In the following snippet of code why is this needed in the capture list?  Is it so createProjectile is in scope?

Quote
mMissileCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
{
   createProjectile(node, Projectile::Missile, 0.f, 0.5, textures);
};

Why is the std::placeholders::_1 used here, when the increaseSpread function takes zero parameters.

Quote
data[Pickup::FireSpread].action = std::bind(&Aircraft::increaseSpread, _1);

void Aircraft::increaseSpread()
{
   if (mSpreadLevel < 3)
      ++mSpreadLevel;
}

Finally, here's a small correction I noticed in chapter 7 under the subtitle Displaying Text.  The author mentions the method Aircraft::update when they meant Aircraft::updateTexts. 

Quote
In the method Aircraft::update(), we check for the current hitpoints, and convert them to a string, using our custom toString() function.

48
General discussions / Re: SFML Game Development -- A book on SFML
« on: October 28, 2013, 06:00:13 pm »
I'm having an issue understanding the syntax of the derivedAction function.  Using std::function is new to me and is the crux of the issue.  I have included the entire function at the bottom.

std::function<void(SceneNode&, sf::Time)> derivedAction(Function fn)
 

The "std::function<void(SceneNode&, sf::Time)>" specifies the signature for the function derivedAction takes as a parameter.  However, this doesn't seem to jive with the examples from http://en.cppreference.com/w/cpp/utility/functional/function.  My understanding is that it should be specifying the signature for derivedAction.

moveLeft.action = derivedAction<Aircraft>(AircraftMover(-playerSpeed, 0.f));
 

I'm confused with the use of "<Aircraft>". 


template <typename GameObject, typename Function>
std::function<void(SceneNode&, sf::Time)> derivedAction(Function fn)
{
        return [=] (SceneNode& node, sf:Time dt)
        {
                // Check if cast is safe
                assert(dynamic_cast<GameObject*>(&node) != nullptr);

                // Downcast node and invoke function on it
                fn(static_cast<GameObject&>(node), dt)
        };
}
 

49
General discussions / Re: SFML Game Development -- A book on SFML
« on: October 28, 2013, 02:57:01 pm »
As I read the book I find myself wanting to ask a few questions.  Is there a forum or appropriate place to discuss aspects of the book?

50
General discussions / Re: SFML Game Development -- A book on SFML
« on: October 11, 2013, 04:58:15 pm »
I pulled down the SFML-Game-Development-Book repository and I was able to successfully build all the projects with VC++11.  Chapter 7 now runs successfully.

Chapters 8-10 load into the menus, but when I press the "play" button the game crashes.

I am about a quarter into the book and enjoying it.

51
General discussions / Re: SFML Game Development -- A book on SFML
« on: October 08, 2013, 12:06:08 pm »
I am having an issue compiling chapters 7-10.  I read through the thread and saw a few others were affected.  The solution Groogy provides at the bottom of page 6 does not work for me and I see no one else confirming the workaround for VC++11 users.

To be clear I receive the following errors when compiling chapters 7-10.

Quote
error C2100: illegal indirection

and

Quote
error C3849: function-style call on an expression of type 'const std::_Bind<_Forced,_Ret,_Fun,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t,<unnamed-symbol>>' would lose const and/or volatile qualifiers for all 2 available operator overloads

I verify there are no additional changes in the repository on GitHub for "SFML-Game-Development-Book / 07_Gameplay / Source /".  I then make the one line change Groogy suggests in DataTables.cpp at the end of page 6.

Quote
data[Pickup::HealthRefill].action = [] (Aircraft& a) { a.repair(25); };

The error about indirection is gone, but I still receive the following error.

Quote
error C3849: function-style call on an expression of type 'const std::_Bind<_Forced,_Ret,_Fun,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t,<unnamed-symbol>>' would lose const and/or volatile qualifiers for all 2 available operator overloads


Pages: 1 2 3 [4]
anything