Skip to content
Snippets Groups Projects
Commit 106333df authored by jsiegle's avatar jsiegle
Browse files

ControlPanel is now free of OpenGL

parent 0eec8696
Branches
Tags
No related merge requests found
......@@ -217,10 +217,6 @@ void Clock::drawTime(Graphics& g)
}
String timeString = "";
// if (m < 10)
// String timeString = " ";
// else if (m < 100)
timeString += m;
timeString += " min ";
......@@ -231,12 +227,6 @@ void Clock::drawTime(Graphics& g)
g.setFont(30);
g.drawText(timeString, 0, 0, getWidth(), getHeight(), Justification::left, false);
// glRasterPos2f(8.0/getWidth(),0.75f);
// getFont(cpmono_light)->FaceSize(23);
// getFont(cpmono_light)->Render(timeString);
}
void Clock::start()
......@@ -292,41 +282,35 @@ ControlPanelButton::~ControlPanelButton()
}
void ControlPanelButton::newOpenGLContextCreated()
void ControlPanelButton::paint(Graphics& g)
{
g.fillAll(Colour(58,58,58));
setUp2DCanvas();
activateAntiAliasing();
setClearColor(darkgrey);
}
void ControlPanelButton::renderOpenGL()
{
glClear(GL_COLOR_BUFFER_BIT);
drawButton();
}
g.setColour(Colours::white);
void ControlPanelButton::drawButton()
{
glColor4f(1.0f,1.0f,1.0f,1.0f);
glLineWidth(1.0f);
Path p;
glBegin(GL_LINE_LOOP);
float h = getHeight();
float w = getWidth();
if (open)
{
glVertex2f(0.5, 0.8);
glVertex2f(0.2, 0.2);
p.addTriangle(0.5f*w, 0.8f*h,
0.2f*w, 0.2f*h,
0.8f*w, 0.2f*h);
} else {
glVertex2f(0.8, 0.8);
glVertex2f(0.2, 0.5);
p.addTriangle(0.8f*w, 0.8f*h,
0.2f*w, 0.5f*h,
0.8f*w, 0.2f*h);
}
glVertex2f(0.8, 0.2);
glEnd();
PathStrokeType pst = PathStrokeType(1.0f, PathStrokeType::curved, PathStrokeType::rounded);
g.strokePath(p, pst);
}
void ControlPanelButton::mouseDown(const MouseEvent& e)
{
open = !open;
......
......@@ -196,7 +196,7 @@ class Clock : public Component
/** Sets the cumulative recording time to zero.*/
void resetRecordTime();
/** Draws the current time.*/
/** Renders the clock.*/
void paint(Graphics& g);
private:
......@@ -214,7 +214,6 @@ class Clock : public Component
Font clockFont;
//FTPixmapFont* font;
};
/**
......@@ -229,7 +228,7 @@ class Clock : public Component
*/
class ControlPanelButton : public OpenGLCanvas
class ControlPanelButton : public Component
{
public:
ControlPanelButton(ControlPanel* cp_);
......@@ -241,14 +240,8 @@ public:
/** Toggles the open/closed state of the ControlPanelButton.*/
void toggleState();
/** Initializes an OpenGL context in which drawing occurs.*/
void newOpenGLContextCreated();
/** Draws the button. */
void renderOpenGL();
/** Draws the button. */
void drawButton();
void paint(Graphics& g);
/** Responds to mouse clicks within the button. */
void mouseDown(const MouseEvent& e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment