// Copyright (c) 2014 Orion Industries, zhiayang@gmail.com
// Licensed under the Apache License version 2.0

package Utilities

import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.math.Vector2
import Abstractions.Entity

public fun createTextureFromFile(name: String): Texture
{
	return Texture(Gdx.files.internal(name))
}

public fun getDistance(a: Vector2, b: Vector2): Float
{
	return a.dst(b)
}

public fun getDistance(ax: Float, ay: Float, bx: Float, by: Float): Float
{
	return Vector2(ax, ay).dst(Vector2(bx, by))
}

public fun isWithinRange(a: Entity, b: Entity, range: Float): Boolean
{
	return Vector2.dst2(a.x, a.y, b.x, b.y) <= range * range
}
