From 4cee8b461b7c5c826e2d008cebdcc9cb85235e45 Mon Sep 17 00:00:00 2001 From: Sukwon Suh Date: Mon, 25 Mar 2013 17:19:12 +0900 Subject: [PATCH] add action OnTouchPressed Change-Id: I5c1cb72f71eeddb69e48d765c4dcb3db3295961b Signed-off-by: Sukwon Suh --- project/src/GlesCanvasTexture.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/project/src/GlesCanvasTexture.cpp b/project/src/GlesCanvasTexture.cpp index aa81403..b39ee2b 100644 --- a/project/src/GlesCanvasTexture.cpp +++ b/project/src/GlesCanvasTexture.cpp @@ -84,6 +84,10 @@ void GlesForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo) { __color.SetColorComponents(Math::Rand() % 256, Math::Rand() % 256, Math::Rand() % 256, 128 + Math::Rand() % 128); + if (__pApp != null) + { + __pApp->DrawEllipse(currentPosition, __color); + } } void @@ -94,13 +98,9 @@ GlesForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphic void GlesForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo) { - if (__pApp != null && __pApp->__pCanvas != null) + if (__pApp != null) { - int size = 10 + Math::Rand() % 40; - Rectangle rect(touchInfo.GetCurrentPosition().x - size, touchInfo.GetCurrentPosition().y -size, size * 2, size * 2); - __pApp->__pCanvas->FillEllipse(__color, rect); - __pApp->DrawText(L"Touch the screen"); - __pApp->__needUpdateTexture = true; + __pApp->DrawEllipse(currentPosition, __color); } } @@ -777,3 +777,16 @@ GlesCanvasTexture::DrawText(Tizen::Base::String string) __pCanvas->SetForegroundColor(Color::GetColor(COLOR_ID_WHITE)); __pCanvas->DrawText(Point((rect.width - dimension.width) / 2 , rect.height / 2), string, Color::GetColor(COLOR_ID_BLACK)); } + +void +GlesCanvasTexture::DrawEllipse(Point position, Color color) +{ + if (__pCanvas != null) + { + int size = 10 + Math::Rand() % 40; + Rectangle rect(position.x - size, position.y -size, size * 2, size * 2); + __pCanvas->FillEllipse(color, rect); + DrawText(L"Touch the screen"); + __needUpdateTexture = true; + } +} -- 2.7.4