Created
June 29, 2016 09:37
-
-
Save anonymous/122d8bcc4cb1e54d5514d67c8df1827f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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