SDL first project

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
sk1v3r
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 25
Joined: Sun Jan 09, 2011 1:36 pm

SDL first project

Post by sk1v3r »

Hey, I'm fairly new and I have just created my first SDL 'experiment'
because I'm fairly new, and you guys are awesome, I wanted to see if you guys like it, and if the code is good or bad :)
http://rapidshare.com/files/444341187/rain_arrow.zip
I'm proud of it, but I have no idea if what I'm doing is right or efficient, so...
left and right click to move the stuff around :)
User avatar
adikid89
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 94
Joined: Tue Apr 27, 2010 6:59 am
Current Project: small tiny-mini projects
Favorite Gaming Platforms: PC I guess...
Programming Language of Choice: c++

Re: SDL first project

Post by adikid89 »

I like it! Not only is it interesting, but the code is also clean. Good job! :D
My first game C++/SDL Yoshi Combat! = http://www.youtube.com/watch?v=HQ9mMBEWSZg
==============================================================
Image
D-e-X
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Tue Dec 28, 2010 6:49 pm

Re: SDL first project

Post by D-e-X »

Looks nice and clean, however, you should comment or rename such variables as "int i = 0;" ;)
I remember when I used to be into nostalgia.
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

Re: SDL first project

Post by LeonBlade »

D-e-X wrote:Looks nice and clean, however, you should comment or rename such variables as "int i = 0;" ;)
I don't think i really needs much explanation but.

Image
Squares, squares everywhere...
Last edited by LeonBlade on Tue Jan 25, 2011 11:49 am, edited 1 time in total.
There's no place like ~/
D-e-X
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Tue Dec 28, 2010 6:49 pm

Re: SDL first project

Post by D-e-X »

LeonBlade wrote:
D-e-X wrote:Looks nice and clean, however, you should comment or rename such variables as "int i = 0;" ;)
I don't think i really needs much explanation but.
First of all, "but" what?

Second of all, it's his first project, and I'm just pointing out that even though "i" might be obvious here, having i, j, k, or x everywhere (in a bigger project) without a name related to its usage, (like by convention it should have) makes it unnecessarily hard to grasp the point of its existence.

Of course, people would understand those used in for loops or as counters by general, you don't have to write:

Code: Select all

int counter = 0;
int someVar = 3;
for(;counter < someVar; ++counter) {
std::cout << "HAI!" << "\n";
}
But when the counter itself is used for something specific (not just in loops, but also in if statements and others), it's good design to name it something that explains its use. I know this got redundant, but I'm just trying to get my point across. HOWEVER, note that this is partly subjective and I am no one to tell EXACTLY how it should be ;), so excuse any ignorance that might be.
I remember when I used to be into nostalgia.
sk1v3r
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 25
Joined: Sun Jan 09, 2011 1:36 pm

Re: SDL first project

Post by sk1v3r »

Thanks for the replies :) I'll keep in mind to name everything appropriately :)
User avatar
xiphirx
Chaos Rift Junior
Chaos Rift Junior
Posts: 324
Joined: Mon Mar 22, 2010 3:15 pm
Current Project: ******** (Unkown for the time being)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: SDL first project

Post by xiphirx »

Make sure you free your SDL Surfaces :)
StarCraft II Zerg Strategy, open to all levels of players!

Looking for paid work :< Contact me if you are interested in creating a website, need a web design, or anything else you think I'm capable of :)
sk1v3r
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 25
Joined: Sun Jan 09, 2011 1:36 pm

Re: SDL first project

Post by sk1v3r »

the only surface I had was the screen, I was under the impression that SDL_Quit freed the screen only. If not then oops :/
D-e-X
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 39
Joined: Tue Dec 28, 2010 6:49 pm

Re: SDL first project

Post by D-e-X »

sk1v3r wrote:the only surface I had was the screen, I was under the impression that SDL_Quit freed the screen only. If not then oops :/
^ This is true, SDL_Quit() takes care of the buffer for you ;), so don't worry about it.
I remember when I used to be into nostalgia.
User avatar
xiphirx
Chaos Rift Junior
Chaos Rift Junior
Posts: 324
Joined: Mon Mar 22, 2010 3:15 pm
Current Project: ******** (Unkown for the time being)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: SDL first project

Post by xiphirx »

D-e-X wrote:
sk1v3r wrote:the only surface I had was the screen, I was under the impression that SDL_Quit freed the screen only. If not then oops :/
^ This is true, SDL_Quit() takes care of the buffer for you ;), so don't worry about it.
I have learned something then :)
StarCraft II Zerg Strategy, open to all levels of players!

Looking for paid work :< Contact me if you are interested in creating a website, need a web design, or anything else you think I'm capable of :)
Post Reply