Are there any good tutorials for SDL2.0 for programming in C? (not C ++)

I am involved in C programming (currently).

In the topic I got, I need to create some kind of Wolfenstein3d clone (hence the name of the project, wolf3d). For this project, I am allowed to use either the graphics library created by my school or SDL. I chose SDL because it is more difficult to use and therefore more interesting.

Unfortunately, I could not find a tutorial for SDL2 in C. Even the links to the SDL wiki were C ++ oriented.

I would appreciate if you could help me find some good tutorials for SDL2 in C (although I know that the website policy "uses a search engine, which I did, but as I said, I won’t find them until so far).

I think I may have to explain a few things about my school so as not to give you the impression that I am asking you for help in order to deceive:

Why don't you look in your class notes?

Because they don’t give me. I am given projects, and sometimes a little hint, how I should do them. I should use Google or any means, as long as I understand what I did.

And that is pretty much the case. I'm also not looking for a tutorial on “creating a wolfenstein3d clone using SDL2.0”, but only a tutorial on how to use SDL2 itself, from creating a window to drawing points.

+8
c sdl-2
source share
1 answer

If I were you, I would use the training materials available on the SDL page:

http://wiki.libsdl.org/Tutorials

Combined with the API documentation here:

http://wiki.libsdl.org/APIByCategory

The API is written in C, therefore, although the tutorials can be in C ++, you should follow the manual, referring to the API documents and understanding the functional structure of the sample programs.

As a novice developer, you need to be able to understand the C ++ syntax in order to understand the conceptual way to develop a similar C application. API requests should be made in the same way.

Consider this page from one of the related tutorials (this is indicated as for C ++):

http://lazyfoo.net/tutorials/SDL/01_hello_SDL/index2.php

Are any of these code blocks really alien to you? They should not be, they are written in C. If you come across some expressions that you are not familiar with when you go through the tutorial, refer to the API. If you're still at a standstill, it might be time to post to StackOverflow. This particular tutorial can be written entirely in C, I'm not sure if I was only browsing the first few pages.

Also note that the documentation of the functions in the SDL API documents gives example code C and C ++:

http://wiki.libsdl.org/SDL_Init

Here you can cross-reference two identical C and C ++ programs and begin to learn how these same operations are performed in two languages. From there, you can begin to interpret C ++ textbooks for high-level functional operations and translate them into C, rather than just copying code samples. You will learn much more about this process.

For your own admission, you decided to go along a difficult route. You must be prepared to put some effort into the process!

+14
source share

All Articles