Could we have the source?
Printable View
Could we have the source?
>Could we have the source?
heh.. not in it's current state :rolleyes: i'll have to clean it up some, and maybe comment it a bit... i'm just finishing up the scoring and everything, so i'll try to post it later today.
//edit: source is up.. you can get it from that thread where people post their best games :rolleyes: (in the gaming forum)
Heh... My class version right now only has a ball and is ASCII (don't know graphics and don't really have the time to learn... college starts again in about a week).
As for globals... it uses them for the screen's size and for the ASCII character that represents the ball (I'm using #define ).
Why not use const?Quote:
Originally posted by Frobozz
(I'm using #define ).
Good question... I'm just using it because I've seen it used a lot in a friend's code and also in my professor's code (even though I haven't taken his class yet).
Is const better? Does #declare allow stuff to be used regardless of data type?
when you use #define such as in the form
#define PI 3.1415926
then PI will be treated as though it is a float.
PI could also be declared as
const float PI = 3.1415926
Not much difference, though one is a const global variable the other is a #define statement
Later,
Actually, it would be a double, not a float.Quote:
Originally posted by WebmasterMattD
when you use #define such as in the form
#define PI 3.1415926
then PI will be treated as though it is a float.
PI could also be declared as
const float PI = 3.1415926
Not much difference, though one is a const global variable the other is a #define statement
Later,
#define doesn't obey scope rules, so you shouldn't use it much. There are only very few places you should have to use #define, and this is not one of them.