-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
48 lines (41 loc) · 1.29 KB
/
Main.cpp
File metadata and controls
48 lines (41 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <JuceHeader.h>
#include "MainComponent.h"
// Our application class
class SimpleAudioPlayer : public juce::JUCEApplication
{
public:
const juce::String getApplicationName() override { return "Simple Audio Player"; }
const juce::String getApplicationVersion() override { return "1.0"; }
void initialise(const juce::String&) override
{
// Create and show the main window
mainWindow = std::make_unique<MainWindow>(getApplicationName());
}
void shutdown() override
{
mainWindow = nullptr; // Clean up
}
private:
// The main window of the app
class MainWindow : public juce::DocumentWindow
{
public:
MainWindow(juce::String name)
: DocumentWindow(name,
juce::Colours::lightgrey,
DocumentWindow::allButtons)
{
setUsingNativeTitleBar(true);
setContentOwned(new MainComponent(), true); // MainComponent = our UI + logic
centreWithSize(600, 200);
setVisible(true);
}
void closeButtonPressed() override
{
juce::JUCEApplication::getInstance()->systemRequestedQuit();
}
};
std::unique_ptr<MainWindow> mainWindow;
};
// This macro starts the app
START_JUCE_APPLICATION(SimpleAudioPlayer)