#pragma once
#include "global.h"
#include "MyView.h"
//游戏计时器
class GameTimer
{
public:
	void Init(MyDX11Renderer* pRenderer, MyView* pView);
	void Draw(bool bShowPlayer2);
	void Step();
	void Reset();
	void SetVisible(bool bVisiable);
	void Stop(bool bStop = true);
	int GetCounter();
	void SetCounter(int counter);
	bool Save();
	bool Load();
	void SetUnit();
private:
	MyDX11Renderer* pRenderer = nullptr;
	MyView* pView = nullptr;
	char buff[64];
	int counter = 0;//跑过的有效游戏帧数
	int minutes = 0;//分
	int seconds = 0;//秒
	int units = 0;//十分之一秒
	bool bVisiable = false;
	bool bStop = true;
	void AddDrawOneNum(float srcX, float srcY, float dstX, float dstY, float scale, int num);
	void AddDrawTwoNum(float srcX, float srcY, float dstX, float dstY, float scale, int num);
	void AddDrawNum(float srcX, float srcY, float dstX, float dstY, float scale, int num);
};

