Skip to content

Commit 6fdde7a

Browse files
committed
Demo: rejigging a bunch of stuff to sandbox new ideas and structures.
1 parent bd51503 commit 6fdde7a

27 files changed

+602
-207
lines changed

demo/JuceLibraryCode/AppConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
//==============================================================================
2626
#define JUCE_MODULE_AVAILABLE_juce_analytics 1
27+
#define JUCE_MODULE_AVAILABLE_juce_animation 1
2728
#define JUCE_MODULE_AVAILABLE_juce_audio_basics 1
2829
#define JUCE_MODULE_AVAILABLE_juce_audio_devices 1
2930
#define JUCE_MODULE_AVAILABLE_juce_audio_formats 1
@@ -42,6 +43,7 @@
4243
#define JUCE_MODULE_AVAILABLE_juce_osc 1
4344
#define JUCE_MODULE_AVAILABLE_juce_product_unlocking 1
4445
#define JUCE_MODULE_AVAILABLE_juce_video 1
46+
#define JUCE_MODULE_AVAILABLE_squarepine_animation 1
4547
#define JUCE_MODULE_AVAILABLE_squarepine_audio 1
4648
#define JUCE_MODULE_AVAILABLE_squarepine_core 1
4749
#define JUCE_MODULE_AVAILABLE_squarepine_graphics 1

demo/SquarePineDemo.jucer

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<FILE id="L8YGDM" name="SharedObjects.h" compile="0" resource="0" file="source/core/SharedObjects.h"/>
4949
</GROUP>
5050
<GROUP id="{775B98BE-1BF2-5AF2-2E31-B17D3A9219DD}" name="demos">
51+
<FILE id="R6fnWY" name="AnimationDemo.cpp" compile="0" resource="0"
52+
file="source/demos/AnimationDemo.cpp"/>
53+
<FILE id="CfsYbc" name="AnimationDemo.h" compile="0" resource="0" file="source/demos/AnimationDemo.h"/>
5154
<FILE id="o8ngkO" name="CodeEditorDemo.h" compile="0" resource="0"
5255
file="source/demos/CodeEditorDemo.h"/>
5356
<FILE id="mUqbF6" name="DemoBase.h" compile="0" resource="0" file="source/demos/DemoBase.h"/>
@@ -62,6 +65,10 @@
6265
file="source/demos/MediaDeviceListerDemo.h"/>
6366
<FILE id="hoUe5P" name="OpenGLDetailsDemo.h" compile="0" resource="0"
6467
file="source/demos/OpenGLDetailsDemo.h"/>
68+
<FILE id="mInTnJ" name="ParticleSystemDemo.cpp" compile="0" resource="0"
69+
file="source/demos/ParticleSystemDemo.cpp"/>
70+
<FILE id="kOAePN" name="ParticleSystemDemo.h" compile="0" resource="0"
71+
file="source/demos/ParticleSystemDemo.h"/>
6572
<FILE id="SVoVfA" name="WinRTRGBDemo.h" compile="0" resource="0" file="source/demos/WinRTRGBDemo.h"/>
6673
</GROUP>
6774
<GROUP id="{B136827C-443D-9F46-D62C-F9F22179369A}" name="main">
@@ -118,6 +125,8 @@
118125
<MODULEPATH id="squarepine_graphics" path="../modules/"/>
119126
<MODULEPATH id="squarepine_core" path="../modules/"/>
120127
<MODULEPATH id="squarepine_audio" path="../modules/"/>
128+
<MODULEPATH id="juce_animation" path="../../JUCE/modules"/>
129+
<MODULEPATH id="squarepine_animation" path="../modules"/>
121130
</MODULEPATHS>
122131
</ANDROIDSTUDIO>
123132
<LINUX_MAKE targetFolder="builds/linux" smallIcon="jqPxuh" bigIcon="jqPxuh">
@@ -158,6 +167,8 @@
158167
<MODULEPATH id="squarepine_graphics" path="../modules/"/>
159168
<MODULEPATH id="squarepine_core" path="../modules/"/>
160169
<MODULEPATH id="squarepine_audio" path="../modules/"/>
170+
<MODULEPATH id="juce_animation" path="../../JUCE/modules"/>
171+
<MODULEPATH id="squarepine_animation" path="../modules"/>
161172
</MODULEPATHS>
162173
</LINUX_MAKE>
163174
<VS2022 targetFolder="builds/vs2022" smallIcon="jqPxuh" bigIcon="jqPxuh">
@@ -200,6 +211,8 @@
200211
<MODULEPATH id="squarepine_graphics" path="../modules/"/>
201212
<MODULEPATH id="squarepine_core" path="../modules/"/>
202213
<MODULEPATH id="squarepine_audio" path="../modules/"/>
214+
<MODULEPATH id="juce_animation" path="../../JUCE/modules"/>
215+
<MODULEPATH id="squarepine_animation" path="../modules"/>
203216
</MODULEPATHS>
204217
</VS2022>
205218
<VS2022 targetFolder="builds/vs2022_clangcl" toolset="ClangCL">
@@ -236,6 +249,8 @@
236249
<MODULEPATH id="squarepine_audio" path="../modules/"/>
237250
<MODULEPATH id="squarepine_core" path="../modules/"/>
238251
<MODULEPATH id="squarepine_graphics" path="../modules/"/>
252+
<MODULEPATH id="juce_animation" path="../../JUCE/modules"/>
253+
<MODULEPATH id="squarepine_animation" path="../modules"/>
239254
</MODULEPATHS>
240255
</VS2022>
241256
<XCODE_IPHONE targetFolder="builds/ios" iosScreenOrientation="UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight,UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown"
@@ -272,6 +287,8 @@
272287
<MODULEPATH id="squarepine_graphics" path="../modules/"/>
273288
<MODULEPATH id="squarepine_core" path="../modules/"/>
274289
<MODULEPATH id="squarepine_audio" path="../modules/"/>
290+
<MODULEPATH id="juce_animation" path="../../JUCE/modules"/>
291+
<MODULEPATH id="squarepine_animation" path="../modules"/>
275292
</MODULEPATHS>
276293
</XCODE_IPHONE>
277294
<XCODE_MAC targetFolder="builds/macos" xcodeValidArchs="arm64,x86_64" applicationCategory="public.app-category.utilities"
@@ -306,11 +323,14 @@
306323
<MODULEPATH id="squarepine_graphics" path="../modules/"/>
307324
<MODULEPATH id="squarepine_core" path="../modules/"/>
308325
<MODULEPATH id="squarepine_audio" path="../modules/"/>
326+
<MODULEPATH id="juce_animation" path="../../JUCE/modules"/>
327+
<MODULEPATH id="squarepine_animation" path="../modules"/>
309328
</MODULEPATHS>
310329
</XCODE_MAC>
311330
</EXPORTFORMATS>
312331
<MODULES>
313332
<MODULE id="juce_analytics" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
333+
<MODULE id="juce_animation" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
314334
<MODULE id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
315335
<MODULE id="juce_audio_devices" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
316336
<MODULE id="juce_audio_formats" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
@@ -330,6 +350,7 @@
330350
<MODULE id="juce_product_unlocking" showAllCode="1" useLocalCopy="0"
331351
useGlobalPath="0"/>
332352
<MODULE id="juce_video" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
353+
<MODULE id="squarepine_animation" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
333354
<MODULE id="squarepine_audio" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
334355
<MODULE id="squarepine_core" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>
335356
<MODULE id="squarepine_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="0"/>

demo/source/MainModule.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "MainModule.h"
22

33
#include "core/SharedObjects.cpp"
4+
#include "demos/AnimationDemo.cpp"
45
#include "demos/EffectChainDemo.cpp"
6+
#include "demos/ParticleSystemDemo.cpp"
57
#include "main/DemoLookAndFeel.cpp"
68
#include "main/MainComponent.cpp"
79
#include "main/Main.cpp"

demo/source/MainModule.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,22 @@
1515
#define SP_DEMO_USE_OPENGL JUCE_MODULE_AVAILABLE_juce_opengl
1616
#endif // SP_DEMO_USE_OPENGL
1717

18-
namespace
19-
{
20-
static const char* const trackingId = "UA-000000-0";
21-
}
22-
18+
//==============================================================================
2319
#include "core/GlobalIDs.h"
2420
#include "core/GlobalPathSettings.h"
2521
#include "core/SharedObjects.h"
2622

2723
#include "demos/DemoBase.h"
24+
#include "demos/AnimationDemo.h"
2825
#include "demos/CodeEditorDemo.h"
2926
#include "demos/iCUESDKDemo.h"
3027
#include "demos/EasingsDemo.h"
3128
#include "demos/EffectChainDemo.h"
3229
#include "demos/ImageDemo.h"
3330
#include "demos/MediaDeviceListerDemo.h"
3431
#include "demos/OpenGLDetailsDemo.h"
32+
#include "demos/ParticleSystemDemo.h"
3533
#include "demos/WinRTRGBDemo.h"
36-
// #include "demos/SystemClipboardDemo.h"
3734

3835
#include "components/SettingsComponent.h"
3936
#include "main/DemoLookAndFeel.h"

demo/source/components/SettingsComponent.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/** */
2-
class SettingsComponent final : public Component
2+
class SettingsComponent final : public DemoBase
33
{
44
public:
55
/** */
66
SettingsComponent (SharedObjects& sharedObjs) :
7-
sharedObjects (sharedObjs)
7+
DemoBase (sharedObjs, NEEDS_TRANS ("Settings"))
88
{
99
auto* audioDevSel = new AudioDeviceSelectorComponent (sharedObjects.audioDeviceManager,
1010
0, 2, 0, 2,
@@ -39,8 +39,6 @@ class SettingsComponent final : public Component
3939
//==============================================================================
4040
enum { margin = 4 };
4141

42-
SharedObjects& sharedObjects;
43-
4442
OwnedArray<Component> comps;
4543
Component contents;
4644
Viewport viewport;

demo/source/core/GlobalIDs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,9 @@ namespace CommandCategories
7373
static const char* const windows = NEEDS_TRANS ("Windows");
7474
}
7575

76+
//============================================================================
77+
namespace
78+
{
79+
/** For Google Analytics purposes (demo purposes only: nothing is being recorded). */
80+
static const char* const trackingId = "UA-000000-0";
81+
}

demo/source/demos/AnimationDemo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

demo/source/demos/AnimationDemo.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/** */
2+
class AnimationDemo final : public DemoBase
3+
{
4+
public:
5+
/** */
6+
AnimationDemo (SharedObjects& sharedObjs) :
7+
DemoBase (sharedObjs, NEEDS_TRANS ("Animations"))
8+
{
9+
}
10+
11+
//==============================================================================
12+
void resized() override
13+
{
14+
auto b = getLocalBounds().reduced (marginPx);
15+
16+
ignoreUnused (b);
17+
}
18+
19+
private:
20+
//==============================================================================
21+
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AnimationDemo)
22+
};

demo/source/demos/CodeEditorDemo.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ class CodeEditorDemo final : public DemoBase
44
public:
55
/** */
66
CodeEditorDemo (SharedObjects& sharedObjs) :
7-
DemoBase (sharedObjs, NEEDS_TRANS ("Code Editor Demo"))
7+
DemoBase (sharedObjs, NEEDS_TRANS ("Code Editor"))
88
{
99
}
1010

11+
//==============================================================================
12+
1113
private:
14+
//==============================================================================
1215
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CodeEditorDemo)
1316
};

demo/source/demos/DemoBase.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ class DemoBase : public Component,
1212
SQUAREPINE_CRASH_TRACER
1313

1414
sharedObjects.languageHandler->addListener (this);
15+
16+
SafePointer ptr (this);
17+
MessageManager::callAsync ([ptr]()
18+
{
19+
if (ptr != nullptr)
20+
ptr->updateWithNewTranslations();
21+
});
1522
}
1623

1724
/** */
@@ -27,23 +34,28 @@ class DemoBase : public Component,
2734
const String& getUntranslatedName() const noexcept { return untranslatedName; }
2835

2936
/** */
30-
virtual void updateWithNewTranslations()
31-
{
32-
setName (TRANS (untranslatedName));
33-
}
37+
virtual void updateWithNewTranslations() {}
3438

3539
//==============================================================================
3640
/** */
3741
void languageChanged (const IETFLanguageFile&) override
3842
{
3943
SQUAREPINE_CRASH_TRACER
44+
setName (TRANS (untranslatedName));
4045
updateWithNewTranslations();
4146
}
4247

4348
protected:
4449
//==============================================================================
4550
SharedObjects& sharedObjects;
4651

52+
//==============================================================================
53+
enum
54+
{
55+
marginPx = 4,
56+
barSizePx = marginPx * 12
57+
};
58+
4759
private:
4860
//==============================================================================
4961
const String untranslatedName;

0 commit comments

Comments
 (0)