Skip to content

Instantly share code, notes, and snippets.

/app_controller.cpp
Created Jun 29, 2016

Embed
What would you like to do?
// 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
You can’t perform that action at this time.