Jump to content

  • Log In with Google      Sign In   
  • Create Account

How do you learn an API such as SDL?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Zero_Breaker   Members   -  Reputation: 367

Like
0Likes
Like

Posted 19 July 2014 - 03:35 PM

After re-learning most of my programming with some console programs i would like to move on to using libraries which i can make a 2D game with such as SDL but the problem i have is... How do i learn an API? Because when i was trying to learn SDL from LazyFoo's tutorial i didn't get it because to me it kind of wasn't explained properly on what function is or what it does. How did you guys start learning SDL and other libraries?



Sponsor:

#2 DiegoSLTS   Members   -  Reputation: 1374

Like
2Likes
Like

Posted 19 July 2014 - 04:50 PM

Tutorials are supposed to get you started, to give you an idea of how to do common things with that API's approach. Maybe the LazyFoo's tutorials are not clear enough for you, but good tutorials at least tell you what a piece of code (not necesarilly each function) is doing and that's fine. If you're reading a tutorial an you want to be sure what every line is doing you can open the documentation on another tab and search every function that looks like magic.

 

Once you have some idea of how an API must be used a good source to learn the API is the documentation itself. Even if you're not looking at a tutorial, if you know what's the purpose of a class you can read the documentation for that class and you'll learn new things just by reading what methods are available.

 

Another great way to learn something is to just search how to do something with it. Say you have an image with white background and you want it to be transparent. You can edit the image and save it as PNG with a transparent background or you can search "SDL change white background to transparent" in google, and reading some answers you'll probably learn something new.

 

Also, some people buy books about certain API's.

 

I don't think there's a way to learn everything from an API from the same source, API's tend to be really big and giving examples and details of everything is a lot of work, and trying to teach everything in a progresive and clear way is a lot harder. At the end, you'll learn an API while using it and finding obstacles, wondering if something can be done and how can you do it.



#3 SimonForsman   Crossbones+   -  Reputation: 6111

Like
1Likes
Like

Posted 19 July 2014 - 05:05 PM

After re-learning most of my programming with some console programs i would like to move on to using libraries which i can make a 2D game with such as SDL but the problem i have is... How do i learn an API? Because when i was trying to learn SDL from LazyFoo's tutorial i didn't get it because to me it kind of wasn't explained properly on what function is or what it does. How did you guys start learning SDL and other libraries?

 

I used the documentation: http://wiki.libsdl.org/APIByCategory. Once you know what to expect from a library it becomes quite easy to look in the documentation to find the information you need.


I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#4 Zero_Breaker   Members   -  Reputation: 367

Like
0Likes
Like

Posted 19 July 2014 - 05:58 PM

Greatly appreciated. So in a nutshell you just have to know what each function/class does by looking at how it is used by looking at examples and experimenting with it.



#5 SeanMiddleditch   Members   -  Reputation: 5872

Like
4Likes
Like

Posted 19 July 2014 - 08:52 PM

How do you learn an API such as SDL?


Make something with it. Come up with some simple game/app. Try to make it. When you need some feature that you don't know how to use, look it up. By the end you'll know the gist of everything you need to and you'll have working sample code that you intimately understand since you wrote it.

The only way to learn anything for real is to _do it_. Practice, practice, practice.

#6 BitMaster   Crossbones+   -  Reputation: 4089

Like
0Likes
Like

Posted 20 July 2014 - 02:51 AM

Greatly appreciated. So in a nutshell you just have to know what each function/class does by looking at how it is used by looking at examples and experimenting with it.


No, that is a bad way to go on about it. You might use a tutorial or example code to get an approximate idea where to start and then you use, as SimonForsman says, the documentation to understand the details. Just experimenting will not tell you about all those important details what an API promises under which condition and about where it explicitly makes no guarantees.

#7 Zero_Breaker   Members   -  Reputation: 367

Like
0Likes
Like

Posted 20 July 2014 - 04:09 AM

I see. Thank you for the warning Bitmaster. So you use tutorials to start of to get an idea on how to use the API and the documentation to understand the intricate the details of the code i want to use.


Edited by Zero_Breaker, 20 July 2014 - 04:10 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS