public void tick()
	{
		//ticks
		if(currentLocation!=null)
			currentLocation.tick();
		
		//key presses
		if(!inputEventQueue.isEmpty())
		{
			//System.out.println("queue size: "+inputEventQueue.size());
			ArrayList<Pair<ControllerListener,ControllerEvent>> tempQueue=new ArrayList<Pair<ControllerListener,ControllerEvent>>();
			int size=inputEventQueue.size();
			for(int i=0;i<size;i++)
				if(inputEventQueue.get(i)!=null)
					tempQueue.add(inputEventQueue.get(i));
			inputEventQueue.clear();
			for(int i=0;i<tempQueue.size();i++)
			{
				Pair<ControllerListener, ControllerEvent> pair=tempQueue.get(i);
				pair.first().actionPerformed(pair.second());
			}
		}
		
		//tick all of the ticking timers
		for(int i=0;i<timers.size();i++)
		{
			if(timers.get(i).tick())
				timers.remove(i--);
		}
		
		//perform the EngineActions!
		while(hasActions())
		{
			EngineAction action=peekAction();
			action.callFunction();
			if(action.shouldEnd())
				popAction();
		}
		
		//entity adding
		if(!entityAddQueue.isEmpty())
		{
			ArrayList<Pair<Entity,Location>> clone=(ArrayList<Pair<Entity,Location>>)entityAddQueue.clone();
			for(Pair<Entity,Location> pair:clone)
			{
				try
				{
					if(pair.second()==null)
						throw new LocationAddEntityException("Can't add an entity to a null location.");
					pair.second().addEntity(pair.first());
				}
				catch(LocationAddEntityException ex)
				{
					//ex.printStackTrace();
					//System.out.println("*ERROR*: Entity already exists at location");
				}
			}
			entityAddQueue.clear();
		}
		
		//entity deleting
		if(!entityRemoveQueue.isEmpty())
		{
			ArrayList<Pair<Entity,Location>> clone=(ArrayList<Pair<Entity,Location>>)entityRemoveQueue.clone();
			for(Pair<Entity,Location> pair:clone)
			{
				pair.second().removeEntity(pair.first());
			}
			entityRemoveQueue.clear();
		}
		
		//focus controll
		if(!focusQueue.isEmpty())
		{
			ArrayList<Pair<Integer,Focusable>> clone=(ArrayList<Pair<Integer,Focusable>>)focusQueue.clone();
			for(Pair<Integer,Focusable> pair:clone)
			{
				if(currentFocus.containsKey(pair.first()))
				{
					if(currentFocus.get(pair.first())!=null)
						currentFocus.get(pair.first()).focusLost();
				}
				currentFocus.put(pair.first(),pair.second());
				if(currentFocus.get(pair.first())!=null)
					currentFocus.get(pair.first()).focusGained();
			}
			focusQueue.clear();
		}
	}