Skip to content

Instantly share code, notes, and snippets.

Created June 29, 2016 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/122d8bcc4cb1e54d5514d67c8df1827f to your computer and use it in GitHub Desktop.
Save anonymous/122d8bcc4cb1e54d5514d67c8df1827f to your computer and use it in GitHub Desktop.
// This software is part of OpenMono, see http://developer.openmono.com
// Released under the MIT license, see LICENSE.txt
#include "app_controller.h"
using mono::display::IDisplayController;
using mono::geo::Point;
using mono::geo::Rect;
using mono::IApplicationContext;
using mono::String;
using mono::Timer;
using mono::TouchEvent;
using mono::ui::TextLabelView;
using mono::ui::View;
void TouchField::repaint ()
{
// Clear background.
painter.drawFillRect(viewRect,true);
// Show box around touch area.
painter.drawRect(viewRect);
}
void TouchField::TouchBegin (TouchEvent & event)
{
uint16_t radius = viewRect.Size().Width() / 2;
painter.drawCircle(viewRect.X()+radius,viewRect.Y()+radius,radius);
}
AppController::AppController ()
:
topLabel(Rect(0,15,176,20),"Button v0.2")
{
topLabel.setAlignment(TextLabelView::ALIGN_CENTER);
}
void AppController::monoWakeFromReset ()
{
topLabel.show();
field.setRect(Rect((View::DisplayWidth())/2,(View::DisplayHeight())/2,50,50));
}
void AppController::monoWakeFromSleep ()
{
IApplicationContext::SoftwareReset();
topLabel.scheduleRepaint();
}
void AppController::monoWillGotoSleep ()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment