package speiger.src.coreengine.rendering.input.window;

import java.util.function.LongFunction;

import org.lwjgl.system.Callback;

public class WindowCallback
{
	Callback callback;
	LongFunction<Callback> provider;
	
	public WindowCallback(LongFunction<Callback> provider)
	{
		this.provider = provider;
	}
	
	public void reload(long windowID)
	{
		callback = provider.apply(windowID);
	}
	
	public void destroy()
	{
		if(callback != null)
		{
			callback.free();
			callback = null;
		}
	}
}
