# noob questions

## Recommended Posts

Shuger    146
Hi I've wanted to ask you some questions. 1. What is the difference between SDL and windows graphic, which one's better. In tutorials i saw that SDL is easier to initialize, while windows must have huge block of difficult code, and also some other files needs to be created. 2.I'm trying to do some very simple side scroller maybe someone knows some good tutorial or something? 3.How can make a program to read input from keyboard and mouse(for example to click a button, steer with character, or read moves of mouse? Thanks very much to everybody who will try help me.

##### Share on other sites
Dev48GameDev    122
Hi!

1/ SDL is platform crossing : ie you cann use it with linux/windows ...
Furthermore, SDL manages more things than Windows GDI.
You can use it to manage keyboard and mouse.

If you want to work nly in windows, you can also use SDL.

About SDL, you've got some tutorials on gamedev I suppose. Furthermore, there is a forum here on SDL : [url]http://www.gamedev.net/community/forums/forum.asp?forum_id=61[/url]

##### Share on other sites
kaysik    382
Fanboi style: SDL is great, use it and ignore straight windows stuff [wink]

the SDL site itself has links to quite a few tutorials, and there is always [google] if you don't like any of the default ones they!

Not so fanboi (but still a bit [grin]): The Win32 api wasn't designed for specifically for games, and it was designed along time ago and has been though many updates which means its a mess. I find straight windows code rather hard to work with and generally its pretty tedious to work out how everything fits together nicely. Its definatly do-able, but if you want to make a game I think your time should be spent on making *the game* not figureing out Win32 api calls. Thats where SDL comes in. Its a well designed lib, with a simple interface that hides most of the complexity that is win32. Its definatly not perfect but its a major step up from straight win32 and unless you have some specific need to know the windows code I don't really think its worth learning for a hobby game. Stick with SDL and you'll have a much better time of it.

##### Share on other sites
Drew_Benton    1861
Quote:
 1. What is the difference between SDL and windows graphic, which one's better.In tutorials i saw that SDL is easier to initialize, while windows must have huge block of difficult code, and also some other files needs to be created.

Main difference between the two is that SDL is crossplat form and on the Win32 system, uses DirectDraw to draw with. SDL is easier because it wraps up all the stuff you would normally have to code to initialize graphics with. I think SDL is better than Win32 GDI anyday of the week. If you are starting out, SDL is definitly for you.

Quote:
 2.I'm trying to do some very simple side scroller maybe someone knows some good tutorial or something?

Lesson 6 from Cone3D is a great place to start. After that, the incomplete and probabally never to be finished lesson 7

Quote:
 3.How can make a program to read input from keyboard and mouse(for example to click a button, steer with character, or read moves of mouse?

Using SDL it's quite easy. Take a look at the tutorials on my website to get a taste of what the code looks like. Speaking of input, I have a post I will be making about input in SDL very soon...

##### Share on other sites
Shuger    146
Thanks very much to everyone!
Since everybody suggested i should use SDL I'll stick with it.

Meanwhile i'm writing a game i have another question which bothers me all the way i'm learning c++. How should I use #include command. In each source i check it's different, for example: some people use <stdlib.h> others <cstdlib>, and sometimes even one filename with ".h" an another without it in one file!
I figured out that i need to use whole path to file with ".h" part when i'm using my own files, but what about standard files?

Hope i haven't confused you to much with this description, sorry but English is not my mother language.

##### Share on other sites
I always use
#include <something.h> for all the include thingys
#include "something.h" if it's a header u wrote and is in prodject
I'm new to c++ too but I hoped I helped

##### Share on other sites
Neitsa    122
Hello,

C++ has been standardized in 1998 by the ISO commitee. It has been decided that the standard includes will not have the .h anymore. So if you want to include a standardized header file you should include it like this :

#include <iostream>

Standardized headers are part of the standard namespace called "std" so if you want to use it you can do :

#include <iosream>std::cout << "hello world" << std::endl ;

or

#include <iosream>using namespace std;cout << "hello world" << endl ;

Now about the C standard headers, when included in C++, the name of the header is preceded by a "c" (meaning it comes from C). As I was saying, you should not use .h if it's standardized, so :

Before standardization :

#include <stdlib.h>#include <stdio.h>

now :

#include <cstdlib>#include <cstdio>

As you own files aren't from standard (and everything that isn't standard like opengl, DX or SDL for example), you should continue to use the .h instead :D

Hope it helps.