From 6392e4d4b66c6bb97c7c2b4b09bb51e8e52e7819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=C2=ADn=20Lucas=20Golini?= Date: Fri, 14 Apr 2017 13:12:08 -0300 Subject: [PATCH] Minor changes. --HG-- branch : dev --- include/eepp/ui/uicontrolanim.hpp | 4 ++-- include/eepp/ui/uitable.hpp | 2 +- projects/android-project/jni/Android.mk | 5 +++-- src/eepp/ui/uicontrolanim.cpp | 4 ++-- src/eepp/ui/uilistbox.cpp | 15 ++++++++------- src/eepp/ui/uitable.cpp | 19 +++++++++++-------- src/test/eetest.cpp | 5 +++-- 7 files changed, 30 insertions(+), 24 deletions(-) diff --git a/include/eepp/ui/uicontrolanim.hpp b/include/eepp/ui/uicontrolanim.hpp index 7e8374b1e..8695b3649 100644 --- a/include/eepp/ui/uicontrolanim.hpp +++ b/include/eepp/ui/uicontrolanim.hpp @@ -61,7 +61,7 @@ class EE_API UIControlAnim : public UIDragableControl { Interpolation2d * startScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& getType = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() ); - Interpolation2d * startMovement( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& getType = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() ); + Interpolation2d * startTranslation( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& getType = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() ); Interpolation1d * startRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& getType = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() ); @@ -79,7 +79,7 @@ class EE_API UIControlAnim : public UIDragableControl { Interpolation1d * getAlphaInterpolation(); - Interpolation2d * getMovementInterpolation(); + Interpolation2d * getTranslationInterpolation(); virtual void draw(); diff --git a/include/eepp/ui/uitable.hpp b/include/eepp/ui/uitable.hpp index 0ce7862a6..308671ce0 100644 --- a/include/eepp/ui/uitable.hpp +++ b/include/eepp/ui/uitable.hpp @@ -82,7 +82,7 @@ class EE_API UITable : public UIWidget { bool getSmoothScroll() const; - void setSmoothScroll(bool smoothScroll); + UITable * setSmoothScroll(bool smoothScroll); Float getTouchDragDeceleration() const; diff --git a/projects/android-project/jni/Android.mk b/projects/android-project/jni/Android.mk index 70f6c7b70..cd4b2fc97 100644 --- a/projects/android-project/jni/Android.mk +++ b/projects/android-project/jni/Android.mk @@ -50,6 +50,7 @@ CODE_SRCS := \ helper/jpeg-compressor/*.cpp \ helper/imageresampler/*.cpp \ helper/haikuttf/*.cpp \ + helper/pugixml/*.cpp \ system/*.cpp \ system/platform/posix/*.cpp \ network/*.cpp \ @@ -68,8 +69,8 @@ CODE_SRCS := \ physics/constraints/*.cpp \ ui/*.cpp \ ui/tools/*.cpp \ - gaming/*.cpp \ - gaming/mapeditor/*.cpp + maps/*.cpp \ + maps/mapeditor/*.cpp LOCAL_C_INCLUDES := $(MY_C_INCLUDES) diff --git a/src/eepp/ui/uicontrolanim.cpp b/src/eepp/ui/uicontrolanim.cpp index cafade834..596e22249 100644 --- a/src/eepp/ui/uicontrolanim.cpp +++ b/src/eepp/ui/uicontrolanim.cpp @@ -311,7 +311,7 @@ Interpolation2d * UIControlAnim::startScaleAnim( const Float& From, const Float& return startScaleAnim( Vector2f( From, From ), Vector2f( To, To ), TotalTime, Type, PathEndCallback ); } -Interpolation2d * UIControlAnim::startMovement( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) { +Interpolation2d * UIControlAnim::startTranslation( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) { if ( NULL == mMoveAnim ) mMoveAnim = eeNew( Interpolation2d, () ); @@ -491,7 +491,7 @@ Interpolation1d * UIControlAnim::getAlphaInterpolation() { return mAlphaAnim; } -Interpolation2d * UIControlAnim::getMovementInterpolation() { +Interpolation2d * UIControlAnim::getTranslationInterpolation() { if ( NULL == mMoveAnim ) mMoveAnim = eeNew( Interpolation2d, () ); diff --git a/src/eepp/ui/uilistbox.cpp b/src/eepp/ui/uilistbox.cpp index 5f3bdd8af..341b251e5 100644 --- a/src/eepp/ui/uilistbox.cpp +++ b/src/eepp/ui/uilistbox.cpp @@ -986,18 +986,19 @@ void UIListBox::setFontStyleConfig(const UIFontStyleConfig & fontStyleConfig) { void UIListBox::update() { if ( mEnabled && mVisible ) { if ( mFlags & UI_TOUCH_DRAG_ENABLED ) { - Uint32 Press = UIManager::instance()->getPressTrigger(); - Uint32 LPress = UIManager::instance()->getLastPressTrigger(); + UIManager * manager = UIManager::instance(); + Uint32 Press = manager->getPressTrigger(); + Uint32 LPress = manager->getLastPressTrigger(); if ( ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING ) ) { // Mouse Not Down if ( !( Press & EE_BUTTON_LMASK ) ) { writeCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - UIManager::instance()->setControlDragging( false ); + manager->setControlDragging( false ); return; } - Vector2i Pos( UIManager::instance()->getMousePos() ); + Vector2i Pos( manager->getMousePos() ); if ( mTouchDragPoint != Pos ) { Vector2i diff = -( mTouchDragPoint - Pos ); @@ -1008,7 +1009,7 @@ void UIListBox::update() { mTouchDragPoint = Pos; - UIManager::instance()->setControlDragging( true ); + manager->setControlDragging( true ); } else { mTouchDragAcceleration -= getElapsed().asMilliseconds() * mTouchDragAcceleration * 0.01f; } @@ -1018,7 +1019,7 @@ void UIListBox::update() { if ( !( LPress & EE_BUTTON_LMASK ) && ( Press & EE_BUTTON_LMASK ) ) { writeCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 1 ); - mTouchDragPoint = UIManager::instance()->getMousePos(); + mTouchDragPoint = manager->getMousePos(); mTouchDragAcceleration = 0; } } @@ -1026,7 +1027,7 @@ void UIListBox::update() { // Mouse Up if ( ( LPress & EE_BUTTON_LMASK ) && !( Press & EE_BUTTON_LMASK ) ) { writeCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - UIManager::instance()->setControlDragging( false ); + manager->setControlDragging( false ); } // Deaccelerate diff --git a/src/eepp/ui/uitable.cpp b/src/eepp/ui/uitable.cpp index c6f38039a..5aea4bdb5 100644 --- a/src/eepp/ui/uitable.cpp +++ b/src/eepp/ui/uitable.cpp @@ -599,7 +599,7 @@ bool UITable::getSmoothScroll() const { return mSmoothScroll; } -void UITable::setSmoothScroll(bool smoothScroll) { +UITable * UITable::setSmoothScroll(bool smoothScroll) { mSmoothScroll = smoothScroll; if ( mSmoothScroll ) { @@ -607,6 +607,8 @@ void UITable::setSmoothScroll(bool smoothScroll) { } else { mContainer->unsetFlags( UI_CLIP_ENABLE ); } + + return this; } Float UITable::getTouchDragDeceleration() const { @@ -631,18 +633,19 @@ void UITable::setContainerPadding(const Recti & containerPadding) { void UITable::update() { if ( mEnabled && mVisible ) { if ( mFlags & UI_TOUCH_DRAG_ENABLED ) { - Uint32 Press = UIManager::instance()->getPressTrigger(); - Uint32 LPress = UIManager::instance()->getLastPressTrigger(); + UIManager * manager = UIManager::instance(); + Uint32 Press = manager->getPressTrigger(); + Uint32 LPress = manager->getLastPressTrigger(); if ( ( mControlFlags & UI_CTRL_FLAG_TOUCH_DRAGGING ) ) { // Mouse Not Down if ( !( Press & EE_BUTTON_LMASK ) ) { writeCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - UIManager::instance()->setControlDragging( false ); + manager->setControlDragging( false ); return; } - Vector2i Pos( UIManager::instance()->getMousePos() ); + Vector2i Pos( manager->getMousePos() ); if ( mTouchDragPoint != Pos ) { Vector2i diff = -( mTouchDragPoint - Pos ); @@ -653,7 +656,7 @@ void UITable::update() { mTouchDragPoint = Pos; - UIManager::instance()->setControlDragging( true ); + manager->setControlDragging( true ); } else { mTouchDragAcceleration -= getElapsed().asMilliseconds() * mTouchDragAcceleration * 0.01f; } @@ -663,7 +666,7 @@ void UITable::update() { if ( !( LPress & EE_BUTTON_LMASK ) && ( Press & EE_BUTTON_LMASK ) ) { writeCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 1 ); - mTouchDragPoint = UIManager::instance()->getMousePos(); + mTouchDragPoint = manager->getMousePos(); mTouchDragAcceleration = 0; } } @@ -671,7 +674,7 @@ void UITable::update() { // Mouse Up if ( ( LPress & EE_BUTTON_LMASK ) && !( Press & EE_BUTTON_LMASK ) ) { writeCtrlFlag( UI_CTRL_FLAG_TOUCH_DRAGGING, 0 ); - UIManager::instance()->setControlDragging( false ); + manager->setControlDragging( false ); } // Deaccelerate diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 63c418450..bbd0f94be 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -448,7 +448,7 @@ void EETest::createUI() { TextEdit->setText( mBuda ); UITable * genGrid = UITable::New(); - genGrid->setSmoothScroll( true ); + genGrid->setSmoothScroll( true )->setFlags( UI_TOUCH_DRAG_ENABLED ); genGrid->setParent( C )->setPosition( 325, 245 )->setSize( 200, 130 ); genGrid->setCollumnsCount( 3 )->setRowHeight( 24 ); @@ -892,6 +892,7 @@ void EETest::onItemClick( const UIEvent * Event ) { } else if ( "Show Window" == txt ) { UIMenuCheckBox * Chk = reinterpret_cast ( Event->getControl() ); + C->toFront(); C->setVisible( true ); C->setEnabled( true ); @@ -971,7 +972,7 @@ void EETest::onButtonClick( const UIEvent * Event ) { Gfx->setEnabled( false ); Gfx->startRotation( 0, 2500, Milliseconds( 2500 ) ); - Gfx->startMovement( Vector2i( Math::randi( 0, mWindow->getWidth() ), -64 ), Vector2i( Math::randi( 0, mWindow->getWidth() ), mWindow->getHeight() + 64 ), Milliseconds( 2500 ) ); + Gfx->startTranslation( Vector2i( Math::randi( 0, mWindow->getWidth() ), -64 ), Vector2i( Math::randi( 0, mWindow->getWidth() ), mWindow->getHeight() + 64 ), Milliseconds( 2500 ) ); Gfx->closeFadeOut( Milliseconds( 3500 ) ); //mListBox->addListBoxItem( "Test ListBox " + String::toStr( mListBox->getCount() + 1 ) + " testing it right now!" );