////////////////////////////////////////////////////////////////////////////////
// MechSimOverlay.h
// HUD Overlay for simulation window in MechVM
// Copyright Bjoern Ganster
// Developed since 2020
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "Font.h"
#include "MechSim.h"
#include "RenderToTexture.h"
#include "Texture.h"
#include "Vehicles.h"
#include "VehicleAI.h"

class MechSimOverlay FINAL {
public:
	Font* mFont;

	// Constructor for HUD
	MechSimOverlay(int width, int height);

	// Constructor for instruments
	MechSimOverlay(Texture* texture);

	// Destructor
	~MechSimOverlay();

	// Update display
	void setScreenGeometry(int width, int height);
	void setSpeed(double metersPerSecond, double percentage, double u1 = 0.97, double v1 = 0.15, double u2 = 0.99, double v2 = 0.6);
	void setSpeedHoriz(double metersPerSecond, double percent, double u1, double v1, double u2, double v2);
	void setHeading(double val);

	// Instruments
	void showHBar(double val, const DisplayComponentCoords& displayCoords, uint8_t r, uint8_t g, uint8_t b, const BGCPString& text);
	void showVBar(double percent, double u1, double v1, double u2, double v2, uint8_t r, uint8_t g, uint8_t b);

	void showJJs(double val, double maxVal, double u1, double v1, double u2, double v2);
	void showWeapons(const AbstractVehicleAI* ai, int x, int y, DWORD missionTime);
	void showArmor(const Vehicle* vehicle, double u1, double v1, double u2, double v2);
	void showArtificialHorizon(const DisplayComponentCoords& displayCoords, Vehicle* vehicle, 
		RenderToTexture& textureBuffer, Texture* targetTexture);
	void showInterceptCourse(const DisplayComponentCoords& displayCoords,  
		RenderToTexture& textureBuffer, Texture* targetTexture, Mesh* arrow);

	// Show communications summary
	void showComms(double u1, double v1, double u2, double v2);

	// Show communications with specific Mech
	void showComms2(double u1, double v1, double u2, double v2, MfdMode mfdMode);

	// Show text (one line only)
	void showText(const BGCPString& text, double u1, double v1, uint8_t r, uint8_t g, uint8_t b);

	// Show text (multiple lines allowed)
	void showText(const BGCPString& text, double u1, double v1, double u2, double v2, uint8_t r, uint8_t g, uint8_t b);

	// Render overlay
	void render();

	Texture* getOverlayTexture();
private:
	Texture* mOverlayTexture;
	bool mDeleteTexture;
};
