Examples in help pages might be nice


#1

Here is an example: I would like to repaint() at 30Hz.

First I search the forum -- lots of questions that fail to provide code examples, but I learn the way is to use a timer.

I google JUCE timer, get to http://www.juce.com/doc/classTimer -- wall of text.

So looking through I pick startTimerHz and Google that: only five hits -- two are Japanese, one is the above doclink.

One is https://github.com/julianstorer/JUCE/blob/master/examples/SimpleFFTExample/Source/SpectrogramComponent.h

And I can extract the information I need in about 10 seconds.

Because on that page it is presented in context.  If I see something in action I can assimilate it instantly. But if I have to read a description of it, it just doesn't go in. However, once I have the example, I can then read the blurb and everything makes sense.

So it might be nice to start the documentation page for this Timer class with a basic example.

Or maybe a link to that code file. That would save duplicating anything.

Example driven/centred documentation is very powerful.

π

PS I like the dark background for the help pages mmm

PPS Just noticed http://www.juce.com/doc/classPath does exactly what I'm suggesting. So maybe this is a redundant post...


#2

Have you tried searching the repository for a particular function? Even GitHub lets you do that: https://github.com/julianstorer/JUCE/search?utf8=%E2%9C%93&q=starttimerhz

And what do you know, an example on repainting something at 30 fps comes up in the results: https://github.com/julianstorer/JUCE/blob/26ff85ae9409db0eda434bdf34000ff23c485528/examples/Demo/Source/IntroScreen.cpp#L74

The whole purpose of the repository's examples speak for themselves, afterall. And you didn't even have to learn Japanese! Amazing!


#3

Just thought I'd add that for examples,  the JUCE Demo is a goldmine. Almost every feature is on display there, and it's very easy to look through the code and see how it was all done in an idomatic way. Often I have the Demo project open in a side-by-side Xcode window for easy reference when questions like this come up.