Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [C++ Help (SDL)] How do I know what coordinate to draw things to?
Index -> Programming, C++ -> C++ Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Raknarg




PostPosted: Sun Sep 15, 2013 9:31 pm   Post subject: RE:[C++ Help (SDL)] How do I know what coordinate to draw things to?

I think the first way makes linguistic sense. The opening brace shows that it is indefinitely referring to that statement, otherwise it is (at a glance) indistinguishable from any other statement (that don't use braces, that is).

I just prefer it.
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Sun Sep 15, 2013 11:22 pm   Post subject: Re: [C++ Help (SDL)] How do I know what coordinate to draw things to?

I think the most important thing about coding styles is to decide on one style and stick with it. Consistency of your style throughout a project is much more important than the style itself in my opinion.
Shinobu




PostPosted: Mon Sep 16, 2013 4:47 pm   Post subject: Re: [C++ Help (SDL)] How do I know what coordinate to draw things to?

Dreadnought @ September 15th 2013, 11:22 pm wrote:
I think the most important thing about coding styles is to decide on one style and stick with it. Consistency of your style throughout a project is much more important than the style itself in my opinion.


Yeah, I just recently started naming my variables by a certain way, and lowercase/uppercase stuff.
It's just a lot easier Razz

I'm probably used to the second way because Alex Allain (the author of my ebook) does it. I just copy most the things he does Razz
To me it's just easier to see { and } directly above and below each other, rather than the first way (it's just harder to find the curly brackets imo)
If people like the first way more, I think I might just try and get out of my comfort zone and try the first way Confused
Raknarg




PostPosted: Mon Sep 16, 2013 6:26 pm   Post subject: RE:[C++ Help (SDL)] How do I know what coordinate to draw things to?

As said, it doesn't really matter which method you use. Use what you're comfortable with.

And yes, using proper names is almost as good as documenting properly. A good goal with all your programs is make it so it's like reading an English manual. It makes it easier for you and everyone else, especially on the larger scale.
Dreadnought




PostPosted: Mon Sep 16, 2013 7:48 pm   Post subject: Re: [C++ Help (SDL)] How do I know what coordinate to draw things to?

I'd also like to add that if you're working on someone else's project, you should try to follow their style as much as possible, again for consistency.
Shinobu




PostPosted: Mon Sep 23, 2013 7:21 pm   Post subject: Re: [C++ Help (SDL)] How do I know what coordinate to draw things to?

Dreadnought @ September 16th 2013, 7:48 pm wrote:
I'd also like to add that if you're working on someone else's project, you should try to follow their style as much as possible, again for consistency.

That clears up a lot of things for me Smile

But for LazyFoo's tutorials, he uses a heck of a lot of global variables.
There's a lot that I find very unnecessary, to use in such a large scope. Should I just do what he does and change later on when I'm really good?
I'm stuck on a chapter because I just don't exactly know how to make the scopes smaller lol (I'm just going to use global variables for now)
Raknarg




PostPosted: Mon Sep 23, 2013 8:51 pm   Post subject: RE:[C++ Help (SDL)] How do I know what coordinate to draw things to?

Well, think about how each variable is used. Are you only using a certain variable within a certain method? If so, make it local. Is it used across the program? Make it global. It should only be global if it needs to be imo
Shinobu




PostPosted: Fri Sep 27, 2013 7:41 pm   Post subject: Re: RE:[C++ Help (SDL)] How do I know what coordinate to draw things to?

Raknarg @ September 23rd 2013, 8:51 pm wrote:
Well, think about how each variable is used. Are you only using a certain variable within a certain method? If so, make it local. Is it used across the program? Make it global. It should only be global if it needs to be imo


You're the best! Smile

I had a hard time deciding whether or not making variables local or non-local lol.
I always ended up making them non-local because of what I saw on examples on YouTube.
Sometimes, I ended up making things look weird by making a lot of pointers (which now, I don't anymore)

That actually clears up a lot of my programming time lol.
I have a better idea of how many things can access a variable now Very Happy
I'm still not used to it, but my code does look better now XD
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Fri Sep 27, 2013 7:54 pm   Post subject: RE:[C++ Help (SDL)] How do I know what coordinate to draw things to?

Remember the idea is to make your code like an instruction manual, so the less convoluted the better. That means good names for everything, comments, and do things that make sense.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 24 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: