We’ve just released JUCE 5.3.0, where the main focus is improving the documentation, code examples and tutorials to make it easier for people to get started and learn how to use JUCE. Around 30 new tutorials can be found on the JUCE website here, covering a wide range of topics from DSP to in-app purchases and over 70 updated, JUCE team code-reviewed code examples have been added to the examples directory.
In order to keep the JUCE repository and download size reasonable, we came up with a way of generating a full JUCE project from a single header file containing some JUCE code and a chunk of metadata that is read by the Projucer - called a Projucer Instant Project, or PIP. The JUCE code examples have been categorised and converted to this format and can be opened simply by dragging and dropping the file into the Projucer, or can be opened directly via the Projucer’s File->Open Example menu item. Additionally a new “DemoRunner” application has been added to JUCE that allows you to preview all of the JUCE code examples in one place, and see the code side-by-side. This can be run via the Projucer’s File->Open Example->Launch Demo Runner menu item.
As well as being useful for keeping the JUCE download size down we hope that PIPs can also be utilised for sharing code and ideas between developers. For example, try copying this code to your clipboard and then opening it in the Projucer using the File->New Project From Clipboard... option:
/*******************************************************************************
The block below describes the properties of this PIP. A PIP is a short snippet
of code that can be read by the Projucer and used to generate a JUCE project.
BEGIN_JUCE_PIP_METADATA
name: HelloWorldDemo
version: 1.0.0
vendor: juce
website: http://juce.com
description: Simple HelloWorld application.
dependencies: juce_core, juce_data_structures, juce_events, juce_graphics,
juce_gui_basics
exporters: xcode_mac, vs2017, linux_make, xcode_iphone
type: Component
mainClass: HelloWorldDemo
useLocalCopy: 1
END_JUCE_PIP_METADATA
*******************************************************************************/
#pragma once
//==============================================================================
class HelloWorldDemo : public Component
{
public:
//==============================================================================
HelloWorldDemo()
{
addAndMakeVisible (helloWorldLabel);
helloWorldLabel.setFont (Font (40.00f, Font::bold));
helloWorldLabel.setJustificationType (Justification::centred);
helloWorldLabel.setEditable (false, false, false);
helloWorldLabel.setColour (Label::textColourId, Colours::black);
helloWorldLabel.setColour (TextEditor::textColourId, Colours::black);
helloWorldLabel.setColour (TextEditor::backgroundColourId, Colour (0x00000000));
addAndMakeVisible (quitButton);
quitButton.onClick = [this] { JUCEApplication::quit(); };
setSize (600, 300);
}
//==============================================================================
void paint (Graphics& g) override
{
g.fillAll (Colour (0xffc1d0ff));
g.setColour (Colours::white);
g.fillPath (internalPath);
g.setColour (Colour (0xff6f6f6f));
g.strokePath (internalPath, PathStrokeType (5.200f));
}
void resized() override
{
helloWorldLabel.setBounds (152, 80, 296, 48);
quitButton.setBounds (getWidth() - 176, getHeight() - 60, 120, 32);
internalPath.clear();
internalPath.startNewSubPath (136.0f, 80.0f);
internalPath.quadraticTo (176.0f, 24.0f, 328.0f, 32.0f);
internalPath.quadraticTo (472.0f, 40.0f, 472.0f, 104.0f);
internalPath.quadraticTo (472.0f, 192.0f, 232.0f, 176.0f);
internalPath.lineTo (184.0f, 216.0f);
internalPath.lineTo (200.0f, 168.0f);
internalPath.quadraticTo (96.0f, 136.0f, 136.0f, 80.0f);
internalPath.closeSubPath();
}
private:
//==============================================================================
Label helloWorldLabel { {}, TRANS("Hello World!") };
TextButton quitButton { TRANS("Quit") };
Path internalPath;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HelloWorldDemo)
};
As you can see it contains a simple class deriving from Component, and the metadata at the top is read by the Projucer to generate all the boilerplate startup/shutdown code for you - you simply need to fill out a few fields and tell it the type of application it is (a Component, AudioProcessor, or Console).
Check out the JUCE examples for some more examples and please post any questions about PIPs here!



