/*	kd:
	
	This is a bit of a very thin wrapper. Motion is not exactly a property of a
	sprite, which is why this is, since I have already made the Tick struct that
	served me making the health viewer.
	
	*/

struct Gc_SbarSprite ui {
	private TextureId sprite;
	
	void Load (String sprite_name) {
		sprite = TexMan.CheckForTexture(sprite_name, TexMan.type_any);
	}
	
	// kd:
	// In case you're wondering: Nobody likes remembering constants that are
	// in another class. If you know what you need, type it out.
	
	void DrawTopLeft (Gc_StatusBar bar, vector2 pos, double alpha = 1) const {
		bar.DrawTexture(
			sprite, pos,
			bar.DI_ITEM_LEFT_TOP | bar.DI_SCREEN_LEFT_TOP, alpha);
	}
	
	void DrawTopRight (Gc_StatusBar bar, vector2 pos, double alpha = 1) const {
		bar.DrawTexture(
			sprite, pos,
			bar.DI_ITEM_RIGHT_TOP | bar.DI_SCREEN_RIGHT_TOP, alpha);
	}
	
	void DrawBottomLeft (Gc_StatusBar bar, vector2 pos, double alpha = 1) const {
		bar.DrawTexture(
			sprite, pos,
			bar.DI_ITEM_LEFT_BOTTOM | bar.DI_SCREEN_BOTTOM, alpha);
	}
	
	void DrawBottomLeftQ (Gc_StatusBar bar, vector2 pos, double alpha = 1) const {
		bar.DrawTexture(
			sprite, pos,
			bar.DI_ITEM_LEFT_TOP | bar.DI_SCREEN_LEFT_BOTTOM, alpha);
	}
	
	void DrawBottomRightQ (Gc_StatusBar bar, vector2 pos, double alpha = 1) const {
		bar.DrawTexture(
			sprite, pos,
			bar.DI_ITEM_LEFT_TOP | bar.DI_SCREEN_RIGHT_BOTTOM, alpha);
	}
	
	void DrawBottomRight (Gc_StatusBar bar, vector2 pos, double alpha = 1) const {
		bar.DrawTexture(
			sprite, pos,
			bar.DI_ITEM_RIGHT_BOTTOM | bar.DI_SCREEN_RIGHT_BOTTOM, alpha);
	}
}

struct Gc_SbarMoveSprite ui {
	private TextureId	sprite;
	private vector2		pos_start;
	private vector2		pos_end;
	
	void Load (String sprite_name, vector2 start = (0, 0), vector2 end = (0, 0)) {
		sprite		= TexMan.CheckForTexture(sprite_name, TexMan.type_any);
		pos_start	= start;
		pos_end		= end;
	}
	
	void StartRelativeToSize (double hor_f, double ver_f) {
		vector2 size = TexMan.GetScaledSize(sprite);
		pos_start = (hor_f * size.x, ver_f * size.y);
	}
	
	void EndRelativeToSize (double hor_f, double ver_f) {
		vector2 size = TexMan.GetScaledSize(sprite);
		pos_end = (hor_f * size.x, ver_f * size.y);
	}
	
	int Width () const {
		vector2 size = TexMan.GetScaledSize(sprite);
		return size.x;
	}
	
	// kd:
	// In case you're wondering: Nobody likes remembering constants that are
	// in another class. If you know what you need, type it out.
	
	void DrawTopLeft (Gc_StatusBar bar, double f = 0, double alpha = 1) const {
		bar.DrawTexture(
			sprite, (1 - f) * pos_start + f * pos_end,
			bar.DI_ITEM_LEFT_TOP | bar.DI_SCREEN_LEFT_TOP, alpha);
	}
	
	void DrawTopRight (Gc_StatusBar bar, double f = 0, double alpha = 1) const {
		bar.DrawTexture(
			sprite, (1 - f) * pos_start + f * pos_end,
			bar.DI_ITEM_RIGHT_TOP | bar.DI_SCREEN_RIGHT_TOP, alpha);
	}
	
	void DrawBottomLeft (Gc_StatusBar bar, double f = 0, double alpha = 1) const {
		bar.DrawTexture(
			sprite, (1 - f) * pos_start + f * pos_end,
			bar.DI_ITEM_LEFT_BOTTOM | bar.DI_SCREEN_BOTTOM, alpha);
	}
	
	void DrawBottomRight (Gc_StatusBar bar, double f = 0, double alpha = 1) const {
		bar.DrawTexture(
			sprite, (1 - f) * pos_start + f * pos_end,
			bar.DI_ITEM_RIGHT_BOTTOM | bar.DI_SCREEN_RIGHT_BOTTOM, alpha);
	}
	
	void DrawBottomCenter (Gc_StatusBar bar, double f = 0, double alpha = 1) const {
		bar.DrawTexture(
			sprite, (1 - f) * pos_start + f * pos_end,
			bar.DI_ITEM_TOP | bar.DI_SCREEN_CENTER_BOTTOM, alpha);
	}
	
	// kd: I gave up on this long ago lmao
	vector2 DrawPos (double f = 1) const {
		return (1 - f) * pos_start + f * pos_end;
	}
}