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

Author Topic: SFML Game Development by Example - 4th SFML book  (Read 183232 times)

0 Members and 5 Guests are viewing this topic.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML Game Development by Example - 4th SFML book
« Reply #75 on: April 12, 2016, 12:19:12 am »
Don't forget that for the SFML eBook from Packt you can use the promo code from the Learn page to get 50% off.

But lol what the heck is this? The print + ebook is €22.50 and the ebook by itself is €35.99, what is going on there? ;D
« Last Edit: April 12, 2016, 12:21:51 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #76 on: April 12, 2016, 12:57:45 am »
That's really weird. It doesn't do that on my end at all, no matter which currency is selected. Either way, Amazon also offers both versions of the book, so you could check that out as well:

http://www.amazon.com/SFML-Development-Example-Raimondas-Pupius-ebook/dp/B01061QAH4/ref=tmm_kin_swatch_0?_encoding=UTF8&qid=&sr=

FloatPeasant

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #77 on: April 12, 2016, 04:42:06 pm »
Are we allowed to use the code in the examples however we want or is it just for training?

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #78 on: April 12, 2016, 04:46:45 pm »
Are we allowed to use the code in the examples however we want or is it just for training?
Feel free to use it in whatever manner you choose. :)

FloatPeasant

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #79 on: April 13, 2016, 09:04:57 pm »
Very happy to hear, bought the book hopefully i learn some useful stuff   :D

first_sputnik

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: SFML Game Development by Example - 4th SFML book
« Reply #80 on: May 06, 2016, 10:40:35 pm »
Can I use this book as my first SFML book? Or should I start with another one?

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #81 on: May 07, 2016, 06:50:42 pm »
Can I use this book as my first SFML book? Or should I start with another one?
The book does start off explaining all of the fundamentals. It is also extremely verbose as far as code examples go, so I would say yes. Just make sure you have a decent amount of C++ experience. :)

first_sputnik

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: SFML Game Development by Example - 4th SFML book
« Reply #82 on: May 08, 2016, 04:47:53 am »
The book does start off explaining all of the fundamentals. It is also extremely verbose as far as code examples go, so I would say yes. Just make sure you have a decent amount of C++ experience. :)

Thank you sir!

northLynx

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #83 on: June 19, 2016, 02:31:57 am »
I am on the third chapter of the book and followed the code from the book to make the snake game. Right when I call the render functions for the snake and world I realized that that whats passed into the function is not a function that the book made me created. The function is called GetRenderWindow() and its called like *m_window.GetRenderWindow() and passed into the render function like that as well. I checked the chapter again to see if I missed it but I dont see it. Is it something that I need to make because GetRenderWindow is not a function either for the window class.

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #84 on: June 19, 2016, 04:44:34 pm »
I am on the third chapter of the book and followed the code from the book to make the snake game. Right when I call the render functions for the snake and world I realized that that whats passed into the function is not a function that the book made me created. The function is called GetRenderWindow() and its called like *m_window.GetRenderWindow() and passed into the render function like that as well. I checked the chapter again to see if I missed it but I dont see it. Is it something that I need to make because GetRenderWindow is not a function either for the window class.

Oh, I'm so sorry about that. Perhaps an older version of the code has made it into production somehow. Anyway, it's just a simple getter that returns a pointer to the sf::RenderWindow like this:
sf::RenderWindow* Window::GetRenderWindow() { return &m_window; }
Please add that in to the Window class (don't forget to declare it in the header as well), and let me know if it works. Thanks for the feedback! :)

Edit: Come to think of it, it may have even been emitted in order to save some space as well, along with a few other setter/getter methods. Either way, the code files of the book contain everything you will need. Nothing is left out there. :)
« Last Edit: June 19, 2016, 04:47:32 pm by OrderNexus »

northLynx

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #85 on: June 19, 2016, 07:23:13 pm »
Yes that did the trick! Now I am getting an error with the float timestep variable the book created. I compared the m_elapsed sf::Time variable I created from chapter 2 and I am assuming the book says that you need to compare that with the float timestep,but it is giving me an error. Is it suppose to give me an error?

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #86 on: June 19, 2016, 08:23:38 pm »
Yes that did the trick! Now I am getting an error with the float timestep variable the book created. I compared the m_elapsed sf::Time variable I created from chapter 2 and I am assuming the book says that you need to compare that with the float timestep,but it is giving me an error. Is it suppose to give me an error?
The m_elapsed data member should be a float, not sf::Time. That's why it gets compared to another float.
class Game{
...
private:
        ...
        float m_elapsed; // <---
        ...
};
The way it's manipulated is by using the .asSeconds() method of sf::Time when time is being added:
void Game::RestartClock(){ m_elapsed += m_clock.restart().asSeconds(); }
It sounds like you have something mixed up, but it's not the end of the world. You can either adjust your code so that the m_elapsed data member is a floating point number, or simply use .asSeconds() to retrieve a float value from sf::Time. Hope that clears it up a little. If you're still having problems, feel free to send me a PM with your code attached (preferably on pastebin). I will take a look at it and help you out more.

northLynx

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #87 on: June 26, 2016, 06:19:03 am »
I got to the chapter 4 and now I am having a problem with one of the functions of the eventmanager. I call setfocus in window.cpp but I realized the book never implemented it. Should I know how to implement it? Also, the same with the void togglefullscreen function that was introduced as well in chapter 4.

OrderNexus

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: SFML Game Development by Example - 4th SFML book
« Reply #88 on: June 26, 2016, 06:52:51 pm »
I got to the chapter 4 and now I am having a problem with one of the functions of the eventmanager. I call setfocus in window.cpp but I realized the book never implemented it. Should I know how to implement it? Also, the same with the void togglefullscreen function that was introduced as well in chapter 4.
Sorry about that. If it was emitted in the chapter for whatever reason, you can still find it in the code files that came with the book.
The SetFocus method is actually really simple. All it does is reset a boolean inside the class:
void EventManager::SetFocus(bool l_focus){ m_hasFocus = l_focus; }
ToggleFullscreen method just flips its own boolean that holds the full-screen state, then destroys and re-creates the window:
void Window::ToggleFullscreen(EventDetails* l_details){
        m_isFullscreen = !m_isFullscreen;
        m_window.close();
        Create();
}
Once again, please consult the code files that came with the book, as it should all be included in there. Hope this helps.

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: SFML Game Development by Example - 4th SFML book
« Reply #89 on: July 04, 2016, 02:13:55 pm »
Just got the book in by mail :)

Thanks a lot, looks good so far... just finished Chapter 2.
I'll admit, I've read other C++ books before, also on game creation, This one has its cons and pros if you ask me.

Chapter 1:
Pro:
Easy and straight forward, if you know your way around VC.
Con:
The setting up could use more attention to detail (page 5: Where do you put what in? C++/Linker and so far) the way it is now, you could just as well write a link to the SFML tutorial and a list over what to include.

Chapter 2:
Pro:
Fast intro to the "meat of stuff" and nice not to do 3 different "hello world" examples for once.
Con:
The code is still so short here that it could be include fully. leaving out " #include "SFML/Graphics.h"  "on page 20 & page 25, as well as cutting the Game Class Cpp and header down seems pointless to me.
All it did was letting me get more familiar with the error output window in VC


When all that is all said and done, i really liked the book so far and look forward to see what it will bring me.

Thanks for making it :)


-EDIT-

on to chapter 3:
*m_window.GetRenderWindow();

This function is required on page 55. it is not mentioned in the book.
A bit of hacking later and i have a solution:

in Window.h as a public function:

sf::RenderWindow* GetRenderWindow();

and in Window.cpp

sf::RenderWindow* Window::getRenderWindow() {
   return &m_window;
}


This works.

*Please note, the things i write is not meant to put you down from the book,its a first edition, i realize that and its still awesome. I hope to see a second edition with the different typos and left outs corrected.
Still awesome and keep it up.. also glad to see you interact with your readers :)
« Last Edit: July 04, 2016, 06:59:48 pm by GameBear »
string message = "some random dude";
cout << "I'm just " << message;

 

anything