CanadianMachines / MachineLib / MachineSystemActual.h
MachineSystemActual.h
Raw
/**
 * @file MachineSystemActual.h
 * @author sriram
 *
 *
 */

#ifndef CANADIANEXPERIENCE_MACHINELIB_MACHINESYSTEMACTUAL_H
#define CANADIANEXPERIENCE_MACHINELIB_MACHINESYSTEMACTUAL_H

#include "MachineSystem.h"
#include "Machine.h"

struct ma_engine;

/**
 * machine system class
 */
class MachineSystemActual: public MachineSystem
{
private:
	///location of machine
	wxPoint mLocation;

	///time
	double mTime = 0;

	///frame rate
	double mFrameRate;

	///machine number
	int mMachineNumber = 1;

	///frame
	int mFrame;

	/// The resources directory
	std::wstring mResourcesDir;

	/// The miniaudio engine
	ma_engine* mAudioEngine;

	///machine
	std::shared_ptr<Machine> mMachine = nullptr;

public:

	/// Constructor
	MachineSystemActual(std::wstring resourcesDir, ma_engine* audioEngine);

	/// Destructor
	virtual ~MachineSystemActual() = default;

	/// Copy constructor/disabled
	MachineSystemActual(const MachineSystemActual&) = delete;

	/// Assignment operator/disabled
	void operator=(const MachineSystemActual&) = delete;

	/**
	* Set the position for the root of the machine
	* @param location The x,y location to place the machine
	*/
	void SetLocation(wxPoint location) override;

	/**
	 * Get the location of hte machine
	 * @return Location x,y in pixels as a point
	 */
	virtual wxPoint GetLocation() {return mLocation;}

	/**
	* Draw the machine at the currently specified location
	* @param graphics Graphics object to render to
	*/
	void DrawMachine(std::shared_ptr<wxGraphicsContext> graphics) override;

	/**
	* Set the current machine animation frame
	* @param frame Frame number
	*/
	void SetMachineFrame(int frame) override;

	/**
	 * Set the expected frame rate in frames per second
	 * @param rate Frame rate in frames per second
	 */
	void SetFrameRate(double rate) override;

	/**
	* Set the machine number
	* @param machine An integer number. Each number makes a different machine
	*/
	void SetMachineNumber(int machine) override;

	/**
	 * Get the current machine number
	 * @return Machine number integer
	 */
	int GetMachineNumber() override {return mMachineNumber;}

	/**
	 * Get the current machine time.
	 * @return Machine time in seconds
	 */
	double GetMachineTime() override {return mFrame/mFrameRate;}

	/**
	 * getter for machine
	 * @return machine
	 */
	std::shared_ptr<Machine> GetMachine(){return mMachine;}
};

#endif //CANADIANEXPERIENCE_MACHINELIB_MACHINESYSTEMACTUAL_H