-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBall.cpp
More file actions
51 lines (38 loc) · 1.14 KB
/
Ball.cpp
File metadata and controls
51 lines (38 loc) · 1.14 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
49
50
51
/*
==============================================================================
Ball.cpp
Created: 29 Jul 2019 10:04:53pm
Author: Joshua Hodge
==============================================================================
*/
#include "../JuceLibraryCode/JuceHeader.h"
#include "Ball.h"
//==============================================================================
Ball::Ball()
{
// In your constructor, you should add any child components, and
// initialise any special settings that your component needs.
}
Ball::~Ball()
{
}
void Ball::paint (Graphics& g)
{
Rectangle<float> area { posX, posY, size, size };
g.fillAll (isEntered ? Colours::red : Colours::black);
g.setColour (isEntered ? Colours::grey : Colours::lightgoldenrodyellow);
g.drawEllipse (area, 2.0);
}
void Ball::mouseEnter (const MouseEvent& event)
{
isEntered = true;
}
void Ball::mouseExit (const MouseEvent& event)
{
isEntered = false;
}
void Ball::resized()
{
// This method is where you should set the bounds of any child
// components that your component contains..
}