mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Testing if i can move to UI float positions without breaking everything.
--HG-- branch : dev-2.1-float
This commit is contained in:
@@ -136,8 +136,12 @@ class EE_API TileMap {
|
||||
|
||||
Vector2i getMouseTilePosCoords();
|
||||
|
||||
Vector2f getMouseTilePosCoordsf();
|
||||
|
||||
Vector2i getTileCoords( const Vector2i& TilePos );
|
||||
|
||||
Vector2f getTileCoords( const Vector2f& TilePos );
|
||||
|
||||
const Vector2i& getRealMouseTilePos() const;
|
||||
|
||||
const Vector2i& getMouseMapPos() const;
|
||||
|
||||
@@ -14,7 +14,7 @@ class EE_API UIMenu : public UIWidget {
|
||||
public:
|
||||
static UIMenu * New();
|
||||
|
||||
static void fixMenuPos( Vector2i& position, UIMenu * Menu, UIMenu * parent = NULL, UIMenuSubMenu * SubMenu = NULL );
|
||||
static void fixMenuPos( Vector2f& position, UIMenu * Menu, UIMenu * parent = NULL, UIMenuSubMenu * SubMenu = NULL );
|
||||
|
||||
UIMenu();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class UIManager;
|
||||
class UIAction;
|
||||
class UIActionManager;
|
||||
|
||||
class EE_API UINode : public Transformable {
|
||||
class EE_API UINode : private Transformable {
|
||||
public:
|
||||
static UINode * New();
|
||||
|
||||
@@ -34,9 +34,9 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
virtual ~UINode();
|
||||
|
||||
void worldToNodeTranslation( Vector2i& position ) const;
|
||||
void worldToNodeTranslation( Vector2f& position ) const;
|
||||
|
||||
void nodeToWorldTranslation( Vector2i& position ) const;
|
||||
void nodeToWorldTranslation( Vector2f& position ) const;
|
||||
|
||||
void worldToNode( Vector2i& pos );
|
||||
|
||||
@@ -52,19 +52,17 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
void messagePost( const UIMessage * Msg );
|
||||
|
||||
UINode * setPosition( const Vector2i& position );
|
||||
UINode * setPosition( const Vector2f& Pos );
|
||||
|
||||
UINode * setPosition(const Vector2f & Pos);
|
||||
UINode * setPosition( const Float& x, const Float& y );
|
||||
|
||||
UINode * setPosition( const Int32& x, const Int32& y );
|
||||
void setPixelsPosition(const Vector2f & position );
|
||||
|
||||
void setPixelsPosition( const Vector2i& position );
|
||||
void setPixelsPosition( const Float& x, const Float& y );
|
||||
|
||||
void setPixelsPosition( const Int32& x, const Int32& y );
|
||||
const Vector2f& getPosition() const;
|
||||
|
||||
const Vector2i& getPosition() const;
|
||||
|
||||
const Vector2i& getRealPosition() const;
|
||||
const Vector2f& getRealPosition() const;
|
||||
|
||||
virtual UINode * setSize( const Sizei& size );
|
||||
|
||||
@@ -132,8 +130,6 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
const UintPtr& getData() const;
|
||||
|
||||
UINode * childGetAt( Vector2i CtrlPos, unsigned int RecursiveLevel = 0 );
|
||||
|
||||
const Uint32& getFlags() const;
|
||||
|
||||
virtual UINode * setFlags( const Uint32& flags );
|
||||
@@ -274,9 +270,9 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
void setDragging( const bool& dragging );
|
||||
|
||||
const Vector2i& getDragPoint() const;
|
||||
const Vector2f& getDragPoint() const;
|
||||
|
||||
void setDragPoint( const Vector2i& Point );
|
||||
void setDragPoint( const Vector2f& Point );
|
||||
|
||||
bool isDragEnabled() const;
|
||||
|
||||
@@ -308,8 +304,6 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
Vector2f getScaleCenter();
|
||||
|
||||
virtual void setPosition(float x, float y);
|
||||
|
||||
virtual void setScale(float factorX, float factorY);
|
||||
|
||||
virtual void setScaleOrigin(float x, float y);
|
||||
@@ -330,7 +324,7 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
Interpolation2d * startScaleAnim( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startTranslation( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
Interpolation2d * startTranslation( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation1d * startRotation( const Float& From, const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
|
||||
|
||||
@@ -340,7 +334,7 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
Interpolation2d * startScaleAnim( const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation2d * startTranslation( const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
Interpolation2d * startTranslation( const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation2d::OnPathEndCallback PathEndCallback = Interpolation2d::OnPathEndCallback() );
|
||||
|
||||
Interpolation1d * startRotation( const Float& To, const Time& TotalTime, const Ease::Interpolation& type = Ease::Linear, Interpolation1d::OnPathEndCallback PathEndCallback = Interpolation1d::OnPathEndCallback() );
|
||||
|
||||
@@ -371,6 +365,24 @@ class EE_API UINode : public Transformable {
|
||||
Vector2f convertToWorldSpace(const Vector2f& nodePoint);
|
||||
|
||||
Rectf getLocalBounds();
|
||||
|
||||
const Vector2f& getRotationOrigin() const;
|
||||
|
||||
float getRotation() const;
|
||||
|
||||
const Vector2f& getScale() const;
|
||||
|
||||
const Vector2f& getScaleOrigin() const;
|
||||
|
||||
void move(float offsetX, float offsetY);
|
||||
|
||||
void move(const Vector2f& offset);
|
||||
|
||||
void rotate(float angle);
|
||||
|
||||
void scale(float factorX, float factorY);
|
||||
|
||||
void scale(const Vector2f& factor);
|
||||
protected:
|
||||
typedef std::map< Uint32, std::map<Uint32, UIEventCallback> > UIEventsMap;
|
||||
friend class UIManager;
|
||||
@@ -378,10 +390,10 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
std::string mId;
|
||||
Uint32 mIdHash;
|
||||
Vector2i mPos;
|
||||
Vector2i mRealPos;
|
||||
Vector2i mScreenPos;
|
||||
Vector2f mScreenPosf;
|
||||
Vector2f mDpPos;
|
||||
Vector2f mRealPos;
|
||||
Vector2f mScreenPos;
|
||||
Vector2i mScreenPosi;
|
||||
Sizei mSize;
|
||||
Sizei mRealSize;
|
||||
|
||||
@@ -411,7 +423,7 @@ class EE_API UINode : public Transformable {
|
||||
bool mVisible;
|
||||
bool mEnabled;
|
||||
|
||||
Vector2i mDragPoint;
|
||||
Vector2f mDragPoint;
|
||||
Uint32 mDragButton;
|
||||
|
||||
OriginPoint mRotationOriginPoint;
|
||||
@@ -498,7 +510,7 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
virtual void clipMe();
|
||||
|
||||
virtual Uint32 onDrag( const Vector2i& position );
|
||||
virtual Uint32 onDrag( const Vector2f& position );
|
||||
|
||||
virtual Uint32 onDragStart( const Vector2i& position );
|
||||
|
||||
@@ -554,7 +566,7 @@ class EE_API UINode : public Transformable {
|
||||
|
||||
void drawBox();
|
||||
|
||||
void setInternalPosition( const Vector2i& Pos );
|
||||
void setInternalPosition( const Vector2f& Pos );
|
||||
|
||||
void setInternalSize( const Sizei& size );
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ class EE_API UIWindow : public UIWidget {
|
||||
|
||||
UIWidget * mModalCtrl;
|
||||
|
||||
Vector2i mNonMaxPos;
|
||||
Vector2f mNonMaxPos;
|
||||
Sizei mNonMaxSize;
|
||||
UI_RESIZE_TYPE mResizeType;
|
||||
Vector2i mResizePos;
|
||||
|
||||
@@ -29,7 +29,7 @@ using namespace EE::Maps::Private;
|
||||
|
||||
namespace EE { namespace Maps {
|
||||
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2f& Pos = Vector2f(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
@@ -89,9 +89,9 @@ void MapEditor::createWinMenu() {
|
||||
UIWinMenu * WinMenu = UIWinMenu::New();
|
||||
WinMenu->setParent( mUIContainer );
|
||||
|
||||
mTileBox = createTextBox( "", mUIContainer, Sizei(), Vector2i(), UI_HALIGN_RIGHT | UI_VALIGN_CENTER | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT );
|
||||
mTileBox = createTextBox( "", mUIContainer, Sizei(), Vector2f(), UI_HALIGN_RIGHT | UI_VALIGN_CENTER | UI_ANCHOR_TOP | UI_ANCHOR_RIGHT );
|
||||
mTileBox->setSize( 100, WinMenu->getSize().getHeight() );
|
||||
mTileBox->setPosition( Vector2i( mUIContainer->getSize().getWidth() - mTileBox->getSize().getWidth(), 0 ) );
|
||||
mTileBox->setPosition( Vector2f( mUIContainer->getSize().getWidth() - mTileBox->getSize().getWidth(), 0 ) );
|
||||
mTileBox->updateAnchorsDistances();
|
||||
|
||||
UIPopUpMenu * PU1 = UIPopUpMenu::New();
|
||||
@@ -257,7 +257,7 @@ void MapEditor::createTextureRegionContainer( Int32 Width ) {
|
||||
UITextView * Txt;
|
||||
Uint32 TxtFlags = UI_CONTROL_DEFAULT_ALIGN | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP;
|
||||
|
||||
Txt = createTextBox( "Add Game Object as...", mTextureRegionCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 4 ), TxtFlags, Text::Shadow );
|
||||
Txt = createTextBox( "Add Game Object as...", mTextureRegionCont, Sizei( Width, 16 ), Vector2f( TAB_CONT_X_DIST, 4 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mGOTypeList = UIDropDownList::New();
|
||||
mGOTypeList->setFontStyle( Text::Shadow )->setParent( mTextureRegionCont )->setSize( Width - 26, 0 )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 );
|
||||
@@ -275,14 +275,14 @@ void MapEditor::createTextureRegionContainer( Int32 Width ) {
|
||||
if ( NULL == mBtnGOTypeAdd->getIcon()->getDrawable() )
|
||||
mBtnGOTypeAdd->setText( "..." );
|
||||
|
||||
Txt = createTextBox( "Layers:", mTextureRegionCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mGOTypeList->getPosition().y + mGOTypeList->getSize().getHeight() + 4 ), TxtFlags, Text::Shadow );
|
||||
Txt = createTextBox( "Layers:", mTextureRegionCont, Sizei( Width, 16 ), Vector2f( TAB_CONT_X_DIST, mGOTypeList->getPosition().y + mGOTypeList->getSize().getHeight() + 4 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mLayerList = UIDropDownList::New();
|
||||
mLayerList->setFontStyle( Text::Shadow )->setParent( mTextureRegionCont )->setSize( Width, 0 )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 );
|
||||
|
||||
mLayerList->addEventListener( UIEvent::OnItemSelected, cb::Make1( this, &MapEditor::onLayerSelect ) );
|
||||
|
||||
Txt = createTextBox( "Game Object Flags:", mTextureRegionCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mLayerList->getPosition().y + mLayerList->getSize().getHeight() + 4 ), TxtFlags, Text::Shadow );
|
||||
Txt = createTextBox( "Game Object Flags:", mTextureRegionCont, Sizei( Width, 16 ), Vector2f( TAB_CONT_X_DIST, mLayerList->getPosition().y + mLayerList->getSize().getHeight() + 4 ), TxtFlags, Text::Shadow );
|
||||
|
||||
Uint32 ChkFlags = UI_CONTROL_DEFAULT_ALIGN | UI_AUTO_SIZE | UI_ANCHOR_RIGHT | UI_ANCHOR_TOP;
|
||||
|
||||
@@ -325,7 +325,7 @@ void MapEditor::createTextureRegionContainer( Int32 Width ) {
|
||||
mChkBlendAdd->setTooltipText( "Use additive blend mode." );
|
||||
mChkBlendAdd->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &MapEditor::chkClickAutoFix ) );
|
||||
|
||||
Txt = createTextBox( "Game Object Data:", mTextureRegionCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, mChkBlendAdd->getPosition().y + mChkBlendAdd->getSize().getHeight() + 8 ), TxtFlags, Text::Shadow );
|
||||
Txt = createTextBox( "Game Object Data:", mTextureRegionCont, Sizei( Width, 16 ), Vector2f( TAB_CONT_X_DIST, mChkBlendAdd->getPosition().y + mChkBlendAdd->getSize().getHeight() + 8 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mChkDI = UICheckBox::New();
|
||||
mChkDI->setFontStyle( Text::Shadow )->setParent( mTextureRegionCont )->setPosition( TAB_CONT_X_DIST, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->resetFlags( ChkFlags );
|
||||
@@ -339,7 +339,7 @@ void MapEditor::createTextureRegionContainer( Int32 Width ) {
|
||||
mSGCont->setEnabled( true );
|
||||
mSGCont->setVisible( true );
|
||||
|
||||
Txt = createTextBox( "Texture Atlases:", mSGCont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 0 ), TxtFlags, Text::Shadow );
|
||||
Txt = createTextBox( "Texture Atlases:", mSGCont, Sizei( Width, 16 ), Vector2f( TAB_CONT_X_DIST, 0 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mTextureAtlasesList = UIDropDownList::New();
|
||||
mTextureAtlasesList->setFontStyle( Text::Shadow )->setParent( mSGCont )->setSize( Width, 0 )->setPosition( 0, Txt->getPosition().y +Txt->getSize().getHeight() + 4 );
|
||||
@@ -367,7 +367,7 @@ void MapEditor::createTextureRegionContainer( Int32 Width ) {
|
||||
mDICont->setEnabled( false );
|
||||
mDICont->setVisible( false );
|
||||
|
||||
Txt = createTextBox( "DataId String:", mDICont, Sizei( Width, 16 ), Vector2i( TAB_CONT_X_DIST, 0 ), TxtFlags, Text::Shadow );
|
||||
Txt = createTextBox( "DataId String:", mDICont, Sizei( Width, 16 ), Vector2f( TAB_CONT_X_DIST, 0 ), TxtFlags, Text::Shadow );
|
||||
|
||||
mDataIdInput = UITextInput::New();
|
||||
mDataIdInput->setParent( mDICont )->setSize( Width / 4 * 3, 0 )->setPosition( TAB_CONT_X_DIST + 8, Txt->getPosition().y + Txt->getSize().getHeight() + 8 );
|
||||
@@ -381,7 +381,7 @@ void MapEditor::createLighContainer() {
|
||||
NewLightBut->setText( "New Light" );
|
||||
NewLightBut->addEventListener( UIEvent::MouseClick, cb::Make1( this, &MapEditor::onNewLight ) );
|
||||
|
||||
UITextView * Txt = createTextBox( "Light Color:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, 32 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE );
|
||||
UITextView * Txt = createTextBox( "Light Color:", mLightCont, Sizei(), Vector2f( TAB_CONT_X_DIST, 32 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE );
|
||||
Txt->setFontStyle( Text::Shadow );
|
||||
|
||||
mUIBaseColor = UIWidget::New();
|
||||
@@ -392,7 +392,7 @@ void MapEditor::createLighContainer() {
|
||||
mUIBaseColor->getBackground()->setColor( Color(255,255,255,255) );
|
||||
mUIBaseColor->getBorder()->setColor( Color( 100, 100, 100, 200 ) );
|
||||
|
||||
Txt = createTextBox( "R:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "R:", mLightCont, Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIRedSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIRedSlider->setParent( mLightCont )->setSize( 100, 20 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -400,27 +400,27 @@ void MapEditor::createLighContainer() {
|
||||
mUIRedSlider->setValue( 255 );
|
||||
mUIRedSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &MapEditor::onRedChange ) );
|
||||
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2f( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "G:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "G:", mLightCont, Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIGreenSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIGreenSlider->setParent( mLightCont )->setSize( 100, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
mUIGreenSlider->setMaxValue( 255 );
|
||||
mUIGreenSlider->setValue( 255 );
|
||||
mUIGreenSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &MapEditor::onGreenChange ) );
|
||||
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2f( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "B:", mLightCont, Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "B:", mLightCont, Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIBlueSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIBlueSlider->setParent( mLightCont )->setSize( 100, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
mUIBlueSlider->setMaxValue( 255 );
|
||||
mUIBlueSlider->setValue( 255 );
|
||||
mUIBlueSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &MapEditor::onBlueChange ) );
|
||||
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)255 ), mLightCont, Sizei(), Vector2f( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Light Radius:", mLightCont, Sizei(), Vector2i( TAB_CONT_X_DIST, mUIBlueTxt->getPosition().y + mUIBlueTxt->getSize().getHeight() + 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Light Radius:", mLightCont, Sizei(), Vector2f( TAB_CONT_X_DIST, mUIBlueTxt->getPosition().y + mUIBlueTxt->getSize().getHeight() + 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mLightRadius = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 100 );
|
||||
mLightRadius->setParent( mLightCont )->setSize( 100, 0 )->setPosition( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 );
|
||||
@@ -589,7 +589,7 @@ void MapEditor::onNewLight( const UIEvent * Event ) {
|
||||
const UIEventMouse * MEvent = reinterpret_cast<const UIEventMouse*> ( Event );
|
||||
|
||||
if ( MEvent->getFlags() & EE_BUTTON_LMASK ) {
|
||||
Vector2i Pos = mUIMap->Map()->getMouseMapPos();
|
||||
Vector2f Pos = mUIMap->Map()->getMouseMapPosf();
|
||||
mUIMap->addLight( eeNew( MapLight, ( mLightRadius->getValue(), Pos.x, Pos.y, mUIBaseColor->getBackground()->getColor().toRGB(), mLightTypeChk->isActive() ? LIGHT_ISOMETRIC : LIGHT_NORMAL ) ) );
|
||||
}
|
||||
}
|
||||
@@ -1296,10 +1296,10 @@ void MapEditor::addGameObject() {
|
||||
if ( tObj->getType() == GAMEOBJECT_TYPE_VIRTUAL )
|
||||
reinterpret_cast<GameObjectVirtual*> ( tObj )->setLayer( tLayer );
|
||||
|
||||
Vector2i p( tMap->getMouseMapPos() );
|
||||
Vector2f p( tMap->getMouseMapPosf() );
|
||||
|
||||
if ( UIManager::instance()->getInput()->isKeyDown( KEY_LCTRL ) ) {
|
||||
p = tMap->getMouseTilePosCoords();
|
||||
p = tMap->getMouseTilePosCoordsf();
|
||||
}
|
||||
|
||||
tObj->setPosition( Vector2f( p.x, p.y ) );
|
||||
|
||||
@@ -74,7 +74,7 @@ MapLayerProperties::MapLayerProperties( MapLayer * Map, RefreshLayerListCb Cb )
|
||||
mGenGrid->setCollumnWidth( 3, 175 );
|
||||
mGenGrid->setCollumnWidth( 4, 10 );
|
||||
|
||||
Vector2i Pos( mGenGrid->getPosition().x + mGenGrid->getSize().getWidth() + 10, mGenGrid->getPosition().y );
|
||||
Vector2f Pos( mGenGrid->getPosition().x + mGenGrid->getSize().getWidth() + 10, mGenGrid->getPosition().y );
|
||||
|
||||
UIPushButton * AddButton = UIPushButton::New();
|
||||
AddButton->setParent( mUIWindow->getContainer() )->setSize( 24, 0 )->setPosition( Pos );
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace EE { namespace Maps { namespace Private {
|
||||
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2f& Pos = Vector2f(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
@@ -36,14 +36,14 @@ MapObjectProperties::MapObjectProperties( GameObjectObject * Obj ) :
|
||||
Int32 InitialY = 16;
|
||||
Int32 DistFromTitle = 18;
|
||||
|
||||
UITextView * Txt = createTextBox( "Object name:", mUIWindow->getContainer(), Sizei(), Vector2i( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
UITextView * Txt = createTextBox( "Object name:", mUIWindow->getContainer(), Sizei(), Vector2f( 50, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIInput = UITextInput::New();
|
||||
mUIInput->setParent( mUIWindow->getContainer() )->setSize( 120, 0 )->setPosition( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle );
|
||||
mUIInput->setMaxLength( 64 );
|
||||
mUIInput->setText( mObj->getName() );
|
||||
mUIInput->addEventListener( UIEvent::OnPressEnter, cb::Make1( this, &MapObjectProperties::onOKClick ) );
|
||||
|
||||
UITextView * Txt2 = createTextBox( "Object type:", mUIWindow->getContainer(), Sizei(), Vector2i( 50+192, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
UITextView * Txt2 = createTextBox( "Object type:", mUIWindow->getContainer(), Sizei(), Vector2f( 50+192, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIInput2 = UITextInput::New();
|
||||
mUIInput2->setParent( mUIWindow->getContainer() )->setSize( 120, 0 )->setPosition( Txt2->getPosition().x + DistFromTitle, Txt2->getPosition().y + DistFromTitle );
|
||||
mUIInput2->setMaxLength( 64 );
|
||||
@@ -51,8 +51,8 @@ MapObjectProperties::MapObjectProperties( GameObjectObject * Obj ) :
|
||||
mUIInput2->addEventListener( UIEvent::OnPressEnter, cb::Make1( this, &MapObjectProperties::onOKClick ) );
|
||||
|
||||
Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_HALIGN_CENTER | UI_VALIGN_CENTER;
|
||||
createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags, Text::Shadow );
|
||||
UITextView * TxtBox = createTextBox( "Property Value", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50+192, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags, Text::Shadow );
|
||||
createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2f( 50, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags, Text::Shadow );
|
||||
UITextView * TxtBox = createTextBox( "Property Value", mUIWindow->getContainer(), Sizei(192, 24), Vector2f( 50+192, mUIInput->getPosition().y + mUIInput->getSize().getHeight() + 12 ), TxtBoxFlags, Text::Shadow );
|
||||
|
||||
UIPushButton * OKButton = UIPushButton::New();
|
||||
OKButton->setParent( mUIWindow->getContainer() )->setSize( 80, 0 );
|
||||
@@ -80,7 +80,7 @@ MapObjectProperties::MapObjectProperties( GameObjectObject * Obj ) :
|
||||
mGenGrid->setCollumnWidth( 3, 175 );
|
||||
mGenGrid->setCollumnWidth( 4, 10 );
|
||||
|
||||
Vector2i Pos( mGenGrid->getPosition().x + mGenGrid->getSize().getWidth() + 10, mGenGrid->getPosition().y );
|
||||
Vector2f Pos( mGenGrid->getPosition().x + mGenGrid->getSize().getWidth() + 10, mGenGrid->getPosition().y );
|
||||
|
||||
UIPushButton * AddButton = UIPushButton::New();
|
||||
AddButton->setParent( mUIWindow->getContainer() )->setSize( 24, 0 )->setPosition( Pos );
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace EE { namespace Maps { namespace Private {
|
||||
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2f& Pos = Vector2f(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
@@ -38,7 +38,7 @@ TileMapProperties::TileMapProperties( TileMap * Map ) :
|
||||
if ( mMap->getLightsEnabled() ) {
|
||||
DiffIfLights = 100;
|
||||
|
||||
UITextView * Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2i( 50, 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
UITextView * Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2f( 50, 16 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIBaseColor = UIWidget::New();
|
||||
mUIBaseColor->setFlags( UI_FILL_BACKGROUND | UI_BORDER );
|
||||
@@ -48,16 +48,16 @@ TileMapProperties::TileMapProperties( TileMap * Map ) :
|
||||
mUIBaseColor->getBackground()->setColor( mMap->getBaseColor() );
|
||||
mUIBaseColor->getBorder()->setColor( Color( 100, 100, 100, 200 ) );
|
||||
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIRedSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIRedSlider->setParent( mUIWindow->getContainer() )->setSize( 255, 20 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth() + 16, Txt->getPosition().y );
|
||||
mUIRedSlider->setMaxValue( 255 );
|
||||
mUIRedSlider->setValue( mMap->getBaseColor().r );
|
||||
mUIRedSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &TileMapProperties::onRedChange ) );
|
||||
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().r ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIRedTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().r ), mUIWindow->getContainer(), Sizei(), Vector2f( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIGreenSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIGreenSlider->setParent( mUIWindow->getContainer() )->setSize( 255, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
@@ -65,21 +65,21 @@ TileMapProperties::TileMapProperties( TileMap * Map ) :
|
||||
mUIGreenSlider->setValue( mMap->getBaseColor().g );
|
||||
mUIGreenSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &TileMapProperties::onGreenChange ) );
|
||||
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().g ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIGreenTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().g ), mUIWindow->getContainer(), Sizei(), Vector2f( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIBlueSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIBlueSlider->setParent( mUIWindow->getContainer() )->setSize( 255, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
mUIBlueSlider->setMaxValue( 255 );
|
||||
mUIBlueSlider->setValue( mMap->getBaseColor().b );
|
||||
mUIBlueSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &TileMapProperties::onBlueChange ) );
|
||||
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().b ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIBlueTxt = createTextBox( String::toStr( (Uint32)mMap->getBaseColor().b ), mUIWindow->getContainer(), Sizei(), Vector2f( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
}
|
||||
|
||||
Uint32 TxtBoxFlags = UI_CONTROL_DEFAULT_FLAGS | UI_HALIGN_CENTER | UI_VALIGN_CENTER;
|
||||
UITextView * TxtBox = createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2i( 50, 10 + DiffIfLights ), TxtBoxFlags, Text::Shadow );
|
||||
createTextBox( "Property Value", mUIWindow->getContainer(), Sizei(192, 24), Vector2i(50+192, TxtBox->getPosition().y ), TxtBoxFlags );
|
||||
UITextView * TxtBox = createTextBox( "Property Name", mUIWindow->getContainer(), Sizei(192, 24), Vector2f( 50, 10 + DiffIfLights ), TxtBoxFlags, Text::Shadow );
|
||||
createTextBox( "Property Value", mUIWindow->getContainer(), Sizei(192, 24), Vector2f(50+192, TxtBox->getPosition().y ), TxtBoxFlags );
|
||||
|
||||
UIPushButton * OKButton = UIPushButton::New();
|
||||
OKButton->setParent( mUIWindow->getContainer() )->setSize( 80, 0 );
|
||||
@@ -107,7 +107,7 @@ TileMapProperties::TileMapProperties( TileMap * Map ) :
|
||||
mGenGrid->setCollumnWidth( 3, 175 );
|
||||
mGenGrid->setCollumnWidth( 4, 10 );
|
||||
|
||||
Vector2i Pos( mGenGrid->getPosition().x + mGenGrid->getSize().getWidth() + 10, mGenGrid->getPosition().y );
|
||||
Vector2f Pos( mGenGrid->getPosition().x + mGenGrid->getSize().getWidth() + 10, mGenGrid->getPosition().y );
|
||||
|
||||
UIPushButton * AddButton = UIPushButton::New();
|
||||
AddButton->setParent( mUIWindow->getContainer() )->setSize( 24, 0 )->setPosition( Pos );
|
||||
|
||||
@@ -52,7 +52,7 @@ UIMap::~UIMap() {
|
||||
eeSAFE_DELETE( mMap );
|
||||
}
|
||||
|
||||
Uint32 UIMap::onDrag( const Vector2i& Pos ) {
|
||||
Uint32 UIMap::onDrag( const Vector2f& Pos ) {
|
||||
|
||||
if ( ( EDITING_OBJECT == mEditingMode && NULL != mSelObj ) ||
|
||||
( EDITING_LIGHT == mEditingMode && NULL != mSelLight ) ) {
|
||||
@@ -60,7 +60,7 @@ Uint32 UIMap::onDrag( const Vector2i& Pos ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vector2i nPos( -( mDragPoint - Pos ) );
|
||||
Vector2f nPos( -( mDragPoint - Pos ) );
|
||||
Vector2f nPosf( nPos.x, nPos.y );
|
||||
|
||||
mMap->move( nPosf );
|
||||
@@ -96,7 +96,7 @@ void UIMap::updateScreenPos() {
|
||||
UIWindow::updateScreenPos();
|
||||
|
||||
if ( NULL != mMap ) {
|
||||
mMap->setPosition( mScreenPos );
|
||||
mMap->setPosition( Vector2i( mScreenPos.x, mScreenPos.y ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ void UIMap::tryToSelectLight() {
|
||||
|
||||
void UIMap::onSizeChange() {
|
||||
if ( NULL != mMap ) {
|
||||
mMap->setPosition( mScreenPos );
|
||||
mMap->setPosition( Vector2i( mScreenPos.x, mScreenPos.y ) );
|
||||
mMap->setViewSize( mRealSize );
|
||||
}
|
||||
|
||||
@@ -585,9 +585,9 @@ void UIMap::createObjPopUpMenu() {
|
||||
Menu->addEventListener( UIEvent::OnItemClicked, cb::Make1( this, &UIMap::objItemClick ) );
|
||||
|
||||
if ( Menu->show() ) {
|
||||
Vector2i Pos = UIManager::instance()->getInput()->getMousePos();
|
||||
Vector2f Pos = UIManager::instance()->getInput()->getMousePosf();
|
||||
UIMenu::fixMenuPos( Pos , Menu );
|
||||
Pos = PixelDensity::pxToDpI( Pos );
|
||||
Pos = PixelDensity::pxToDp( Pos );
|
||||
Menu->setPosition( Pos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class EE_API UIMap : public UIWindow {
|
||||
|
||||
virtual void onAlphaChange();
|
||||
|
||||
virtual Uint32 onDrag( const Vector2i& getPosition );
|
||||
virtual Uint32 onDrag( const Vector2f& Pos );
|
||||
|
||||
void objItemClick( const UIEvent * Event );
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace EE { namespace Maps { namespace Private {
|
||||
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2i& Pos = Vector2i(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
static UITextView * createTextBox( const String& Text = "", UINode * Parent = NULL, const Sizei& Size = Sizei(), const Vector2f& Pos = Vector2f(), const Uint32& Flags = UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, const Uint32& fontStyle = Text::Regular ) {
|
||||
UITextView * Ctrl = UITextView::New();
|
||||
Ctrl->setFontStyle( fontStyle );
|
||||
Ctrl->resetFlags( Flags )->setParent( Parent )->setPosition( Pos )->setSize( Size )->setVisible( true )->setEnabled( false );
|
||||
@@ -38,9 +38,9 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
Int32 InitialY = 16;
|
||||
Int32 DistFromTitle = 18;
|
||||
|
||||
UITextView * Txt = createTextBox( "Map Size", mUIWindow->getContainer(), Sizei(), Vector2i( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
UITextView * Txt = createTextBox( "Map Size", mUIWindow->getContainer(), Sizei(), Vector2f( 16, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2f( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapWidth = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 100 );
|
||||
mUIMapWidth->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -50,7 +50,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapWidth->setValue( mUIMap->Map()->getSize().getWidth() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2f( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapHeight = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 100 );
|
||||
mUIMapHeight->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -60,9 +60,9 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapHeight->setValue( mUIMap->Map()->getSize().getHeight() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Tile Size", mUIWindow->getContainer(), Sizei(), Vector2i( mUIWindow->getContainer()->getSize().getWidth() / 2, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Tile Size", mUIWindow->getContainer(), Sizei(), Vector2f( mUIWindow->getContainer()->getSize().getWidth() / 2, InitialY ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
Txt = createTextBox( "Width:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2f( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapTWidth = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 32 );
|
||||
mUIMapTWidth->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -72,7 +72,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapTWidth->setValue( mUIMap->Map()->getTileSize().getWidth() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2i( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
Txt = createTextBox( "Height:", mUIWindow->getContainer(), Sizei( 46, 24 ), Vector2f( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS, Text::Shadow );
|
||||
|
||||
mUIMapTHeight = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 32 );
|
||||
mUIMapTHeight->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth(), Txt->getPosition().y );
|
||||
@@ -82,13 +82,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIMapTHeight->setValue( mUIMap->Map()->getTileSize().getHeight() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Max Layers", mUIWindow->getContainer(), Sizei(), Vector2i( 16, mUIMapTHeight->getPosition().y + mUIMapTHeight->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Max Layers", mUIWindow->getContainer(), Sizei(), Vector2f( 16, mUIMapTHeight->getPosition().y + mUIMapTHeight->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIMapMaxLayers = UISpinBox::New()->setAllowOnlyNumbers( false )->setValue( 8 );
|
||||
mUIMapMaxLayers->setParent( mUIWindow->getContainer() )->setSize( 53, 0 )->setPosition( Txt->getPosition().x + DistFromTitle, Txt->getPosition().y + DistFromTitle );
|
||||
mUIMapMaxLayers->setMaxValue( 32 );
|
||||
|
||||
Txt = createTextBox( "Map Flags:", mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x, mUIMapMaxLayers->getPosition().y + mUIMapMaxLayers->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Map Flags:", mUIWindow->getContainer(), Sizei(), Vector2f( Txt->getPosition().x, mUIMapMaxLayers->getPosition().y + mUIMapMaxLayers->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUILightsEnabled = UICheckBox::New();
|
||||
mUILightsEnabled->setParent( mUIWindow->getContainer() )
|
||||
@@ -134,7 +134,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIClipArea->setActive( 0 != mUIMap->Map()->getClipedArea() );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2i( Txt->getPosition().x, mUIClipArea->getPosition().y + mUIClipArea->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Map Base Color:", mUIWindow->getContainer(), Sizei(), Vector2f( Txt->getPosition().x, mUIClipArea->getPosition().y + mUIClipArea->getSize().getHeight() + 8 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIBaseColor = UIWidget::New();
|
||||
mUIBaseColor->setFlags( UI_FILL_BACKGROUND | UI_BORDER );
|
||||
@@ -142,7 +142,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIBaseColor->getBackground()->setColor( ResizeMap ? mUIMap->Map()->getBaseColor() : Color( 255, 255, 255, 255 ) );
|
||||
mUIBaseColor->setParent( mUIWindow->getContainer() )->setPosition( Txt->getPosition().x, Txt->getPosition().y + Txt->getSize().getHeight() + 4 )->setSize( 64, 64 );
|
||||
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Red Color:", mUIWindow->getContainer(), Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIBaseColor->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIRedSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIRedSlider->setParent( mUIWindow->getContainer() )->setSize( 128, 20 )->setPosition( Txt->getPosition().x + Txt->getSize().getWidth() + 16, Txt->getPosition().y );
|
||||
@@ -150,13 +150,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIRedSlider->setValue( 255 );
|
||||
mUIRedSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &UIMapNew::onRedChange ) );
|
||||
|
||||
mUIRedTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIRedTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2f( mUIRedSlider->getPosition().x + mUIRedSlider->getSize().getWidth() + 4, mUIRedSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
if ( ResizeMap ) {
|
||||
mUIRedSlider->setValue( mUIMap->Map()->getBaseColor().r );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Green Color:", mUIWindow->getContainer(), Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIRedSlider->getPosition().y + mUIRedSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIGreenSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIGreenSlider->setParent( mUIWindow->getContainer() )->setSize( 128, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
@@ -164,13 +164,13 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIGreenSlider->setValue( 255 );
|
||||
mUIGreenSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &UIMapNew::onGreenChange ) );
|
||||
|
||||
mUIGreenTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIGreenTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2f( mUIGreenSlider->getPosition().x + mUIGreenSlider->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
if ( ResizeMap ) {
|
||||
mUIGreenSlider->setValue( mUIMap->Map()->getBaseColor().g );
|
||||
}
|
||||
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2i( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
Txt = createTextBox( "Blue Color:", mUIWindow->getContainer(), Sizei(), Vector2f( mUIBaseColor->getPosition().x + mUIBaseColor->getSize().getWidth() + 4, mUIGreenSlider->getPosition().y + mUIGreenSlider->getSize().getHeight() + 4 ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
mUIBlueSlider = UISlider::New()->setOrientation( UI_HORIZONTAL );
|
||||
mUIBlueSlider->setParent( mUIWindow->getContainer() )->setSize( 128, 20 )->setPosition( mUIRedSlider->getPosition().x, Txt->getPosition().y );
|
||||
@@ -178,7 +178,7 @@ UIMapNew::UIMapNew( UIMap * Map, cb::Callback0<void> NewMapCb, bool ResizeMap )
|
||||
mUIBlueSlider->setValue( 255 );
|
||||
mUIBlueSlider->addEventListener( UIEvent::OnValueChange, cb::Make1( this, &UIMapNew::onBlueChange ) );
|
||||
|
||||
mUIBlueTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2i( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
mUIBlueTxt = createTextBox( String::toStr( 255 ), mUIWindow->getContainer(), Sizei(), Vector2f( mUIBlueSlider->getPosition().x + mUIBlueSlider->getSize().getWidth() + 4, mUIBlueSlider->getPosition().y ), UI_CONTROL_DEFAULT_FLAGS | UI_AUTO_SIZE, Text::Shadow );
|
||||
|
||||
if ( ResizeMap ) {
|
||||
mUIBlueSlider->setValue( mUIMap->Map()->getBaseColor().b );
|
||||
|
||||
@@ -476,10 +476,18 @@ Vector2i TileMap::getMouseTilePosCoords() {
|
||||
return getTileCoords( getMouseTilePos() );
|
||||
}
|
||||
|
||||
Vector2f TileMap::getMouseTilePosCoordsf() {
|
||||
return getTileCoords( Vector2f( getMouseTilePos().x, getMouseTilePos().y ) );
|
||||
}
|
||||
|
||||
Vector2i TileMap::getTileCoords( const Vector2i& TilePos ) {
|
||||
return ( TilePos * mTileSize );
|
||||
}
|
||||
|
||||
Vector2f TileMap::getTileCoords( const Vector2f& TilePos ) {
|
||||
return ( TilePos * Vector2f( mTileSize.x, mTileSize.y ) );
|
||||
}
|
||||
|
||||
void TileMap::setViewSize( const Sizei& viewSize ) {
|
||||
mViewSize = viewSize;
|
||||
|
||||
|
||||
@@ -46,21 +46,21 @@ void TextureAtlasTextureRegionEditor::draw() {
|
||||
P.setColor( Color( 255, 0, 0, mAlpha ) );
|
||||
P.setLineWidth( PixelDensity::dpToPx( 1.f ) );
|
||||
|
||||
Vector2i uiCenterPx = PixelDensity::dpToPxI( mUICenter );
|
||||
Vector2f uiCenterPx = PixelDensity::dpToPx( mUICenter );
|
||||
|
||||
P.drawLine( Line2f( Vector2f( mScreenPos.x, mScreenPos.y + uiCenterPx.y ), Vector2f( mScreenPos.x + mRealSize.getWidth(), mScreenPos.y + uiCenterPx.y ) ) );
|
||||
P.drawLine( Line2f( Vector2f( mScreenPos.x + uiCenterPx.x, mScreenPos.y ), Vector2f( mScreenPos.x + uiCenterPx.x, mScreenPos.y + mRealSize.getHeight() ) ) );
|
||||
}
|
||||
|
||||
void TextureAtlasTextureRegionEditor::update( const Time& time ) {
|
||||
Vector2i Pos = mDrag->getRealPosition();
|
||||
Vector2f Pos = mDrag->getRealPosition();
|
||||
|
||||
UIWidget::update( time );
|
||||
|
||||
if ( NULL != mGfx->getTextureRegion() && mDrag->isDragEnabled() && mDrag->isDragging() && Pos != mDrag->getRealPosition() ) {
|
||||
Vector2i Diff = -( Pos - mDrag->getRealPosition() );
|
||||
Vector2f Diff = -( Pos - mDrag->getRealPosition() );
|
||||
|
||||
Diff = PixelDensity::pxToDpI( Diff );
|
||||
Diff = PixelDensity::pxToDp( Diff );
|
||||
|
||||
mGfx->getTextureRegion()->setOffset( Vector2i( mGfx->getTextureRegion()->getOffset().x + Diff.x, mGfx->getTextureRegion()->getOffset().y + Diff.y ) );
|
||||
|
||||
@@ -88,7 +88,7 @@ UITextureRegion * TextureAtlasTextureRegionEditor::getGfx() const {
|
||||
}
|
||||
|
||||
void TextureAtlasTextureRegionEditor::getCenter() {
|
||||
mUICenter = Vector2i( mSize.getWidth() / 2, mSize.getHeight() / 2 );
|
||||
mUICenter = Vector2f( mSize.getWidth() / 2, mSize.getHeight() / 2 );
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
@@ -31,7 +31,7 @@ class EE_API TextureAtlasTextureRegionEditor : public UIWidget {
|
||||
UITheme * mTheme;
|
||||
UITextureRegion * mGfx;
|
||||
UINode * mDrag;
|
||||
Vector2i mUICenter;
|
||||
Vector2f mUICenter;
|
||||
TextureAtlasEditor * mEditor;
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
@@ -108,13 +108,13 @@ void UIDropDownList::showList() {
|
||||
|
||||
mListBox->toFront();
|
||||
|
||||
Vector2i Pos( mPos.x, mPos.y + mSize.getHeight() );
|
||||
Vector2f Pos( mDpPos.x, mDpPos.y + mSize.getHeight() );
|
||||
|
||||
if ( mStyleConfig.PopUpToMainControl ) {
|
||||
getParent()->nodeToWorld( Pos );
|
||||
Pos = PixelDensity::pxToDpI( Pos );
|
||||
Pos = PixelDensity::pxToDp( Pos );
|
||||
} else if ( NULL != mFriendCtrl ) {
|
||||
Pos = Vector2i( mFriendCtrl->getPosition().x, mFriendCtrl->getPosition().y + mFriendCtrl->getSize().getHeight() );
|
||||
Pos = Vector2f( mFriendCtrl->getPosition().x, mFriendCtrl->getPosition().y + mFriendCtrl->getSize().getHeight() );
|
||||
} else {
|
||||
UINode * ParentLoop = getParent();
|
||||
UINode * rp = getWindowContainer();
|
||||
|
||||
@@ -145,7 +145,7 @@ void UIGridLayout::pack() {
|
||||
|
||||
UINode * ChildLoop = mChild;
|
||||
|
||||
Vector2i pos(mPadding.Left,mPadding.Top);
|
||||
Vector2f pos(mPadding.Left,mPadding.Top);
|
||||
Sizei targetSize( getTargetElementSize() );
|
||||
|
||||
if ( getHorizontalAlign() == UI_HALIGN_RIGHT )
|
||||
|
||||
@@ -99,7 +99,7 @@ void UIImage::draw() {
|
||||
calcDestSize();
|
||||
|
||||
mDrawable->setColor( mColor );
|
||||
mDrawable->draw( Vector2f( (Float)mScreenPos.x + mAlignOffset.x, (Float)mScreenPos.y + mAlignOffset.y ), mDestSize );
|
||||
mDrawable->draw( Vector2f( (Float)mScreenPosi.x + (int)mAlignOffset.x, (Float)mScreenPosi.y + (int)mAlignOffset.y ), mDestSize );
|
||||
mDrawable->clearColor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void UILinearLayout::onChildCountChange() {
|
||||
}
|
||||
|
||||
void UILinearLayout::pack() {
|
||||
setInternalPosition( Vector2i( mLayoutMargin.Left, mLayoutMargin.Top ) );
|
||||
setInternalPosition( Vector2f( mLayoutMargin.Left, mLayoutMargin.Top ) );
|
||||
|
||||
if ( mOrientation == UI_VERTICAL )
|
||||
packVertical();
|
||||
@@ -129,7 +129,7 @@ void UILinearLayout::packVertical() {
|
||||
|
||||
curY += margin.Top;
|
||||
|
||||
Vector2i pos( 0, curY );
|
||||
Vector2f pos( 0, curY );
|
||||
|
||||
if ( widget->getLayoutWeight() != 0 ) {
|
||||
Int32 totSize = ( getLayoutHeightRules() == MATCH_PARENT ) ? mSize.getHeight() : getParent()->getSize().getHeight() - mLayoutMargin.Bottom - mLayoutMargin.Top;
|
||||
@@ -243,7 +243,7 @@ void UILinearLayout::packHorizontal() {
|
||||
|
||||
curX += margin.Left;
|
||||
|
||||
Vector2i pos( curX, 0 );
|
||||
Vector2f pos( curX, 0 );
|
||||
|
||||
if ( widget->getLayoutWeight() != 0 ) {
|
||||
Int32 totSize = ( getLayoutWidthRules() == MATCH_PARENT ) ? mSize.getWidth() : getParent()->getSize().getWidth() - mLayoutMargin.Right - mLayoutMargin.Left;
|
||||
|
||||
@@ -37,7 +37,7 @@ bool UILoader::isType( const Uint32& type ) const {
|
||||
void UILoader::draw() {
|
||||
UIWidget::draw();
|
||||
|
||||
Rectf rect( Vector2f( mScreenPos.x, mScreenPos.y ), Sizef( mRealSize.x, mRealSize.y ) );
|
||||
Rectf rect( Vector2f( mScreenPosi.x, mScreenPosi.y ), Sizef( mRealSize.x, mRealSize.y ) );
|
||||
mArc.setPosition( rect.getCenter() );
|
||||
mCircle.setPosition( rect.getCenter() );
|
||||
|
||||
|
||||
@@ -584,7 +584,7 @@ void UIMenu::loadFromXmlNode( const pugi::xml_node& node ) {
|
||||
endPropertiesTransaction();
|
||||
}
|
||||
|
||||
void UIMenu::fixMenuPos( Vector2i& Pos, UIMenu * Menu, UIMenu * Parent, UIMenuSubMenu * SubMenu ) {
|
||||
void UIMenu::fixMenuPos( Vector2f& Pos, UIMenu * Menu, UIMenu * Parent, UIMenuSubMenu * SubMenu ) {
|
||||
Rectf qScreen( 0.f, 0.f, UIManager::instance()->getMainControl()->getRealSize().getWidth(), UIManager::instance()->getMainControl()->getRealSize().getHeight() );
|
||||
Rectf qPos( Pos.x, Pos.y, Pos.x + Menu->getRealSize().getWidth(), Pos.y + Menu->getRealSize().getHeight() );
|
||||
|
||||
@@ -595,10 +595,10 @@ void UIMenu::fixMenuPos( Vector2i& Pos, UIMenu * Menu, UIMenu * Parent, UIMenuSu
|
||||
addToPos.y = SubMenu->getRealSize().getHeight();
|
||||
}
|
||||
|
||||
Vector2i sPos = SubMenu->getRealPosition();
|
||||
Vector2f sPos = SubMenu->getRealPosition();
|
||||
SubMenu->nodeToWorldTranslation( sPos );
|
||||
|
||||
Vector2i pPos = Parent->getRealPosition();
|
||||
Vector2f pPos = Parent->getRealPosition();
|
||||
Parent->nodeToWorldTranslation( pPos );
|
||||
|
||||
Rectf qParent( pPos.x, pPos.y, pPos.x + Parent->getRealSize().getWidth(), pPos.y + Parent->getRealSize().getHeight() );
|
||||
|
||||
@@ -100,7 +100,7 @@ Uint32 UIMenuSubMenu::onMouseMove( const Vector2i &Pos, const Uint32 Flags ) {
|
||||
void UIMenuSubMenu::showSubMenu() {
|
||||
mSubMenu->setParent( getParent()->getParent() );
|
||||
|
||||
Vector2i Pos = this->getRealPosition();
|
||||
Vector2f Pos = getRealPosition();
|
||||
nodeToWorldTranslation( Pos );
|
||||
Pos.x += mRealSize.getWidth() + reinterpret_cast<UIMenu*> ( getParent() )->getPadding().Right;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ UINode * UINode::New() {
|
||||
|
||||
UINode::UINode() :
|
||||
mIdHash( 0 ),
|
||||
mPos( 0, 0 ),
|
||||
mDpPos( 0, 0 ),
|
||||
mRealPos( 0, 0 ),
|
||||
mSize( 0, 0 ),
|
||||
mRealSize( 0, 0 ),
|
||||
@@ -77,14 +77,14 @@ UINode::~UINode() {
|
||||
}
|
||||
}
|
||||
|
||||
void UINode::worldToNodeTranslation( Vector2i& Pos ) const {
|
||||
void UINode::worldToNodeTranslation( Vector2f& Pos ) const {
|
||||
UINode * ParentLoop = mParentCtrl;
|
||||
|
||||
Pos.x -= mRealPos.x;
|
||||
Pos.y -= mRealPos.y;
|
||||
|
||||
while ( NULL != ParentLoop ) {
|
||||
const Vector2i& ParentPos = ParentLoop->getRealPosition();
|
||||
const Vector2f& ParentPos = ParentLoop->getRealPosition();
|
||||
|
||||
Pos.x -= ParentPos.x;
|
||||
Pos.y -= ParentPos.y;
|
||||
@@ -93,11 +93,11 @@ void UINode::worldToNodeTranslation( Vector2i& Pos ) const {
|
||||
}
|
||||
}
|
||||
|
||||
void UINode::nodeToWorldTranslation( Vector2i& Pos ) const {
|
||||
void UINode::nodeToWorldTranslation( Vector2f& Pos ) const {
|
||||
UINode * ParentLoop = mParentCtrl;
|
||||
|
||||
while ( NULL != ParentLoop ) {
|
||||
const Vector2i& ParentPos = ParentLoop->getRealPosition();
|
||||
const Vector2f& ParentPos = ParentLoop->getRealPosition();
|
||||
|
||||
Pos.x += ParentPos.x;
|
||||
Pos.y += ParentPos.y;
|
||||
@@ -129,33 +129,29 @@ Uint32 UINode::onMessage( const UIMessage * Msg ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UINode::setInternalPosition( const Vector2i& Pos ) {
|
||||
mPos = Pos;
|
||||
mRealPos = Vector2i( Pos.x * PixelDensity::getPixelDensity(), Pos.y * PixelDensity::getPixelDensity() );
|
||||
void UINode::setInternalPosition( const Vector2f& Pos ) {
|
||||
mDpPos = Pos;
|
||||
mRealPos = Vector2f( Pos.x * PixelDensity::getPixelDensity(), Pos.y * PixelDensity::getPixelDensity() );
|
||||
Transformable::setPosition( mRealPos.x, mRealPos.y );
|
||||
setDirty();
|
||||
}
|
||||
|
||||
UINode * UINode::setPosition( const Vector2f& Pos ) {
|
||||
return setPosition( Vector2i( Pos.x, Pos.y ) );
|
||||
}
|
||||
|
||||
UINode * UINode::setPosition( const Vector2i& Pos ) {
|
||||
if ( Pos != mPos ) {
|
||||
if ( Pos != mDpPos ) {
|
||||
setInternalPosition( Pos );
|
||||
onPositionChange();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
UINode * UINode::setPosition( const Int32& x, const Int32& y ) {
|
||||
setPosition( Vector2i( x, y ) );
|
||||
UINode * UINode::setPosition( const Float& x, const Float& y ) {
|
||||
setPosition( Vector2f( x, y ) );
|
||||
return this;
|
||||
}
|
||||
|
||||
void UINode::setPixelsPosition( const Vector2i& Pos ) {
|
||||
void UINode::setPixelsPosition( const Vector2f& Pos ) {
|
||||
if ( mRealPos != Pos ) {
|
||||
mPos = Vector2i( PixelDensity::pxToDpI( Pos.x ), PixelDensity::pxToDpI( Pos.y ) );
|
||||
mDpPos = Vector2f( PixelDensity::pxToDp( Pos.x ), PixelDensity::pxToDp( Pos.y ) );
|
||||
mRealPos = Pos;
|
||||
Transformable::setPosition( mRealPos.x, mRealPos.y );
|
||||
setDirty();
|
||||
@@ -163,15 +159,15 @@ void UINode::setPixelsPosition( const Vector2i& Pos ) {
|
||||
}
|
||||
}
|
||||
|
||||
void UINode::setPixelsPosition( const Int32& x, const Int32& y ) {
|
||||
setPixelsPosition( Vector2i( x, y ) );
|
||||
void UINode::setPixelsPosition( const Float& x, const Float& y ) {
|
||||
setPixelsPosition( Vector2f( x, y ) );
|
||||
}
|
||||
|
||||
const Vector2i& UINode::getPosition() const {
|
||||
return mPos;
|
||||
const Vector2f& UINode::getPosition() const {
|
||||
return mDpPos;
|
||||
}
|
||||
|
||||
const Vector2i &UINode::getRealPosition() const {
|
||||
const Vector2f &UINode::getRealPosition() const {
|
||||
return mRealPos;
|
||||
}
|
||||
|
||||
@@ -247,7 +243,7 @@ void UINode::setInternalPixelsHeight( const Int32& height ) {
|
||||
}
|
||||
|
||||
Rect UINode::getRect() const {
|
||||
return Rect( mPos, mSize );
|
||||
return Rect( Vector2i( mDpPos.x, mDpPos.y ), mSize );
|
||||
}
|
||||
|
||||
const Sizei& UINode::getSize() {
|
||||
@@ -335,14 +331,14 @@ void UINode::centerHorizontal() {
|
||||
UINode * Ctrl = getParent();
|
||||
|
||||
if ( NULL != Ctrl )
|
||||
setPosition( ( Ctrl->getSize().getWidth() - mSize.getWidth() ) / 2, mPos.y );
|
||||
setPosition( ( Ctrl->getSize().getWidth() - mSize.getWidth() ) / 2, mDpPos.y );
|
||||
}
|
||||
|
||||
void UINode::centerVertical(){
|
||||
UINode * Ctrl = getParent();
|
||||
|
||||
if ( NULL != Ctrl )
|
||||
setPosition( mPos.x, ( Ctrl->getSize().getHeight() - mSize.getHeight() ) / 2 );
|
||||
setPosition( mDpPos.x, ( Ctrl->getSize().getHeight() - mSize.getHeight() ) / 2 );
|
||||
}
|
||||
|
||||
void UINode::center() {
|
||||
@@ -384,7 +380,7 @@ void UINode::drawDebugData() {
|
||||
UIWidget * me = static_cast<UIWidget*>( this );
|
||||
|
||||
if ( UIManager::instance()->getOverControl() == this ) {
|
||||
String text( String::strFormated( "X: %d Y: %d\nW: %d H: %d", mPos.x, mPos.y, mSize.x, mSize.y ) );
|
||||
String text( String::strFormated( "X: %2.4f Y: %2.4f\nW: %d H: %d", mDpPos.x, mDpPos.y, mSize.x, mSize.y ) );
|
||||
|
||||
if ( !mId.empty() ) {
|
||||
text = "ID: " + mId + "\n" + text;
|
||||
@@ -415,9 +411,9 @@ void UINode::drawSkin() {
|
||||
Sizei rSize = PixelDensity::dpToPxI( mSkinState->getSkin()->getSize( mSkinState->getState() ) );
|
||||
Sizei diff = ( mRealSize - rSize ) / 2;
|
||||
|
||||
mSkinState->draw( mScreenPosf.x + diff.x, mScreenPosf.y + diff.y, (Float)rSize.getWidth(), (Float)rSize.getHeight(), (Uint32)mAlpha );
|
||||
mSkinState->draw( mScreenPosi.x + diff.x, mScreenPosi.y + diff.y, (Float)rSize.getWidth(), (Float)rSize.getHeight(), (Uint32)mAlpha );
|
||||
} else {
|
||||
mSkinState->draw( mScreenPosf.x, mScreenPosf.y, (Float)mRealSize.getWidth(), (Float)mRealSize.getHeight(), (Uint32)mAlpha );
|
||||
mSkinState->draw( mScreenPosi.x, mScreenPosi.y, (Float)mRealSize.getWidth(), (Float)mRealSize.getHeight(), (Uint32)mAlpha );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,16 +441,16 @@ void UINode::update( const Time& time ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2i Pos( UIManager::instance()->getMousePos() );
|
||||
Vector2f Pos( UIManager::instance()->getMousePosf() );
|
||||
|
||||
if ( mDragPoint != Pos && ( abs( mDragPoint.x - Pos.x ) > PixelDensity::getPixelDensity() || abs( mDragPoint.y - Pos.y ) > PixelDensity::getPixelDensity() ) ) {
|
||||
if ( mDragPoint != Pos && ( abs( mDragPoint.x - Pos.x ) > 1 || abs( mDragPoint.y - Pos.y ) > 1 ) ) {
|
||||
if ( onDrag( Pos ) ) {
|
||||
Sizei dragDiff;
|
||||
Sizef dragDiff;
|
||||
|
||||
dragDiff.x = (Int32)( (Float)( mDragPoint.x - Pos.x ) / PixelDensity::getPixelDensity() );
|
||||
dragDiff.y = (Int32)( (Float)( mDragPoint.y - Pos.y ) / PixelDensity::getPixelDensity() );
|
||||
dragDiff.x = (Float)( mDragPoint.x - Pos.x );
|
||||
dragDiff.y = (Float)( mDragPoint.y - Pos.y );
|
||||
|
||||
setInternalPosition( mPos - dragDiff );
|
||||
setPixelsPosition( mRealPos - dragDiff );
|
||||
|
||||
mDragPoint = Pos;
|
||||
|
||||
@@ -504,7 +500,7 @@ Uint32 UINode::onMouseMove( const Vector2i& Pos, const Uint32 Flags ) {
|
||||
Uint32 UINode::onMouseDown( const Vector2i& Pos, const Uint32 Flags ) {
|
||||
if ( !( UIManager::instance()->getLastPressTrigger() & mDragButton ) && ( Flags & mDragButton ) && isDragEnabled() && !isDragging() ) {
|
||||
setDragging( true );
|
||||
mDragPoint = Pos;
|
||||
mDragPoint = Vector2f( Pos.x, Pos.y );
|
||||
}
|
||||
|
||||
sendMouseEvent( UIEvent::MouseDown, Pos, Flags );
|
||||
@@ -780,7 +776,7 @@ void UINode::onSizeChange() {
|
||||
}
|
||||
|
||||
Rectf UINode::getScreenBounds() {
|
||||
return Rectf( mScreenPosf, Sizef( (Float)mRealSize.getWidth(), (Float)mRealSize.getHeight() ) );
|
||||
return Rectf( Vector2f( mScreenPosi.x, mScreenPosi.y ), Sizef( (Float)mRealSize.getWidth(), (Float)mRealSize.getHeight() ) );
|
||||
}
|
||||
|
||||
Rectf UINode::getLocalBounds() {
|
||||
@@ -1155,26 +1151,6 @@ void UINode::onParentWindowChange() {
|
||||
}
|
||||
}
|
||||
|
||||
UINode * UINode::childGetAt( Vector2i CtrlPos, unsigned int RecursiveLevel ) {
|
||||
UINode * Ctrl = NULL;
|
||||
|
||||
for( UINode * pLoop = mChild; NULL != pLoop && NULL == Ctrl; pLoop = pLoop->mNext )
|
||||
{
|
||||
if ( !pLoop->isVisible() )
|
||||
continue;
|
||||
|
||||
if ( pLoop->getRect().contains( CtrlPos ) ) {
|
||||
if ( RecursiveLevel )
|
||||
Ctrl = childGetAt( CtrlPos - pLoop->getPosition(), RecursiveLevel - 1 );
|
||||
|
||||
if ( NULL == Ctrl )
|
||||
Ctrl = pLoop;
|
||||
}
|
||||
}
|
||||
|
||||
return Ctrl;
|
||||
}
|
||||
|
||||
Uint32 UINode::isWidget() {
|
||||
return mNodeFlags & NODE_FLAG_WIDGET;
|
||||
}
|
||||
@@ -1265,7 +1241,7 @@ void UINode::updateWorldPolygon() {
|
||||
if ( mNodeFlags & NODE_FLAG_POSITION_DIRTY )
|
||||
updateScreenPos();
|
||||
|
||||
mPoly = Polygon2f( Rectf( mScreenPosf.x, mScreenPosf.y, mScreenPosf.x + mRealSize.getWidth(), mScreenPosf.y + mRealSize.getHeight() ) );
|
||||
mPoly = Polygon2f( Rectf( mScreenPos.x, mScreenPos.y, mScreenPos.x + mRealSize.getWidth(), mScreenPos.y + mRealSize.getHeight() ) );
|
||||
|
||||
mPoly.rotate( getRotation(), getRotationCenter() );
|
||||
mPoly.scale( getScale(), getScaleCenter() );
|
||||
@@ -1283,7 +1259,7 @@ void UINode::updateWorldPolygon() {
|
||||
}
|
||||
|
||||
void UINode::updateCenter() {
|
||||
mCenter = Vector2f( mScreenPosf.x + (Float)mRealSize.getWidth() * 0.5f, mScreenPosf.y + (Float)mRealSize.getHeight() * 0.5f );
|
||||
mCenter = Vector2f( mScreenPos.x + (Float)mRealSize.getWidth() * 0.5f, mScreenPos.y + (Float)mRealSize.getHeight() * 0.5f );
|
||||
}
|
||||
|
||||
Uint32 UINode::addEventListener( const Uint32& EventType, const UIEventCallback& Callback ) {
|
||||
@@ -1457,12 +1433,12 @@ void UINode::updateScreenPos() {
|
||||
if ( !(mNodeFlags & NODE_FLAG_POSITION_DIRTY) )
|
||||
return;
|
||||
|
||||
Vector2i Pos( mRealPos.x, mRealPos.y );
|
||||
Vector2f Pos( mRealPos.x, mRealPos.y );
|
||||
|
||||
nodeToWorldTranslation( Pos );
|
||||
|
||||
mScreenPos = Pos;
|
||||
mScreenPosf = Vector2f( Pos.x, Pos.y );
|
||||
mScreenPosi = Vector2i( Pos.x, Pos.y );
|
||||
|
||||
updateCenter();
|
||||
|
||||
@@ -1690,15 +1666,15 @@ UIWindow * UINode::getOwnerWindow() {
|
||||
return mParentWindowCtrl;
|
||||
}
|
||||
|
||||
const Vector2i& UINode::getDragPoint() const {
|
||||
const Vector2f& UINode::getDragPoint() const {
|
||||
return mDragPoint;
|
||||
}
|
||||
|
||||
void UINode::setDragPoint( const Vector2i& Point ) {
|
||||
void UINode::setDragPoint( const Vector2f& Point ) {
|
||||
mDragPoint = Point;
|
||||
}
|
||||
|
||||
Uint32 UINode::onDrag( const Vector2i& Pos ) {
|
||||
Uint32 UINode::onDrag( const Vector2f& Pos ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1862,8 +1838,8 @@ Interpolation2d * UINode::startScaleAnim( const Float& From, const Float& To, co
|
||||
return startScaleAnim( Vector2f( From, From ), Vector2f( To, To ), TotalTime, Type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startTranslation( const Vector2i& From, const Vector2i& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
|
||||
Action::Move * action = Action::Move::New( Vector2f( From.x, From.y ), Vector2f( To.x, To.y ), TotalTime, Type );
|
||||
Interpolation2d * UINode::startTranslation( const Vector2f& From, const Vector2f& To, const Time& TotalTime, const Ease::Interpolation& Type, Interpolation2d::OnPathEndCallback PathEndCallback ) {
|
||||
Action::Move * action = Action::Move::New( From, To, TotalTime, Type );
|
||||
|
||||
action->getInterpolation()->setPathEndCallback( PathEndCallback );
|
||||
|
||||
@@ -1894,8 +1870,8 @@ Interpolation2d * UINode::startScaleAnim(const Float & To, const Time & TotalTim
|
||||
return startScaleAnim( getScale(), Vector2f(To,To), TotalTime, type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation2d * UINode::startTranslation(const Vector2i & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
|
||||
return startTranslation( mPos, To, TotalTime, type, PathEndCallback );
|
||||
Interpolation2d * UINode::startTranslation(const Vector2f& To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation2d::OnPathEndCallback PathEndCallback) {
|
||||
return startTranslation( mDpPos, To, TotalTime, type, PathEndCallback );
|
||||
}
|
||||
|
||||
Interpolation1d * UINode::startRotation(const Float & To, const Time & TotalTime, const Ease::Interpolation & type, Interpolation1d::OnPathEndCallback PathEndCallback) {
|
||||
@@ -1937,8 +1913,8 @@ void UINode::setRotationOriginPoint( const OriginPoint & center ) {
|
||||
Vector2f UINode::getRotationCenter() {
|
||||
switch ( mRotationOriginPoint.OriginType ) {
|
||||
case OriginPoint::OriginCenter: return mCenter;
|
||||
case OriginPoint::OriginTopLeft: return mScreenPosf;
|
||||
case OriginPoint::OriginCustom: default: return mScreenPosf + mRotationOriginPoint;
|
||||
case OriginPoint::OriginTopLeft: return mScreenPos;
|
||||
case OriginPoint::OriginCustom: default: return mScreenPos + mRotationOriginPoint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1997,8 +1973,8 @@ void UINode::setScaleOriginPoint( const OriginPoint & center ) {
|
||||
Vector2f UINode::getScaleCenter() {
|
||||
switch ( mScaleOriginPoint.OriginType ) {
|
||||
case OriginPoint::OriginCenter: return mCenter;
|
||||
case OriginPoint::OriginTopLeft: return mScreenPosf;
|
||||
case OriginPoint::OriginCustom: default: return mScreenPosf + mScaleOriginPoint;
|
||||
case OriginPoint::OriginTopLeft: return mScreenPos;
|
||||
case OriginPoint::OriginCustom: default: return mScreenPos + mScaleOriginPoint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2073,10 +2049,6 @@ Vector2f UINode::convertToWorldSpace(const Vector2f& nodePoint) {
|
||||
return getNodeToWorldTransform().transformPoint(nodePoint.x, nodePoint.y);
|
||||
}
|
||||
|
||||
void UINode::setPosition(float x, float y) {
|
||||
setPosition( Vector2f( x, y ) );
|
||||
}
|
||||
|
||||
void UINode::setScale(float factorX, float factorY) {
|
||||
setScale( Vector2f( factorX, factorY ) );
|
||||
}
|
||||
@@ -2089,4 +2061,40 @@ void UINode::setRotationOrigin(float x, float y) {
|
||||
setRotationOriginPoint( OriginPoint( x, y ) );
|
||||
}
|
||||
|
||||
float UINode::getRotation() const {
|
||||
return Transformable::getRotation();
|
||||
}
|
||||
|
||||
const Vector2f& UINode::getScale() const {
|
||||
return Transformable::getScale();
|
||||
}
|
||||
|
||||
const Vector2f& UINode::getScaleOrigin() const {
|
||||
return Transformable::getScaleOrigin();
|
||||
}
|
||||
|
||||
const Vector2f& UINode::getRotationOrigin() const {
|
||||
return Transformable::getRotationOrigin();
|
||||
}
|
||||
|
||||
void UINode::move(float offsetX, float offsetY) {
|
||||
setPosition(getPosition().x + offsetX, getPosition().y + offsetY);
|
||||
}
|
||||
|
||||
void UINode::move(const Vector2f& offset) {
|
||||
setPosition(getPosition().x + offset.x, getPosition().y + offset.y);
|
||||
}
|
||||
|
||||
void UINode::rotate(float angle) {
|
||||
setRotation(getRotation() + angle);
|
||||
}
|
||||
|
||||
void UINode::scale(float factorX, float factorY) {
|
||||
setScale(getScale().x * factorX, getScale().y * factorY);
|
||||
}
|
||||
|
||||
void UINode::scale(const Vector2f& factor) {
|
||||
setScale(getScale().x * factor.x, getScale().y * factor.y);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -70,7 +70,7 @@ void UIProgressBar::draw() {
|
||||
|
||||
for ( int y = -1; y < numTiles.y; y++ ) {
|
||||
for ( int x = -1; x < numTiles.x; x++ ) {
|
||||
mFillerSkin->draw( (Int32)mOffset.x + mScreenPos.x + fillerPadding.Left + x * rSize.getWidth(), mOffset.y + mScreenPos.y + fillerPadding.Top + y * rSize.getHeight(), rSize.getWidth(), rSize.getHeight(), 255, UISkinState::StateNormal );
|
||||
mFillerSkin->draw( (Int32)mOffset.x + mScreenPosi.x + fillerPadding.Left + x * rSize.getWidth(), mOffset.y + mScreenPosi.y + fillerPadding.Top + y * rSize.getHeight(), rSize.getWidth(), rSize.getHeight(), 255, UISkinState::StateNormal );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void UIRelativeLayout::onParentSizeChange( const Vector2i& SizeChange ) {
|
||||
}
|
||||
|
||||
void UIRelativeLayout::fixChilds() {
|
||||
setInternalPosition( Vector2i( mLayoutMargin.Left, mLayoutMargin.Top ) );
|
||||
setInternalPosition( Vector2f( mLayoutMargin.Left, mLayoutMargin.Top ) );
|
||||
|
||||
if ( getLayoutWidthRules() == MATCH_PARENT ) {
|
||||
setInternalWidth( getParent()->getSize().getWidth() - mLayoutMargin.Left - mLayoutMargin.Right );
|
||||
@@ -65,7 +65,7 @@ void UIRelativeLayout::fixChilds() {
|
||||
}
|
||||
|
||||
void UIRelativeLayout::fixChildPos( UIWidget * widget ) {
|
||||
Vector2i pos( widget->getPosition() );
|
||||
Vector2f pos( widget->getPosition() );
|
||||
|
||||
if ( widget->getLayoutPositionRule() != NONE && widget->getParent() == widget->getLayoutPositionRuleWidget()->getParent() ) {
|
||||
UIWidget * of = widget->getLayoutPositionRuleWidget();
|
||||
|
||||
@@ -52,7 +52,7 @@ void UISprite::draw() {
|
||||
if ( NULL != mSprite && 0.f != mAlpha ) {
|
||||
checkTextureRegionUpdate();
|
||||
|
||||
mSprite->setPosition( Vector2f( (Float)( mScreenPos.x + mAlignOffset.x ), (Float)( mScreenPos.y + mAlignOffset.y ) ) );
|
||||
mSprite->setPosition( Vector2f( (Float)( mScreenPosi.x + (int)mAlignOffset.x ), (Float)( mScreenPosi.y + (int)mAlignOffset.y ) ) );
|
||||
|
||||
TextureRegion * textureRegion = mSprite->getCurrentTextureRegion();
|
||||
|
||||
|
||||
@@ -98,12 +98,12 @@ void UITabWidget::draw() {
|
||||
|
||||
P.setLineWidth( PixelDensity::dpToPx( 1 ) );
|
||||
P.setColor( Color( mStyleConfig.LineBelowTabsColor, mAlpha ) );
|
||||
P.drawLine( Line2f( Vector2f( p1.x, p1.y ), Vector2f( p2.x, p2.y ) ) );
|
||||
P.drawLine( Line2f( Vector2f( (int)p1.x, (int)p1.y ), Vector2f( (int)p2.x, (int)p2.y ) ) );
|
||||
|
||||
Vector2i p3( mScreenPos.x + mTabContainer->getRealPosition().x + mTabContainer->getRealSize().getWidth(), mScreenPos.y + mTabContainer->getRealSize().getHeight() + mStyleConfig.LineBelowTabsYOffset );
|
||||
Vector2i p4( mScreenPos.x + mRealSize.getWidth(), p3.y );
|
||||
|
||||
P.drawLine( Line2f( Vector2f( p3.x, p3.y ), Vector2f( p4.x, p4.y ) ) );
|
||||
P.drawLine( Line2f( Vector2f( (int)p3.x, (int)p3.y ), Vector2f( (int)p4.x, (int)p4.y ) ) );
|
||||
|
||||
if ( smooth ) GLi->lineSmooth( true );
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ void UITextInputPassword::draw() {
|
||||
}
|
||||
|
||||
mPassCache->setAlign( getFlags() );
|
||||
mPassCache->draw( (Float)mScreenPos.x + mRealAlignOffset.x + (Float)mRealPadding.Left, (Float)mScreenPos.y + mRealAlignOffset.y + (Float)mRealPadding.Top, Vector2f::One, 0.f, getBlendMode() );
|
||||
mPassCache->draw( (Float)mScreenPosi.x + (int)mRealAlignOffset.x + (int)mRealPadding.Left, (Float)mScreenPosi.y + (int)mRealAlignOffset.y + (int)mRealPadding.Top, Vector2f::One, 0.f, getBlendMode() );
|
||||
|
||||
if ( mFlags & UI_CLIP_ENABLE ) {
|
||||
UIManager::instance()->clipSmartDisable( this );
|
||||
|
||||
@@ -116,7 +116,7 @@ void UITextureRegion::draw() {
|
||||
}
|
||||
|
||||
void UITextureRegion::drawTextureRegion() {
|
||||
mTextureRegion->draw( (Float)mScreenPos.x + mAlignOffset.x, (Float)mScreenPos.y + mAlignOffset.y, mColor, 0.f, Vector2f::One, getBlendMode(), mRender );
|
||||
mTextureRegion->draw( (Float)mScreenPosi.x + (int)mAlignOffset.x, (Float)mScreenPosi.y + (int)mAlignOffset.y, mColor, 0.f, Vector2f::One, getBlendMode(), mRender );
|
||||
}
|
||||
|
||||
void UITextureRegion::setAlpha( const Float& alpha ) {
|
||||
|
||||
@@ -65,7 +65,7 @@ void UITextView::draw() {
|
||||
}
|
||||
|
||||
mTextCache->setAlign( getFlags() );
|
||||
mTextCache->draw( (Float)mScreenPos.x + mRealAlignOffset.x + (Float)mRealPadding.Left, (Float)mScreenPos.y + mRealAlignOffset.y + (Float)mRealPadding.Top, Vector2f::One, 0.f, getBlendMode() );
|
||||
mTextCache->draw( (Float)mScreenPosi.x + (int)mRealAlignOffset.x + (int)mRealPadding.Left, (Float)mScreenPosi.y + (int)mRealAlignOffset.y + (int)mRealPadding.Top, Vector2f::One, 0.f, getBlendMode() );
|
||||
|
||||
if ( mFlags & UI_CLIP_ENABLE ) {
|
||||
UIManager::instance()->clipSmartDisable( this );
|
||||
|
||||
@@ -95,7 +95,7 @@ void UITooltip::draw() {
|
||||
|
||||
if ( mTextCache->getTextWidth() ) {
|
||||
mTextCache->setAlign( getFlags() );
|
||||
mTextCache->draw( (Float)mScreenPos.x + mAlignOffset.x, (Float)mScreenPos.y + mAlignOffset.y, Vector2f::One, 0.f, getBlendMode() );
|
||||
mTextCache->draw( (Float)mScreenPosi.x + (int)mAlignOffset.x, (Float)mScreenPosi.y + (int)mAlignOffset.y, Vector2f::One, 0.f, getBlendMode() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ void UIWidget::update( const Time& time ) {
|
||||
UIManager * uiManager = UIManager::instance();
|
||||
UIThemeManager * themeManager = UIThemeManager::instance();
|
||||
|
||||
Vector2i Pos = uiManager->getMousePos();
|
||||
Vector2f Pos = uiManager->getMousePosf();
|
||||
Pos.x += themeManager->getCursorSize().x;
|
||||
Pos.y += themeManager->getCursorSize().y;
|
||||
|
||||
@@ -160,7 +160,7 @@ void UIWidget::update( const Time& time ) {
|
||||
|
||||
if ( Time::Zero == themeManager->getTooltipTimeToShow() ) {
|
||||
if ( !mTooltip->isVisible() || themeManager->getTooltipFollowMouse() )
|
||||
mTooltip->setPosition( PixelDensity::pxToDpI( Pos ) );
|
||||
mTooltip->setPosition( PixelDensity::pxToDp( Pos ) );
|
||||
|
||||
mTooltip->show();
|
||||
} else {
|
||||
@@ -170,7 +170,7 @@ void UIWidget::update( const Time& time ) {
|
||||
|
||||
if ( mTooltip->getTooltipTime() >= themeManager->getTooltipTimeToShow() ) {
|
||||
if ( mTooltip->getTooltipTime().asMilliseconds() != -1.f ) {
|
||||
mTooltip->setPosition( PixelDensity::pxToDpI( Pos ) );
|
||||
mTooltip->setPosition( PixelDensity::pxToDp( Pos ) );
|
||||
|
||||
mTooltip->show();
|
||||
|
||||
@@ -180,7 +180,7 @@ void UIWidget::update( const Time& time ) {
|
||||
}
|
||||
|
||||
if ( themeManager->getTooltipFollowMouse() ) {
|
||||
mTooltip->setPosition( PixelDensity::pxToDpI( Pos ) );
|
||||
mTooltip->setPosition( PixelDensity::pxToDp( Pos ) );
|
||||
}
|
||||
} else {
|
||||
mTooltip->setTooltipTime( Milliseconds( 0.f ) );
|
||||
@@ -334,12 +334,12 @@ void UIWidget::updateAnchors( const Vector2i& SizeChange ) {
|
||||
Sizei newSize( mSize );
|
||||
|
||||
if ( !( mFlags & UI_ANCHOR_LEFT ) ) {
|
||||
setInternalPosition( Vector2i( mPos.x += SizeChange.x, mPos.y ) );
|
||||
setInternalPosition( Vector2f( mDpPos.x += SizeChange.x, mDpPos.y ) );
|
||||
}
|
||||
|
||||
if ( mFlags & UI_ANCHOR_RIGHT ) {
|
||||
if ( NULL != mParentCtrl ) {
|
||||
newSize.x = mParentCtrl->getSize().getWidth() - mPos.x - PixelDensity::pxToDpI( mDistToBorder.Right );
|
||||
newSize.x = mParentCtrl->getSize().getWidth() - mDpPos.x - PixelDensity::pxToDpI( mDistToBorder.Right );
|
||||
|
||||
if ( newSize.x < mMinControlSize.getWidth() )
|
||||
newSize.x = mMinControlSize.getWidth();
|
||||
@@ -347,12 +347,12 @@ void UIWidget::updateAnchors( const Vector2i& SizeChange ) {
|
||||
}
|
||||
|
||||
if ( !( mFlags & UI_ANCHOR_TOP ) ) {
|
||||
setInternalPosition( Vector2i( mPos.x, mPos.y += SizeChange.y ) );
|
||||
setInternalPosition( Vector2f( mDpPos.x, mDpPos.y += SizeChange.y ) );
|
||||
}
|
||||
|
||||
if ( mFlags & UI_ANCHOR_BOTTOM ) {
|
||||
if ( NULL != mParentCtrl ) {
|
||||
newSize.y = mParentCtrl->getSize().y - mPos.y - PixelDensity::pxToDpI( mDistToBorder.Bottom );
|
||||
newSize.y = mParentCtrl->getSize().y - mDpPos.y - PixelDensity::pxToDpI( mDistToBorder.Bottom );
|
||||
|
||||
if ( newSize.y < mMinControlSize.getHeight() )
|
||||
newSize.y = mMinControlSize.getHeight();
|
||||
@@ -364,7 +364,7 @@ void UIWidget::updateAnchors( const Vector2i& SizeChange ) {
|
||||
}
|
||||
|
||||
void UIWidget::alignAgainstLayout() {
|
||||
Vector2i pos = mPos;
|
||||
Vector2f pos = mDpPos;
|
||||
|
||||
switch ( fontHAlignGet( mLayoutGravity ) ) {
|
||||
case UI_HALIGN_CENTER:
|
||||
@@ -456,9 +456,9 @@ void UIWidget::loadFromXmlNode( const pugi::xml_node& node ) {
|
||||
if ( "id" == name ) {
|
||||
setId( ait->value() );
|
||||
} else if ( "x" == name ) {
|
||||
setInternalPosition( Vector2i( PixelDensity::toDpFromStringI( ait->as_string() ), mPos.y ) );
|
||||
setInternalPosition( Vector2f( PixelDensity::toDpFromString( ait->as_string() ), mDpPos.y ) );
|
||||
} else if ( "y" == name ) {
|
||||
setInternalPosition( Vector2i( mPos.x, PixelDensity::toDpFromStringI( ait->as_string() ) ) );
|
||||
setInternalPosition( Vector2f( mDpPos.x, PixelDensity::toDpFromString( ait->as_string() ) ) );
|
||||
} else if ( "width" == name ) {
|
||||
setInternalWidth( PixelDensity::toDpFromStringI( ait->as_string() ) );
|
||||
notifyLayoutAttrChange();
|
||||
|
||||
@@ -264,7 +264,7 @@ void UIWindow::drawFrameBuffer() {
|
||||
mFrameBuffer->draw( Rect( 0, 0, mRealSize.getWidth(), mRealSize.getHeight() ), Rect( mScreenPos.x, mScreenPos.y, mScreenPos.x + mRealSize.getWidth(), mScreenPos.y + mRealSize.getHeight() ) );
|
||||
} else {
|
||||
TextureRegion textureRegion( mFrameBuffer->getTexture()->getId(), Rect( 0, 0, mRealSize.getWidth(), mRealSize.getHeight() ) );
|
||||
textureRegion.draw( mScreenPos.x, mScreenPos.y, Color::White, getRotation(), getScale() );
|
||||
textureRegion.draw( mScreenPosi.x, mScreenPosi.y, Color::White, getRotation(), getScale() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ void UIWindow::drawShadow() {
|
||||
Color EndC( 0, 0, 0, 0 );
|
||||
Float SSize = PixelDensity::dpToPx( 16.f );
|
||||
|
||||
Vector2i ShadowPos = mScreenPos + Vector2i( 0, SSize );
|
||||
Vector2f ShadowPos = mScreenPos + Vector2f( 0, SSize );
|
||||
|
||||
P.drawRectangle( Rectf( Vector2f( ShadowPos.x, ShadowPos.y ), Sizef( mRealSize.getWidth(), mRealSize.getHeight() ) ), BeginC, BeginC, BeginC, BeginC );
|
||||
|
||||
@@ -395,12 +395,12 @@ void UIWindow::onContainerPositionChange( const UIEvent * Event ) {
|
||||
if ( NULL == mContainer )
|
||||
return;
|
||||
|
||||
Vector2i PosDiff = mContainer->getPosition() - Vector2i( NULL != mBorderLeft ? mBorderLeft->getSize().getWidth() : 0, NULL != mWindowDecoration ? mWindowDecoration->getSize().getHeight() : 0 );
|
||||
Vector2f PosDiff = mContainer->getPosition() - Vector2f( NULL != mBorderLeft ? mBorderLeft->getSize().getWidth() : 0, NULL != mWindowDecoration ? mWindowDecoration->getSize().getHeight() : 0 );
|
||||
|
||||
if ( PosDiff.x != 0 || PosDiff.y != 0 ) {
|
||||
mContainer->setPosition( NULL != mBorderLeft ? mBorderLeft->getSize().getWidth() : 0, NULL != mWindowDecoration ? mWindowDecoration->getSize().getHeight() : 0 );
|
||||
|
||||
setPosition( mPos + PosDiff );
|
||||
setPosition( mDpPos + PosDiff );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1174,9 +1174,9 @@ void UIWindow::matrixSet() {
|
||||
mFrameBuffer->clear();
|
||||
}
|
||||
|
||||
if ( 0 != mScreenPos ) {
|
||||
if ( 0.f != mScreenPos ) {
|
||||
GLi->pushMatrix();
|
||||
GLi->translatef( -mScreenPos.x , -mScreenPos.y, 0.f );
|
||||
GLi->translatef( -mScreenPosi.x , -mScreenPosi.y, 0.f );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1188,7 +1188,7 @@ void UIWindow::matrixUnset() {
|
||||
if ( ownsFrameBuffer() ) {
|
||||
GlobalBatchRenderer::instance()->draw();
|
||||
|
||||
if ( 0 != mScreenPos )
|
||||
if ( 0.f != mScreenPos )
|
||||
GLi->popMatrix();
|
||||
|
||||
if ( mFrameBufferBound ) {
|
||||
|
||||
@@ -183,7 +183,7 @@ Uint32 UIWinMenu::onMessage( const UIMessage * Msg ) {
|
||||
UISelectButton * tbut = reinterpret_cast<UISelectButton*> ( Msg->getSender() );
|
||||
UIPopUpMenu * tpop = getMenuFromButton( tbut );
|
||||
|
||||
Vector2i pos( tbut->getPosition().x, tbut->getPosition().y + tbut->getSize().getHeight() );
|
||||
Vector2f pos( tbut->getPosition().x, tbut->getPosition().y + tbut->getSize().getHeight() );
|
||||
tpop->setPosition( pos );
|
||||
|
||||
if ( Msg->getMsg() == UIMessage::MouseEnter ) {
|
||||
|
||||
@@ -390,7 +390,7 @@ void EETest::createUI() {
|
||||
UIWindow * tWin = UIWindow::New();
|
||||
tWin->setSize( 530, 405 )->setPosition( 320, 240 );
|
||||
UIWindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
windowStyleConfig.WinFlags = UI_WIN_DRAGABLE_CONTAINER | UI_WIN_SHADOW | UI_WIN_FRAME_BUFFER;
|
||||
windowStyleConfig.WinFlags = UI_WIN_DRAGABLE_CONTAINER | UI_WIN_SHADOW/* | UI_WIN_FRAME_BUFFER*/;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 530, 405 );
|
||||
windowStyleConfig.BaseAlpha = 200;
|
||||
tWin->setStyleConfig( windowStyleConfig );
|
||||
@@ -884,7 +884,7 @@ void EETest::createMapEditor() {
|
||||
UIWindow * tWin = UIWindow::New();
|
||||
tWin->setSizeWithDecoration( 1024, 768 )->setPosition( 0, 0 );
|
||||
UIWindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
windowStyleConfig.WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER | UI_WIN_SHADOW | UI_WIN_FRAME_BUFFER;
|
||||
windowStyleConfig.WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER | UI_WIN_SHADOW/* | UI_WIN_FRAME_BUFFER*/;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 1024, 768 );
|
||||
tWin->setStyleConfig( windowStyleConfig );
|
||||
|
||||
@@ -901,7 +901,7 @@ void EETest::createETGEditor() {
|
||||
UIWindow * tWin = UIWindow::New();
|
||||
tWin->setSizeWithDecoration( 1024, 768 )->setPosition( 0, 0 );
|
||||
UIWindowStyleConfig windowStyleConfig = tWin->getStyleConfig();
|
||||
windowStyleConfig.WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER | UI_WIN_SHADOW | UI_WIN_FRAME_BUFFER;
|
||||
windowStyleConfig.WinFlags = UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_DRAGABLE_CONTAINER | UI_WIN_SHADOW/* | UI_WIN_FRAME_BUFFER*/;
|
||||
windowStyleConfig.MinWindowSize = Sizei( 1024, 768 );
|
||||
tWin->setStyleConfig( windowStyleConfig );
|
||||
|
||||
@@ -936,7 +936,7 @@ static void onWinDragStop( const UIEvent * event ) {
|
||||
|
||||
void EETest::createDecoratedWindow() {
|
||||
mUIWindow = UIBlurredWindow::New( mBlur );
|
||||
mUIWindow->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_SHADOW | UI_WIN_FRAME_BUFFER )
|
||||
mUIWindow->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_SHADOW/* | UI_WIN_FRAME_BUFFER*/ )
|
||||
->setMinWindowSize( 530, 350 )->setPosition( 200, 50 );
|
||||
|
||||
mUIWindow->addEventListener( UIEvent::OnWindowClose, cb::Make1( this, &EETest::onCloseClick ) );
|
||||
@@ -1105,9 +1105,9 @@ void EETest::onQuitClick( const UIEvent * Event ) {
|
||||
|
||||
void EETest::showMenu() {
|
||||
if ( Menu->show() ) {
|
||||
Vector2i Pos = mWindow->getInput()->getMousePos();
|
||||
Vector2f Pos = mWindow->getInput()->getMousePosf();
|
||||
UIMenu::fixMenuPos( Pos , Menu );
|
||||
Menu->setPosition( Sizei( (Float)Pos.x / PixelDensity::getPixelDensity(), (Float)Pos.y / PixelDensity::getPixelDensity() ) );
|
||||
Menu->setPosition( Vector2f( Pos.x / PixelDensity::getPixelDensity(), Pos.y / PixelDensity::getPixelDensity() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1131,8 +1131,8 @@ void EETest::onButtonClick( const UIEvent * Event ) {
|
||||
Gfx->runAction( Sequence::New( Scale::New( Vector2f(1.f,1.f), Vector2f(2.f,2.f), Seconds( 0.5f ) ),
|
||||
Scale::New( Vector2f(2.f,2.f), Vector2f(1.f,1.f), Seconds( 0.5f ) )
|
||||
) );
|
||||
Gfx->startRotation( 0, 2500, Milliseconds( 2500 ) );
|
||||
Gfx->startTranslation( Vector2i( Math::randi( 0, mWindow->getWidth() ), -64 ), Vector2i( Math::randi( 0, mWindow->getWidth() ), mWindow->getHeight() + 64 ), Milliseconds( 2500 ) );
|
||||
Gfx->startRotation( 0.f, 2500.f, Milliseconds( 2500 ) );
|
||||
Gfx->startTranslation( Vector2f( Math::randi( 0, mWindow->getWidth() ), -64 ), Vector2f( Math::randi( 0, mWindow->getWidth() ), mWindow->getHeight() + 64 ), Milliseconds( 2500 ) );
|
||||
Gfx->closeFadeOut( Milliseconds( 3500 ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user