コード例 #1
0
ファイル: adjust.c プロジェクト: DanielEColi/graphviz
/* chkBoundBox:
 *   Compute extremes of graph, then set up bounding box.
 *   If user supplied a bounding box, use that;
 *   else if "window" is a graph attribute, use that; 
 *   otherwise, define bounding box as a percentage expansion of
 *   graph extremes.
 *   In the first two cases, check that graph fits in bounding box.
 */
static void chkBoundBox(Agraph_t * graph)
{
    char *marg;
    Point ll, ur;
    int i;
    double x, y;
    double xmin, xmax, ymin, ymax;
    double xmn, xmx, ymn, ymx;
    double ydelta, xdelta;
    Info_t *ip;
    Poly *pp;
    /* int          cnt; */

    ip = nodeInfo;
    pp = &ip->poly;
    x = ip->site.coord.x;
    y = ip->site.coord.y;
    xmin = pp->origin.x + x;
    ymin = pp->origin.y + y;
    xmax = pp->corner.x + x;
    ymax = pp->corner.y + y;
    for (i = 1; i < nsites; i++) {
	ip++;
	pp = &ip->poly;
	x = ip->site.coord.x;
	y = ip->site.coord.y;
	xmn = pp->origin.x + x;
	ymn = pp->origin.y + y;
	xmx = pp->corner.x + x;
	ymx = pp->corner.y + y;
	if (xmn < xmin)
	    xmin = xmn;
	if (ymn < ymin)
	    ymin = ymn;
	if (xmx > xmax)
	    xmax = xmx;
	if (ymx > ymax)
	    ymax = ymx;
    }

    marg = agget(graph, "voro_margin");
    if (marg && (*marg != '\0')) {
	margin = atof(marg);
    }
    ydelta = margin * (ymax - ymin);
    xdelta = margin * (xmax - xmin);
    ll.x = xmin - xdelta;
    ll.y = ymin - ydelta;
    ur.x = xmax + xdelta;
    ur.y = ymax + ydelta;

    setBoundBox(&ll, &ur);
}
コード例 #2
0
//캐릭터 생성함수
void CBaseChar::makeChar(const char * playerName, int x, int y)
{
	std::string path;
	path.append("Resource/Char/");
	path.append(playerName);
	path.append("/");

	std::string bodypath;
	bodypath = path + "idel_0.png";
	m_pBody = CSprite::create(bodypath.c_str());

	std::string armpath;
	armpath = path;

	switch(m_eNowWeapon)
	{
	case Weapon_Nomal:
		armpath.append("handgun_1.png");
		break;
	case Weapon_Double:
		armpath.append("handgun_2.png");
		break;
	case Weapon_Tripel:
		armpath.append("handgun_3.png");
		break;
	case Weapon_Multiple:
		armpath.append("itemgun_1.png");
		break;
	case Weapon_BigMulti:
		armpath.append("itemgun_2.png");
		break;
	}


	m_pArm = CSprite::create(armpath.c_str());
	m_pBody->setAcp(ccp(0.5,0.5));
	m_pBody->setPos(ccp(0,0));
	addChild(m_pBody);
	m_pArm->setAcp(ccp(0.5,0.5));
	m_pArm->setPos(ccp(x,y));
	//setRect(m_pBody->getRect());
	setAcp(ccp(0.5,0.5));
	setBoundBox(m_pBody->getRect());
	addChild(m_pArm);

	m_pIdel = makeAnimation(path.c_str(),"idel",true,2);
	m_pWalk = makeAnimation(path.c_str(),"run",true,4);
	m_pDie = makeAnimation(path.c_str(),"die",false,1);

	m_pNowAni = m_pIdel;
}
コード例 #3
0
// Construct from components
polyForceTwoShear::polyForceTwoShear
(
    Time& t,
    polyMoleculeCloud& molCloud,
    const dictionary& dict
)
:
    polyStateController(t, molCloud, dict),
    propsDict_(dict.subDict(typeName + "Properties")),

    molIds_(),
    forceMagLiquid_(propsDict_.lookup("forceLiquid"))
{

    writeInTimeDir_ = true;
    writeInCase_ = true;

//     singleValueController() = true;
    
    setBoundBox(propsDict_, bb_liquid_A_, "liquidA");
    setBoundBox(propsDict_, bb_liquid_B_, "liquidB");    
    setBoundBox(propsDict_, bb_gas_A_, "gasA");
    setBoundBox(propsDict_, bb_gas_B_, "gasB");

    molIds_.clear();

    selectIds ids
    (
        molCloud_.cP(),
        propsDict_
    );

    molIds_ = ids.molIds();

    readProperties();
}
コード例 #4
0
ファイル: Trap.cpp プロジェクト: OnionLee/OnionEngine-Game
bool CTrap::init()
{
	CBox::init();
	CSprite::init("Resource/Box/box_0.png");
	m_pDieAni = new CAnimation();
	m_pDieAni->init(100,false);
	m_pDieAni->addFrame("Resource/Box/box_0.png");
	m_pDieAni->addFrame("Resource/Box/box_1.png");
	m_pDieAni->addFrame("Resource/Box/box_2.png");
	m_pDieAni->addFrame("Resource/Box/box_3.png");

	m_index = Box_Trap;

	m_nHp = 50;

	setAcp(ccp(0.5,0.5));
	setBoundBox();

	return true;
}
コード例 #5
0
ファイル: character.cpp プロジェクト: horver/rpgproject
void Character::move() {
	if (getState() == MOVING) {
		setBoundBox(getX(), getY());
	}
}
コード例 #6
0
// Construct from components
polyVelocityBounded::polyVelocityBounded
(
    Time& t,
    polyMoleculeCloud& molCloud,
    const dictionary& dict
)
:
    polyStateController(t, molCloud, dict),
    propsDict_(dict.subDict(typeName + "Properties")),
    molIds_(),
    bb_(),
//     avMass_(0.0),
    lambda_(readScalar(propsDict_.lookup("lambda"))),
    deltaT_(t.deltaT().value()), 
    accumulatedTime_(0.0),
    startTime_(0.0),
    endTime_(GREAT),
    X_(false),
    Y_(false),
    Z_(false)
{
    writeInTimeDir_ = false;
    writeInCase_ = false;

//     singleValueController() = true;

    setBoundBox();
    
    molIds_.clear();

    selectIds ids
    (
        molCloud_.cP(),
        propsDict_
    );

    molIds_ = ids.molIds();

    velocity_ = propsDict_.lookup("velocity");

    if (propsDict_.found("componentControl"))
    {
        componentControl_ = Switch(propsDict_.lookup("componentControl"));

        if(componentControl_)
        {
            if (propsDict_.found("X"))
            {
                X_ = Switch(propsDict_.lookup("X"));
            }
    
            if (propsDict_.found("Y"))
            {
                Y_ = Switch(propsDict_.lookup("Y"));
            }
    
            if (propsDict_.found("Z"))
            {
                Z_ = Switch(propsDict_.lookup("Z"));
            }

            if(!X_ && !Y_ && !Z_)
            {
                FatalErrorIn("polyVelocityBounded::polyVelocityBounded()")
                    << "At least one component (X, Y, Z) should be chosen " << nl << "in: "
                    << time_.time().system()/"controllersDict"
                    << exit(FatalError);
            }
        }
    }
    
    if (propsDict_.found("startAtTime"))
    {    
        startTime_ = readScalar(propsDict_.lookup("startAtTime"));
    }
    
    if (propsDict_.found("endAtTime"))
    {
        endTime_ = readScalar(propsDict_.lookup("endAtTime"));
    }    
}