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

Author Topic: AlexxanderX's Tutorials  (Read 11837 times)

0 Members and 1 Guest are viewing this topic.

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
AlexxanderX's Tutorials
« on: January 05, 2013, 01:50:21 pm »
Hello! I decided to make an blog and to post tutorials about SFML and informations about my projects. Here is my blog: http://alexanderx.net/
I will try to upload at least 1 tutorial per week.

Here is a list of actual tutorials on my blog:
« Last Edit: June 11, 2014, 08:56:09 pm by AlexxanderX »
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: AlexxanderX Tutorials
« Reply #1 on: January 05, 2013, 01:58:56 pm »
You should fix your link ;)

Also, you use interchangeably int and unsigned int for index access. You should use unsigned int, or directly std::size_t.

Then, top-level const qualifiers are useless:
void menu::setString(int item_number, const sf::String item_string)
You still perform a copy, and the caller isn't interested whether this copy is constant or not. What you probably want is a reference to a const sf::String:
void menu::setString(int item_number, const sf::String& item_string)

You should also make your code const-correct in other places, and get rid of unnecessary parameters.
void setFont(sf::Font &font);
// ->
void setFont(const sf::Font& font);
int menu::getCurrentItem()
// ->
std::size_t menu::getCurrentItem() const
void menu::update(sf::RenderWindow &window, sf::Event &event)
// ->
void menu::update(const sf::Event& event)

Apart from that, the code looks good, I like the fact that you use STL containers and no new/delete :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: AlexxanderX Tutorials
« Reply #2 on: January 05, 2013, 02:41:18 pm »
Thanks. I modified!  ;D
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: AlexxanderX Tutorials
« Reply #3 on: January 06, 2013, 04:31:30 am »
You can just use unsigned without specifying the type as int is the default unsigned type, as a personal taste I find it better due to laziness and less typing.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

kaB00M

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Caffeware
    • Email
Re: AlexxanderX Tutorials
« Reply #4 on: January 06, 2013, 07:10:04 pm »
In my menus a use a single instance of sf::Text instead of a vector.
I move this text around and set the string (content) before drawing in my draw loop? Is my method slow?
« Last Edit: January 06, 2013, 07:27:20 pm by kaB00M »



Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: AlexxanderX Tutorials
« Reply #5 on: January 06, 2013, 07:49:53 pm »
I move this text around and set the string (content) before drawing in my draw loop? Is my method slow?
It should not be an issue. The worst thing that can happen is that sf::Font has to load new glyphs, but you probably won't notice the difference.

Depending on the graphical effects you want to have in your menu, a vector may be more flexible.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: AlexxanderX Tutorials
« Reply #6 on: January 09, 2013, 04:53:28 pm »
About what to wrote in the next tutorial?
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

Foaly

  • Sr. Member
  • ****
  • Posts: 453
    • View Profile
Re: AlexxanderX Tutorials
« Reply #7 on: January 09, 2013, 06:09:31 pm »
Please avoid posts like that. We are trying to be a helpful and friendly community here. Your post is not helpful in any way. Not everybody is a native English speaker or has the luck of having a good English teacher. Please respect that :)
By the way: The sentence might be unusual, but grammatically correct, except for one wrong verb form ("About what to write the next tutorial?")

topic: I really like the simplicity of your menu class! looks good!

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: AlexxanderX Tutorials
« Reply #8 on: April 11, 2014, 10:05:17 pm »
And I'm back( huh, after 1 year)! After I quit my free blog and lost the tutorial I made, the time has come to continue my blog. This time with a purchased domain and 2 tutorials, and my english improved. For more informations visit the first post.
« Last Edit: April 11, 2014, 10:17:16 pm by AlexxanderX »
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: AlexxanderX's Tutorials
« Reply #9 on: April 11, 2014, 10:26:25 pm »
Well, welcome back!  :D
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: AlexxanderX's Tutorials
« Reply #10 on: April 15, 2014, 04:02:11 pm »
I released I new tutorial -> here :D
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: AlexxanderX's Tutorials
« Reply #11 on: April 22, 2014, 11:45:49 am »
Another tutorial was released: Jumping in 2D platform games
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

lilz

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: AlexxanderX's Tutorials
« Reply #12 on: April 22, 2014, 04:20:52 pm »
Thats great. I did the collision-tutorial some days ago and tried to implement the jumping by myself - just for practice. It worked well but i could jump to the moon xD I will try the new tutorial.

I'm really new in programming and I think your tutorials are good for beginners.

I have one (maybe stupid question) about the code in the area part from the collision-tutorial.
for example:
Code: [Select]
if (area.contains({ area.left, player.getPosition().y }))I dont understand this brackets { }. I tried to compile it (Win7 VS 2012) and got some errors.
So I removed alle the brackets and it worked well... ?

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: AlexxanderX's Tutorials
« Reply #13 on: April 22, 2014, 04:25:09 pm »
I dont understand this brackets { }. I tried to compile it (Win7 VS 2012) and got some errors.
So I removed alle the brackets and it worked well... ?
http://en.wikipedia.org/wiki/C++11#Initializer_lists

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: AlexxanderX's Tutorials
« Reply #14 on: April 22, 2014, 09:05:38 pm »
@lilz Thanks. Well, in order to use the brackets you will need a C++11 compiler.
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

 

anything