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

Author Topic: SFML 2 - Introduction Tutorial & Wallpaper  (Read 10555 times)

0 Members and 3 Guests are viewing this topic.

gorgoroth666

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • RiseAgain
    • Email
SFML 2 - Introduction Tutorial & Wallpaper
« on: July 15, 2012, 08:07:28 pm »
Introductory tutorial to SFML 2:

http://riseagain.wordpress.com/2012/07/15/sfml-2-tutorial-introduction/

I also made a cute SFML 2 documentation wallpaper:



---
Earth and sun background
from blog: http://fortheloveofhistruth.com/
under creative commons

SFML 2 Logo by Laurent Gomila

gorgoroth666

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • RiseAgain
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #1 on: July 17, 2012, 11:02:12 pm »
SFML - Tutorial - Pong

This simple C++ Game Development Tutorial introduces animation, collision detection and an implementation of the game of pong.

http://riseagain.wordpress.com/2012/07/17/sfml-2-tutorial-pong/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #2 on: July 17, 2012, 11:15:09 pm »
If I were you, I wouldn't focus on the basic functionality like compiling, linking, creating windows -- these topics are covered by the official tutorials, which will most likely be read by the users. Instead, focus on more advanced mechanisms (like the rectangle movement) which already use several parts of SFML.

By the way, include <SFML/Window.hpp> instead of <SFML\Window.hpp>, because it is platform-independent. And main() must have return type int, void is not valid C++.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

gorgoroth666

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • RiseAgain
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #3 on: July 17, 2012, 11:35:38 pm »
Thank you for this feedback.

In the first tutorial I used void main() in the first examples to not confuse potential beginners.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #4 on: July 17, 2012, 11:56:46 pm »
In the first tutorial I used void main() in the first examples to not confuse potential beginners.

How would that be less confusing than int main(). Using void main() will confuse beginners even more since every other C++ code uses int main(), also it's like teach wrong syntax, it doesn't help in any way. ;)

Although you state that you program for MSVC please try to keep your code as close to the standard and as close to crossplattform as possible. There's already enough bad code taught in books and all over the web, so having the choice to make it better is an opportunity not to miss!  :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gorgoroth666

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • RiseAgain
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #5 on: July 18, 2012, 12:25:36 am »
Thank you. Then, I change those two first examples from "void main" to "int main". So now they return EXIT_SUCCESS because I prefer that to any value. I hope everyone is familiar with that.

Haze

  • Full Member
  • ***
  • Posts: 201
    • View Profile
    • Github Profile
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #6 on: July 18, 2012, 05:05:52 pm »
Just for the sake of being picky: actually, the return instruction in the main function is not mandatory in C++.

int main()
{
}
This is compliant with the C++ standard, the compiler is required to add "return 0;" at the end of the function if no return instruction is provided.

I'll take a look at your videos when I'm back home :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #7 on: July 18, 2012, 05:15:44 pm »
Just for the sake of being picky: actually, the return instruction in the main function is not mandatory in C++.
But not doing so is still writing bad code and for sure will generate a compiler warning (or error if not supported). ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Haze

  • Full Member
  • ***
  • Posts: 201
    • View Profile
    • Github Profile
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #8 on: July 18, 2012, 06:39:24 pm »
But not doing so is still writing bad code and for sure will generate a compiler warning (or error if not supported). ;)

I'm not fond of it (this doesn't provide any feature and may confuse new C++ users...), but this is part of the C++ standard so I wouldn't qualify it as "bad code", using it or not it's more a matter of taste.
And your compiler should not raise any warning. (tested with Visual Studio /W4 and with g++ -pedantic -ansi -Wall -Wextra as well).


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #9 on: July 18, 2012, 07:04:33 pm »
Quote from: Haze link=topic=8550.msg57773#msg57773
but this is part of the C++ standard so I wouldn't qualify it as "bad code", using it or not it's more a matter of taste.
And your compiler should not raise any warning. (tested with Visual Studio /W4 and with g++ -pedantic -ansi -Wall -Wextra as well).
It's still confusing since it suggests that a function can have a return type but does not need to return something. IMHO that clause in the standard should get  ereased. I don't see the usefullness of this at all.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #10 on: July 18, 2012, 11:44:40 pm »
But not doing so is still writing bad code and for sure will generate a compiler warning (or error if not supported).
Not at all. Why should you return a value if nobody cares for it? I don't remember when I last wrote a return 0; at the end of main(), and I don't even have the usual "I will regret this"-feeling :D

I don't see the usefullness of this at all.
I don't see the usefulness of being forced to explictly return always 0 at the end of main() just for the sake of a C relict. I mean, in games and graphical applications, errors will be handled differently (in a more elaborate manner) anyway. Especially on Windows where executables are started from the explorer, the main() return value isn't even noticed.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #11 on: July 18, 2012, 11:59:32 pm »
Hmmmm... I see... ;)
Maybe I'll change that in the future. ;D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gorgoroth666

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • RiseAgain
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #12 on: July 19, 2012, 08:51:28 pm »
Tutorial 03 - Basic Game Structure - Break Out!

In this tutorial, we will cover refresh rate, a basic game structure, a custom game loop and the game of Break Out!.

http://riseagain.wordpress.com/2012/07/19/sfml-2-tutorial-break-out/


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #13 on: July 19, 2012, 09:44:52 pm »
Man it seems like you're on fire. ;D

I'll totally mention you in my next blog post. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gorgoroth666

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • RiseAgain
    • Email
Re: SFML 2 - Introduction Tutorial & Wallpaper
« Reply #14 on: July 19, 2012, 10:07:24 pm »
Thank you expl0iter !

 

anything