SDL 2.0 book or tutorial list in just C?

'lo!

Is there a book or set of tutorials out there for using SDL 2.0 in C ?

NOT C++, just C.

I have some coworkers that are interested in learning SDL and all of our
projects are written in C. Most of the books and tutorials I’ve found
seem to all want to write their examples in C++, which is doesn’t help
my coworker.

Even a SDL 1.x in C would be fine.

Our focus is primarily in 2D, not 3D if it matters.

-Will

Hello, unfy!
I’m C programmer too and I learning SDL2 now. I learn it myself without any tutorials, using just SDL-wiki (http://wiki.libsdl.org) and this forum. And sometime looking to SDL2 source code (it’s written in C). I making simple test programs for different aspects of SDL2 and learn how it works.
I think we need more SDL tutorials in C - it is good idea. But for now we can learn using this resources, which we have. We can learn SDL2 + C programming together if you interested :slight_smile:

Many “C++” tutorials don’t use very many C++ features (classes and…
that’s probably it). SDL being a C API makes that happen. It’s possible
your coworkers could still benefit from them for now.

Jonny D

'lo!

Many of the C++ tutorials and book examples do heavily use classes and
stuff. It’s not useful for my coworker who hasn’t touched C++ in 20
years. I would normally agree with your assertion, Jonny - but not this
time heh.

I might go with Alex’s wiki thing… it’s how I learned SDL a decade
ago. Will just have to print out all of the pages (coworker prefers
print media). Now - why am I the one doing the printing ? Good question
best left for another day.

-WillOn 11/7/2014 9:43 AM, Jonathan Dearborn wrote:

Many “C++” tutorials don’t use very many C++ features (classes and…
that’s probably it). SDL being a C API makes that happen. It’s
possible your coworkers could still benefit from them for now.

Jonny D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Along these lines of using the wiki, is there an easy way to print the
entirety of the wiki ? A script or something ? Have multiple platforms
available to use as a platform for fetching it.

Looking through the moinmoin documentation - nothing strikes me as a way
of doing so…

-WillOn 11/7/2014 5:29 PM, unfy wrote:

'lo!

Many of the C++ tutorials and book examples do heavily use classes and
stuff. It’s not useful for my coworker who hasn’t touched C++ in 20
years. I would normally agree with your assertion, Jonny - but not
this time heh.

I might go with Alex’s wiki thing… it’s how I learned SDL a decade
ago. Will just have to print out all of the pages (coworker prefers
print media). Now - why am I the one doing the printing ? Good
question best left for another day.

-Will

Many people who don’t speak C++ find it somewhat unapproachable even though the syntax isn’t all that different from C once you get past streams, templates, namespaces, operators, and multiple inheritances. As you note, games rarely use those features. To a C developer, it isn’t that hard to adapt the differences. Unless of course you’re not very experienced with C OR C++, which describes a large user base of tutorial books on game development. :slight_smile:

If you think C++ syntax looks weird to C people, try Objective-C. :smiley:

JosephSent via mobile

On Nov 7, 2014, at 07:43, Jonathan Dearborn wrote:

Many “C++” tutorials don’t use very many C++ features (classes and… that’s probably it). SDL being a C API makes that happen. It’s possible your coworkers could still benefit from them for now.

Jonny D


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Since I just posted for help about a Windows render-to-texture bug
with an example, the cat is starting to get out of the bag, so I might
as well post :slight_smile:

So I agree, I would like to see more pure C tutorials too, so I’ve
written a couple of examples. The best one is a Flappy Bird clone. It
is not meant to be trivial though. It is intended as a thoughtful and
meticulous look at Flappy Bird and try to appreciate the author’s
design decisions and capture the spirit/feel of the game which
includes all the details and odd-ball behaviors that out-of-the
box/pre-canned game engine tutorials are normally terrible about
focusing on (often because they don’t give you that kind of fine
control over things).

It uses SDL 2.0’s 2D renderer. But it also uses SDL_ttf (the fancy
outline text is dynamically created, not pre-made pngs), SDL_image,
ALmixer for audio, OpenAL for pitch effects (press the Shift keys
while playing for slow-motion/speedup), and Chipmunk for Physics.

Anyway, I haven’t launched my new SDK yet (but soon), and I still
haven’t written the formal tutorial that goes with it, but you can
find the source code to FlappyBlurrrC here:

And prebuilt binaries here:

Mac
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrCMac.zip

Linux (64-bit, SteamOS runtime compliant)
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrC-0.1.1-Linux.tar.gz

Windows (Windows 7+ 64-bit)
zip: http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrCWindows.zip
installer: http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrC-1.0.0-win64.exe

Android (4.0+, 4.1+ for best audio performance)
http://playcontrol.net/tempdownload/BlurrrBinaries/FlappyBlurrrC-debug-unaligned.apk

Thanks,
EricOn 11/7/14, Alex wrote:

Hello, unfy!
I’m C programmer too and I learning SDL2 now. I learn it myself without any
tutorials, using just SDL-wiki (http://wiki.libsdl.org) and this forum. And
sometime looking to SDL2 source code (it’s written in C). I making simple
test programs for different aspects of SDL2 and learn how it works.
I think we need more SDL tutorials in C - it is good idea. But for now we
can learn using this resources, which we have. We can learn SDL2 + C
programming together if you interested :slight_smile:


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

Hello, unfy!
I’m C programmer too and I learning SDL2 now. I learn it myself
without any tutorials, using just SDL-wiki and this forum. And sometime
looking to SDL2 source code (it’s written in C). I making simple test
programs for different aspects of SDL2 and learn how it works.
I think we need more SDL tutorials in C - it is good idea. But for
now we can learn using this resources, which we have. We can learn SDL2

  • C programming together if you interested SmileOn 11/7/2014 8:27 AM, Alex wrote:

HI Alex!

Sorry about missing this message ._.

The purist C tutorials would be more or less for my co-worker, not me.
I’m sure they’d help for others as well - a set of pure C tutorials lets
the end user then decide how to do class structure later if they so
desire to go that route. This way, a particular style isn’t forced upon
them.

When it comes time for me to pick up SDL 2.x (soon it seems), I’d do
like I did the first time I learned SDL 10-15 years or more ago - just
use the Wiki / function documentation :slight_smile: – which sounds like how you’re
doing it. It is by far the best way to learn IMHO, but some people want
full on tutorials / books.

-unfy

Hi Eric!

I’ll give these a once over and see how they look and if they are
co-worker friendly.

Look forward to playing the game and seeing these design decisions you
talk of too heh :slight_smile:

Thanks!

-unfyOn 11/20/2014 6:50 PM, Eric Wing wrote:

On 11/7/14, Alex wrote:

Hello, unfy!
I’m C programmer too and I learning SDL2 now. I learn it myself without any
tutorials, using just SDL-wiki (http://wiki.libsdl.org) and this forum. And
sometime looking to SDL2 source code (it’s written in C). I making simple
test programs for different aspects of SDL2 and learn how it works.
I think we need more SDL tutorials in C - it is good idea. But for now we
can learn using this resources, which we have. We can learn SDL2 + C
programming together if you interested :slight_smile:
Since I just posted for help about a Windows render-to-texture bug
with an example, the cat is starting to get out of the bag, so I might
as well post :slight_smile:

The problem with the wiki documentation is that its structure is too
much a parameter reference and too little a conceptual explanation of
the best practice for doing something. SDL has a lot of parts, and a
lot of ways to use those parts, and the wiki docs will more or less
explain what they all are. Just that some of them aren’t things you
should be doing anymore and exist mostly for historical and backward
compatibility sakes.

I mentioned in another post recently the event interface, for
example. It’s totally an optional subsystem, and so most things have
alternative ways of doing them. Yet none could rationally argue that
disabling the event system and working around it is EVER a good idea
anymore. Most of SDL’s targets (ALL of the main-line ones) send
events whose proper handling is mandatory.

Consequently some subsystems have multiple ways of using them, with
one being the clear preference for new development. I must have
written explanations and sample code for the joystick and game
controller event models half a dozen times a year ago. If there was
a convenient conceptual model page on the website, I might not have
needed to do it more than once?on the wiki. :smiley: But as it stands
there isn’t even a functional place to put that kind of thing just
now.

A when to use the renderer might be appropriate documentation, and
I have no idea where you’d put a tutorial for those whose games are
outgrowing the SDL renderer and need to move to OpenGL/Direct3D. Of
course if I had my way for 2.1, the renderer would grow to the point
that you don’t NEED to “outgrow” it, but it’s impossible to guarantee
that a user couldn’t screw that up for fixed pipeline OpenGL. I’d
still like to do it anyway and just stick the warning label on it for
anyone using that kind of legacy stuff. :slight_smile: Anyway, that’d still be
something that doesn’t fit anywhere into the wiki structure even if
it’s the kind of thing that really should be immediately available to
SDL developers.

For sound, I could see something on basic channel mixing and audio
painting being written for SDL. It’d have to link elsewhere for a
full tutorial on these things, and to wiki pages for extension
libraries, OpenAL, whatever? But fully documenting SDL’s sound
subsystem does require some small element of a tutorial because
people honestly might not really even know what they’re looking at.
Kind of why you see SDL_mixer being dragged in for what should be
trivial audio tasks.

I’ve yet to see a comprehensive explanation I fully understood about
handling full unicode text input and display. Font substitution,
input methods, etc? I tend not to even bother partly because my uses
of SDL never really involve significant text for the end-user, and
because aside from maybe iOS, I just haven’t got a clue where to
start on figuring it out. That’d make a good conceptual page. :slight_smile:

As you can see from these examples, there’s a lot of documentation
that could/should be in the wiki, but with the current structure
isn’t really. And there’s a fair bit that probably should be there
as well that I’ve got no good suggestion how to even implement. And
that’s still the documentation just for people who kind of know
something about what they’re doing but just don’t understand the kind
of stuff SDL gets used for. You still need more hands on, step by
step sorts of guides for those who need more hand-holding than would
be appropriate for conceptual and basic overviews and best practices
docs. That’d be a good job for additional tutorials and books.

JosephOn Sat, Nov 22, 2014 at 01:09:09AM -0600, unfy wrote:

On 11/7/2014 8:27 AM, Alex wrote:

Hello, unfy!
I’m C programmer too and I learning SDL2 now. I learn it myself
without any tutorials, using just SDL-wiki and this forum. And
sometime looking to SDL2 source code (it’s written in C). I making
simple test programs for different aspects of SDL2 and learn how it
works.
I think we need more SDL tutorials in C - it is good idea. But for
now we can learn using this resources, which we have. We can learn
SDL2 + C programming together if you interested Smile


HI Alex!

Sorry about missing this message ._.

The purist C tutorials would be more or less for my co-worker, not me.
I’m sure they’d help for others as well - a set of pure C tutorials
lets the end user then decide how to do class structure later if they
so desire to go that route. This way, a particular style isn’t forced
upon them.

When it comes time for me to pick up SDL 2.x (soon it seems), I’d do
like I did the first time I learned SDL 10-15 years or more ago - just
use the Wiki / function documentation :slight_smile: – which sounds like how
you’re doing it. It is by far the best way to learn IMHO, but some
people want full on tutorials / books.

-unfy


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

IMHO the ideal setup would be to have a three level wiki:

  1. wiki docs: A technical reference for those who are already familiar with
    SDL, and have experience using SDL, but occasionally need to look up details
    of API functions (a parameter reference).

  2. wiki users guide: A reference for those familiar with C and/or C++ that
    gives simple examples of how to use the features of SDL (for experienced
    programmers new to SDL).

  3. wiki tutorial: A beginners guide with extensive examples, including, when
    appropriate, complete code for simple programs (Yikes, an entire book!).

Disclaimer: My experience with wiki is pretty much limited to being a more or
less regular user of wikipedia. I have not yet contributed anything to any
wiki, and don’t know if the above is even feasible. It does seem to me that
creating such a three-part wiki would be a massive effort (but probably worth
it).

JeffOn Saturday 22 November 2014 07:33:29 T. Joseph Carter wrote:

The problem with the wiki documentation is that its structure is too
much a parameter reference and too little a conceptual explanation of
the best practice for doing something. SDL has a lot of parts, and a
lot of ways to use those parts, and the wiki docs will more or less
explain what they all are.

Message-ID: <20141122153329.GB16371 at amaya.spiritsubstance.com>
Content-Type: text/plain; charset=utf-8; format=flowed

Anyway, that’d still be
something that doesn’t fit anywhere into the wiki structure even if
it’s the kind of thing that really should be immediately available to
SDL developers.

Maybe the wiki needs a “by Usage” page to go along with the "by Name"
and “by Category” pages, where “usage” refers to subsystems
specifically?> Date: Sat, 22 Nov 2014 07:33:29 -0800

From: “T. Joseph Carter”
To: SDL Development List
Subject: Re: [SDL] SDL 2.0 book or tutorial list in just C ?

If you’re writing #3? :smiley: That’s always the problem with that kind
of thing. Those who can basically write a book usually tend to,
well, write a book. Personally, I don’t think it’s the SDL wiki’s
job to teach someone how to use an IDE or write basic C. And I’ve
never thought SDL should be mixed with a language primer.

I could see a very high-level thing written using maybe PySDL to
teach concepts of programming using game development?great for the
kids, and indeed one of my currently back of the back burner hobby
interests. But it’s easier to understand and correct conceptual
errors in a language like Python where the syntax doesn’t get in the
way.

JosephOn Sat, Nov 22, 2014 at 09:59:42AM -0800, j_post wrote:

On Saturday 22 November 2014 07:33:29 T. Joseph Carter wrote:

The problem with the wiki documentation is that its structure is too
much a parameter reference and too little a conceptual explanation of
the best practice for doing something. SDL has a lot of parts, and a
lot of ways to use those parts, and the wiki docs will more or less
explain what they all are.

IMHO the ideal setup would be to have a three level wiki:

  1. wiki docs: A technical reference for those who are already familiar with
    SDL, and have experience using SDL, but occasionally need to look up details
    of API functions (a parameter reference).

  2. wiki users guide: A reference for those familiar with C and/or C++ that
    gives simple examples of how to use the features of SDL (for experienced
    programmers new to SDL).

  3. wiki tutorial: A beginners guide with extensive examples, including, when
    appropriate, complete code for simple programs (Yikes, an entire book!).

Disclaimer: My experience with wiki is pretty much limited to being a more or
less regular user of wikipedia. I have not yet contributed anything to any
wiki, and don’t know if the above is even feasible. It does seem to me that
creating such a three-part wiki would be a massive effort (but probably worth
it).

Jeff


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org