コード例 #1
0
sRect CCBFrameLook::GetClientRect(CCFrame* pFrame, sRect& r)
{
    if(GetCustomLook() == 1)
    {
        int al = FRAME_OUTLINE_WIDTH+FRAME_WIDTH+FRAME_INLINE_WIDTH+RECT_DEFAULT_SPACE;
        int au = m_pFrameBitmaps[7]->GetHeight() + FRAME_OUTLINE_WIDTH + FRAME_INLINE_WIDTH+RECT_DEFAULT_SPACE;
        return sRect(r.x+al, r.y+au, r.w-(al*2), r.h-(al+au));
    }
    if( GetCustomLook() == 2 )
    {
#define CUSTOM2_FRAME_OFFSET_WIDTH 2
#define CUSTOM2_FRAME_OFFSET_HEIGHT 10
        return sRect(r.x + CUSTOM2_FRAME_OFFSET_WIDTH, r.y + CUSTOM2_FRAME_OFFSET_HEIGHT , r.w - 2 * CUSTOM2_FRAME_OFFSET_WIDTH, r.h - 2 * CUSTOM2_FRAME_OFFSET_HEIGHT);
    }
    else
    {
        if(IsNull(m_pFrameBitmaps, FRAME_BITMAP_COUNT)==true) return r;

        float fScale = GetScale();
        int al = (int)(fScale * m_pFrameBitmaps[3]->GetWidth());
        int au = (int)(fScale * m_pFrameBitmaps[7]->GetHeight());
        int ar = (int)(fScale * m_pFrameBitmaps[5]->GetWidth());
        int ab = (int)(fScale * m_pFrameBitmaps[1]->GetHeight());
        return sRect(r.x+al, r.y+au, r.w-(al+ar), r.h-(au+ab));
    }
}
コード例 #2
0
ファイル: NSpace.cpp プロジェクト: ZenX2/Astrostruct
NStar::NStar() : NNode(NodeStar)
{
    Texture = NULL;
    Changed = true;
    glGenBuffers(2,Buffers);
    Shader = GetGame()->GetRender()->GetShader("flat");
    if (Shader != NULL)
    {
        MatrixLoc = Shader->GetUniformLocation("Model");
        TextureLoc = Shader->GetUniformLocation("Texture");
        ColorLoc = Shader->GetUniformLocation("Color");
    }
    Texture = GetGame()->GetRender()->GetTexture("star");
    if (Texture)
    {
        unsigned int AnimationCount = Texture->GetAnimationCount();
        Texture->Play(rand()%AnimationCount);
    }
    float Size = Rand(5,32);
    SetScale(glm::vec3(Size,Size,1));
    //float Rot = Rand(0,360);
    //SetAng(glm::vec3(0,0,Rot));
    SetParent(GetGame()->GetRender()->GetCamera());
    SetPos(glm::vec3(GetGame()->GetWindowWidth()+GetScale().x,Rand(0,GetGame()->GetWindowHeight()),0));
}
コード例 #3
0
    void SComboBase::DropDown()
    {
        if(m_dwBtnState==WndState_PushDown) return;


        if(!m_pDropDownWnd)
        {
            m_pDropDownWnd = new SDropDownWnd_ComboBox(this);
            m_pDropDownWnd->SDispatchMessage(UM_SETSCALE, GetScale(), 0);
		}

		EventCBDropdown evt(this);
		evt.pDropDown = m_pDropDownWnd;
		FireEvent(evt);

		CRect rcPopup;
		BOOL bDown=CalcPopupRect(GetListBoxHeight(),rcPopup);
		m_pDropDownWnd->Create(rcPopup,0);

		if(m_nAnimTime>0)
			m_pDropDownWnd->AnimateHostWindow(m_nAnimTime,AW_SLIDE|(bDown?AW_VER_POSITIVE:AW_VER_NEGATIVE));
		else
			m_pDropDownWnd->SetWindowPos(HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);

		m_pDropDownWnd->CSimpleWnd::SetCapture();
	}
コード例 #4
0
ファイル: BCGPKnob.cpp プロジェクト: iclosure/jframework
//*******************************************************************************
void CBCGPKnob::SetPointer(const CBCGPKnobPointer& pointer, BOOL bRedraw)
{
    CBCGPCircularGaugeScale* pScale = GetScale(0);
    if (pScale == NULL)
    {
        ASSERT(FALSE);
        return;
    }

    double dblVal = pScale->GetStart();

    if (m_arData.GetSize() > 0)
    {
        dblVal = GetValue();

        delete m_arData[0];
        m_arData.RemoveAt(0);
    }

    CBCGPKnobPointer* pData = new CBCGPKnobPointer;
    pData->CopyFrom(pointer);

    pData->SetValue(dblVal);

    AddData(pData);

    if (bRedraw)
    {
        Redraw();
    }
}
コード例 #5
0
ファイル: OTOffer.cpp プロジェクト: yamamushi/opentxs
void OTOffer::UpdateContents()
{
    const String NOTARY_ID(GetNotaryID()),
        INSTRUMENT_DEFINITION_ID(GetInstrumentDefinitionID()),
        CURRENCY_TYPE_ID(GetCurrencyID());

    // I release this because I'm about to repopulate it.
    m_xmlUnsigned.Release();

    Tag tag("marketOffer");

    tag.add_attribute("version", m_strVersion.Get());

    tag.add_attribute("isSelling", formatBool(!IsBid()));
    tag.add_attribute("notaryID", NOTARY_ID.Get());
    tag.add_attribute("instrumentDefinitionID", INSTRUMENT_DEFINITION_ID.Get());
    tag.add_attribute("currencyTypeID", CURRENCY_TYPE_ID.Get());
    tag.add_attribute("priceLimit", formatLong(GetPriceLimit()));
    tag.add_attribute("totalAssetsOnOffer",
                      formatLong(GetTotalAssetsOnOffer()));
    tag.add_attribute("finishedSoFar", formatLong(GetFinishedSoFar()));
    tag.add_attribute("marketScale", formatLong(GetScale()));
    tag.add_attribute("minimumIncrement", formatLong(GetMinimumIncrement()));
    tag.add_attribute("transactionNum", formatLong(GetTransactionNum()));
    tag.add_attribute("validFrom", formatTimestamp(GetValidFrom()));
    tag.add_attribute("validTo", formatTimestamp(GetValidTo()));

    std::string str_result;
    tag.output(str_result);

    m_xmlUnsigned.Concatenate("%s", str_result.c_str());
}
コード例 #6
0
ファイル: HeadBobMgr.cpp プロジェクト: Arc0re/lithtech
LTVector HeadBobMgr::GetWeaponRotations() const
{
	LTVector v(	m_aAmpsActive[ HBE_WEAPONROTATION_X ],
				m_aAmpsActive[ HBE_WEAPONROTATION_Y ],
				m_aAmpsActive[ HBE_WEAPONROTATION_Z ] );

	return ( v * GetScale() );
}
コード例 #7
0
Yarn::Yarn() :
	mMuzzleSpeed( 400.f ),
	mVelocity( Vector3::Zero ),
	mPlayerId( 0 )
{
	SetScale( GetScale() * .02f );
	SetCollisionRadius( 15.f );
}
コード例 #8
0
ファイル: Yarn.cpp プロジェクト: caldera/MultiplayerBook
Yarn::Yarn() :
	mVelocity( Vector3::Zero )
{
	SetScale( GetScale() * 0.25f );
	SetCollisionRadius( 0.125f );
	mSpriteComponent = std::make_shared<SpriteComponent>( this );
	mSpriteComponent->SetTexture( TextureManager::sInstance->GetTexture( "yarn" ) );
}
コード例 #9
0
ファイル: HeadBobMgr.cpp プロジェクト: Arc0re/lithtech
LTVector HeadBobMgr::GetCameraRotations() const
{
	LTVector v(	m_aAmpsActive[ HBE_CAMERAROTATION_X ],
				m_aAmpsActive[ HBE_CAMERAROTATION_Y ],
				m_aAmpsActive[ HBE_CAMERAROTATION_Z ] );

	return ( v * GetScale() );
}
コード例 #10
0
ファイル: Scene.cpp プロジェクト: 373137461/OBS
Vect4 SceneItem::GetCrop()
{
    Vect4 scaledCrop = crop;
    Vect2 scale = GetScale();
    scaledCrop.x /= scale.x; scaledCrop.y /= scale.y;
    scaledCrop.z /= scale.y; scaledCrop.w /= scale.x;
    return scaledCrop;
}
コード例 #11
0
ファイル: HeadBobMgr.cpp プロジェクト: Arc0re/lithtech
LTVector HeadBobMgr::GetCameraOffsets() const
{
	LTVector v(	m_aAmpsActive[ HBE_CAMERAOFFSET_X ],
				m_aAmpsActive[ HBE_CAMERAOFFSET_Y ],
				m_aAmpsActive[ HBE_CAMERAOFFSET_Z ] );

	return ( v * GetScale() );
}
コード例 #12
0
ファイル: HeadBobMgr.cpp プロジェクト: Arc0re/lithtech
LTVector HeadBobMgr::GetWeaponOffsets() const
{
	LTVector v(	m_aAmpsActive[ HBE_WEAPONOFFSET_X ],
				m_aAmpsActive[ HBE_WEAPONOFFSET_Y ],
				m_aAmpsActive[ HBE_WEAPONOFFSET_Z ] );

	return ( v * GetScale() );
}
コード例 #13
0
ファイル: Matrix22.cpp プロジェクト: LenihanConor/Cluiche
		//-----------------------------------------------------------------------------
		bool Matrix22::IsUniformScale()const
		{
			float xScale, yScale = 0.0f;
			GetScale(xScale, yScale);

			return (!Dia::Maths::Float::FEqual(xScale, 1.0f) && 
					!Dia::Maths::Float::FEqual(yScale, 1.0f) &&
					Dia::Maths::Float::FEqual(xScale, yScale));
		}
コード例 #14
0
void Entity::SetRotation(float a_fRotation)
{
	Vector3 vPosition = GetPosition();
	Vector3 vScale = GetScale();

	m_oLocalTransform = Matrix3x3::setupTranslation(vPosition)
		* Matrix3x3::setupRotation(a_fRotation)
		* Matrix3x3::setupScale(vScale);
}
コード例 #15
0
sRect CCBButtonLook::GetClientRect(CCButton* pButton, sRect& r)
{
	float fScale = GetScale();

	int al = (int)(fScale * GETWIDTH(m_pUpBitmaps[3]));
	int au = (int)(fScale * GETHEIGHT(m_pUpBitmaps[7]));
	int ar = (int)(fScale * GETWIDTH(m_pUpBitmaps[5]));
	int ab = (int)(fScale * GETHEIGHT(m_pUpBitmaps[1]));
	return sRect(r.x+al, r.y+au, r.w-(al+ar), r.h-(au+ab));
}
コード例 #16
0
ファイル: wxtxtprint.cpp プロジェクト: msperl/Period
void wxTextPrintout::NextTab(float *x, int /* tabcount */)
{
  float tab=0.0f;
  while (tab<*x)
    {
      tab+=GetTabSize()*GetScale();
    }
  // return the new Value
  *x=tab;
}
コード例 #17
0
ファイル: GUITexture.cpp プロジェクト: heyx3/K1LL
Box2D GUITexture::GetBounds(void) const
{
    Vector2f dims = GetScale();
    if (tex != 0)
    {
        if (rotation == 0.0f)
        {
            dims = ToV2f(Vector2u(tex->GetWidth(), tex->GetHeight()));
            dims.MultiplyComponents(GetScale());
        }
        else
        {
            float diameter = 2.0f * ToV2f(Vector2u(tex->GetWidth(), tex->GetHeight())).Length();
            dims = Vector2f(diameter, diameter);
        }
    }

    return Box2D(Vector2f(), dims);
}
コード例 #18
0
	//get the inverse transform matrix
	mat4f  PhysicsComponent::GetInverse()
	{
		mat4f trans;
		vec3f rot = GetRotation();
		vec3f pos = GetPosition();
		pos.x *= -1;

        mat4f::Inverse(pos * Config::s_PPM, rot.x, rot.y, rot.z, GetScale(), &trans);
		return trans;
	}
コード例 #19
0
	int SComboBox::GetListBoxHeight()
	{
		int nDropHeight=m_nDropHeight.toPixelSize(GetScale());
		if(GetCount()) 
		{
			int nItemHeight=m_pListBox->GetItemHeight();
			CRect rcMargin = m_pListBox->GetStyle().GetMargin();
			nDropHeight = (std::min)(nDropHeight,(int)(nItemHeight*GetCount()+rcMargin.top + rcMargin.bottom));
		}
		return nDropHeight;    
	}
コード例 #20
0
ファイル: animation.cpp プロジェクト: Dingf/Paper-TD
void Animation::DrawAnimation(const Point2D& position)
{
	Point2D sCenter = position + scalingCenter - offset;
	Point2D rCenter = position + rotationCenter - offset;

	sprite->DrawSprite(bounds, position - offset, sCenter, rCenter, GetScale(), GetRotation(), ColorARGB(GetOpacity(), color.GetR(), color.GetG(), color.GetB()));

	SetFloatValue(ANIM_VAR_SCALE, 0);
	SetFloatValue(ANIM_VAR_OPACITY, 0);
	SetFloatValue(ANIM_VAR_ROTATION, 0);
}
コード例 #21
0
OpRect WidgetThumbnailGenerator::ScaleRect(const OpRect& rect)
{
	int scale = GetScale();

	OpRect scaled_rect(rect.x * scale / 100,
					   rect.y * scale / 100,
					   rect.width * scale / 100,
					   rect.height * scale / 100);

	return scaled_rect;
}
コード例 #22
0
ファイル: Matrix.cpp プロジェクト: Fat-Zer/FreeCAD_sf_master
	bool	Matrix::GetScale(double& sx) const
	{
		// return a uniform scale  (false if differential)
		double sy, sz;
		if(m_unit) {
			sx = 1;
			return true;
		}
		GetScale(sx, sy, sz);
		return (fabs(fabs(sx) - fabs(sy)) < 0.000001)?true : false;
	}
コード例 #23
0
ファイル: View.cpp プロジェクト: joewan/pycmake
//------------------------------------------------------------------------
void CView::SetViewShakeEx( const SShakeParams &params )
{
	float shakeMult = GetScale();
	if (shakeMult < 0.001f)
		return;

	int     shakes(m_shakes.size());
	SShake* pSetShake(nullptr);

	for (int i = 0; i < shakes; ++i)
	{
		SShake* pShake = &m_shakes[i];
		if (pShake->ID == params.shakeID)
		{
			pSetShake = pShake;
			break;
		}
	}

	if (!pSetShake)
	{
		m_shakes.push_back(SShake(params.shakeID));
		pSetShake = &m_shakes.back();
	}

	if (pSetShake)
	{
		// this can be set dynamically
		pSetShake->frequency = max(0.00001f, params.frequency);

		// the following are set on a 'new' shake as well
		if (params.bUpdateOnly == false)
		{
			pSetShake->amount               = params.shakeAngle * shakeMult;
			pSetShake->amountVector         = params.shakeShift * shakeMult;
			pSetShake->randomness           = params.randomness;
			pSetShake->doFlip               = params.bFlipVec;
			pSetShake->groundOnly           = params.bGroundOnly;
			pSetShake->isSmooth             = params.isSmooth;
			pSetShake->permanent            = params.bPermanent;
			pSetShake->fadeInDuration       = params.fadeInDuration;
			pSetShake->sustainDuration      = params.sustainDuration;
			pSetShake->fadeOutDuration      = params.fadeOutDuration;
			pSetShake->timeDone             = 0;
			pSetShake->updating             = true;
			pSetShake->interrupted          = false;
			pSetShake->goalShake            = Quat(ZERO);
			pSetShake->goalShakeSpeed       = Quat(ZERO);
			pSetShake->goalShakeVector      = Vec3(ZERO);
			pSetShake->goalShakeVectorSpeed = Vec3(ZERO);
			pSetShake->nextShake            = 0.0f;
		}
	}
}
コード例 #24
0
ファイル: Sprite.cpp プロジェクト: Teivaz/OctoBoom
void Sprite::Draw(Renderer& renderer)
{
    if(!IsEnabled())
        return;
    
    mat3f t = GetGlobalTransformation();
    bool scaled = GetScale() != vec2f(1);
    renderer.DrawImage(m_image, t, scaled);
    
    Node::Draw(renderer);
}
コード例 #25
0
ファイル: PhysicsSystem.cpp プロジェクト: kelkka/Agile
void PhysicsSystem::OnEntityAdded(Entity* _entity)
{
	auto collision = _entity->GetComponent<CollisionComponent>();
	auto position = _entity->GetComponent<PositionComponent>();
	auto velocity = _entity->GetComponent<VelocityComponent>();
	auto rotation = _entity->GetComponent<RotationComponent>();
	auto scale = _entity->GetComponent<ScaleComponent>();

	if (scale && (scale->GetScale().x != 1 || scale->GetScale().y != 1))
	{
		auto fixDefs = collision->GetFixtureDefs();
		for (auto it = fixDefs.begin(); it != fixDefs.end(); ++it)
		{
			b2FixtureDef* fix = *it;
			if (fix->shape->m_type == b2Shape::Type::e_polygon)
			{
				b2PolygonShape* polygonShape = (b2PolygonShape*)fix->shape;

				for (int i = 0; i < polygonShape->GetVertexCount(); ++i)
                                    polygonShape->m_vertices[i] = b2Vec2(polygonShape->m_vertices[i].x * scale->GetScale().x, polygonShape->m_vertices[i].y * scale->GetScale().y);
			}
			else if (fix->shape->m_type == b2Shape::Type::e_circle)
			{
				b2CircleShape* circleShape = (b2CircleShape*)fix->shape;
				if (scale->GetScale().x > scale->GetScale().y)
					circleShape->m_radius *= scale->GetScale().x;
				else
					circleShape->m_radius *= scale->GetScale().y;
			}
		}
	}
	if (position)
		collision->GetBodyDef()->position = b2Vec2(position->GetPosition().x, position->GetPosition().y);
	if (velocity)
		collision->GetBodyDef()->linearVelocity = b2Vec2(velocity->m_velocity.x, velocity->m_velocity.y);
	if (rotation)
		collision->GetBodyDef()->angle = rotation->GetRotation().z;
	
	collision->CreateBody(m_b2World);
}
コード例 #26
0
ファイル: FileIO.cpp プロジェクト: xzrunner/easyeditor
void FileIO::Store(const char* filename, LibraryPanel* library,
				   StagePanel* stage, ee::GroupTreePanel* grouptree)
{
	Json::Value value;

	SettingCfg* cfg = SettingCfg::Instance();

	std::string dir = ee::FileHelper::GetFileDir(filename) + "\\";

	// settings
	value["settings"]["terrain2d"] = cfg->m_terrain2d_anim;

	// size
	value["size"]["width"] = cfg->m_map_width;
	value["size"]["height"] = cfg->m_map_height;
	value["size"]["view width"] = cfg->m_view_width;
	value["size"]["view height"] = cfg->m_view_height;
	value["size"]["view offset x"] = cfg->m_view_dx;
	value["size"]["view offset y"] = cfg->m_view_dy;

	// camera
	auto canvas = std::dynamic_pointer_cast<ee::CameraCanvas>(stage->GetCanvas());
	if (canvas->GetCamera()->Type() == s2::CAM_ORTHO2D)
	{
		auto cam = std::dynamic_pointer_cast<s2::OrthoCamera>(canvas->GetCamera());
		value["camera"]["scale"] = cam->GetScale();
		value["camera"]["x"] = cam->GetPosition().x;
		value["camera"]["y"] = cam->GetPosition().y;
	}

	// screen
	value["screen"]["multi_col"] = gum::color2str(stage->GetScreenMultiColor(), s2s::RGBA);
	value["screen"]["add_col"]   = gum::color2str(stage->GetScreenAddColor(), s2s::RGBA);
	if (!cfg->m_post_effect_file.empty()) {
		value["screen"]["post effect"] = ee::FileHelper::GetRelativePath(dir, cfg->m_post_effect_file);
	}

	// layers
	StoreLayers(value["layer"], stage->GetLayers(), dir);

	// libraries
	library->StoreToFile(value["library"], dir);

	Json::StyledStreamWriter writer;
	std::locale::global(std::locale(""));
	std::ofstream fout(filename);
	std::locale::global(std::locale("C"));	
	writer.write(fout, value);
	fout.close();

	wxMessageBox("Success");
}
コード例 #27
0
ファイル: Node.cpp プロジェクト: dreamsxin/nsg-library
 void Node::Save(pugi::xml_node& node) const
 {
     node.append_attribute("name").set_value(GetName().c_str());
     auto position = GetPosition();
     if (position != VECTOR3_ZERO)
         node.append_attribute("position").set_value(ToString(position).c_str());
     auto orientation = GetOrientation();
     if (orientation != QUATERNION_IDENTITY)
         node.append_attribute("orientation").set_value(ToString(orientation).c_str());
     auto scale = GetScale();
     if (scale != VECTOR3_ONE)
         node.append_attribute("scale").set_value(ToString(scale).c_str());
 }
コード例 #28
0
void RightPopupMenu::VertMirror()
{
	bool dirty = false;
	for (size_t i = 0, n = m_edited_sprs.size(); i < n; ++i) {
		auto spr = m_edited_sprs[i];
		const sm::vec2& scale = spr->GetScale();
		spr->SetScale(sm::vec2(scale.x, -scale.y));
		dirty = true;
	}
	if (dirty) {
		SetCanvasDirtySJ::Instance()->SetDirty();
	}
}
コード例 #29
0
ファイル: GameObject.cpp プロジェクト: a-roy/blobcast
void GameObject::SetShape(Shape p_shapeType)
{
	glm::vec3 translation = GetTranslation();
	glm::quat orientation = GetOrientation();
	glm::vec3 scale = GetScale();

	//TODO: if not in dynamics world
		Physics::dynamicsWorld->removeRigidBody(rigidbody);
		delete rigidbody;
	
	SetShape(translation, orientation, scale,
		p_shapeType);
}
コード例 #30
0
ファイル: NButton.cpp プロジェクト: Tamschi/Astrostruct
void NButton::SetText(std::wstring Text)
{
    if (DisplayText == NULL)
    {
        DisplayText = new NText("didactgothic",Text);
        DisplayText->SetMode(1);
        DisplayText->SetSize(GetScale().y/1.3);
        DisplayText->SetParent(this);
        DisplayText->SetPos(glm::vec3(0,4,0));
        return;
    }
    DisplayText->SetText(Text);
}