Exemplo n.º 1
0
void NodeGraphDisplay::onControlDrag(NodeControl *nc, APoint m_pos)
{
	if(draggedNode)
	{
		APoint c_pos = m_pos;

		if(draggedNode != nc)
		{
			if(draggedConnector)
				c_pos = nc->getConnectorPoint(getOpposite(NodeConnector::getNodeConnector(draggedConnector)->ioType));
			else
				c_pos = nc->getConnectorPoint(getOpposite(draggedNode->getDefaultConnector()->ioType));
		}
		
		connections[connectionIndex]->setHangingPos(c_pos);
	}
}
Exemplo n.º 2
0
bool NodeConnector::validConnection(NCID nc_id1, NCID nc_id2)
{
	NodeConnector	*nc1 = getNC(nc_id1),
					*nc2 = getNC(nc_id2);

	return (nc1 && nc2												&&	//Check that they arent null
			!nc1->isConnected(nc_id2) && !nc2->isConnected(nc_id1)	&&	//Check that theyre not connected
			nc1->ioType == getOpposite(nc2->ioType));//					&&	//Check that one is output and one is input
			//nc1->getDataType() == nc2->getDataType());					//Check that they are the same data type
}
Exemplo n.º 3
0
void Room::removeConnection(RoomDirection direction) {
	if (hasConnection(direction))
	{
		Room * opposite = this->connected[direction];
		RoomDirection oppositeDirection = getOpposite(direction);
		if (opposite->hasConnection(oppositeDirection))
			opposite->setFromOpposite(oppositeDirection, nullptr);
	}
	this->connected[direction] = nullptr;

}
Exemplo n.º 4
0
void Room::setRoom(RoomDirection dir, Room* r){
	connected[dir] = r;
	r->setFromOpposite(getOpposite(dir), this);
}
Exemplo n.º 5
0
bool Actor::isOpposite(DIRECTION a, DIRECTION b) {
    return a != none && b != none && getOpposite(a) == b;
}