// SixtyFourView.h : interface of the CSixtyFourView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SIXTYFOURVIEW_H__321FCD3D_DB5B_4AB5_99E5_E1DDFA6A5D6D__INCLUDED_)
#define AFX_SIXTYFOURVIEW_H__321FCD3D_DB5B_4AB5_99E5_E1DDFA6A5D6D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

enum {
	LIST_BALL = 1,
	LIST_DOT,
	LIST_HINT
};

#define TIMER_IDLE		1

#define PICK_NO_MATCH	0x00FFFFFF

#define DISTANCE_FROM_CENTER	400

class CSixtyFourView : public CView
{
protected: // create from serialization only
	CSixtyFourView();
	DECLARE_DYNCREATE(CSixtyFourView)

// Attributes
public:
	CSixtyFourDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSixtyFourView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSixtyFourView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	HGLRC m_hrc;
	BOOL CreateRGBPalette(HDC);
	unsigned char ComponentFromIndex(int, UINT, UINT);
    static unsigned char   m_twoto8[4];
    static unsigned char   m_threeto8[8];
    static int             m_defaultOverride[13];
    static PALETTEENTRY    m_defaultPalEntry[20];
 	static unsigned char   m_oneto8[2];
	CPalette* m_pPal;		//Palette
	GLdouble m_gldAspect;

	BOOL m_bRotCam;
	GLUquadricObj* m_glqSphere;
	CPoint m_ptOldMousePt;
	ThreadParam m_tpParam;
	Move m_moveSuggested;
	BOOL m_bSuggested;
	int m_nTimerID;
	int m_nHintRotation;
	GLdouble m_dColorCycle;
	GLdouble m_dColorIncr;
	GLint m_nTicksElapsedSinceMove;
	CPoint m_ptClick;

	void ResetProjection();
	void DefineStatics();
	void RenderScene(GLint nMode);
	BOOL Pick(GLdouble x, GLdouble y);
	UINT ProcessHits(GLint nHits, GLuint nvBuffer[]);
	void MakeMove(Move move);
	void InvokeCPUMove(BOOL m_bSuggest = FALSE);
	BOOL IsHighlighted(int i, int j, int k);
	void ShowCursor(BOOL bShow = TRUE);

	static GLfloat 
		m_dvBlueEmissiveMaterial[][4],
		m_dvRedEmissiveMaterial[][4],
		m_dvShinyMaterial[][4],
		m_dvDefaultMaterial[][4];

// Generated message map functions
protected:
	//{{AFX_MSG(CSixtyFourView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnDestroy();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnMoveNext();
	afx_msg void OnUpdateMoveNext(CCmdUI* pCmdUI);
	afx_msg void OnMoveBack();
	afx_msg void OnUpdateMoveBack(CCmdUI* pCmdUI);
	afx_msg void OnMoveInvokeCpu();
	afx_msg void OnUpdateMoveInvokeCpu(CCmdUI* pCmdUI);
	afx_msg void OnMoveFirst();
	afx_msg void OnMoveLast();
	afx_msg void OnMoveSuggest();
	afx_msg void OnUpdateMoveSuggest(CCmdUI* pCmdUI);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnUpdateGameCpuWhite(CCmdUI* pCmdUI);
	afx_msg void OnGameCpuWhite();
	afx_msg void OnGameCpuNone();
	afx_msg void OnUpdateGameCpuNone(CCmdUI* pCmdUI);
	afx_msg void OnGameCpuBlack();
	afx_msg void OnUpdateGameCpuBlack(CCmdUI* pCmdUI);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in SixtyFourView.cpp
inline CSixtyFourDoc* CSixtyFourView::GetDocument()
   { return (CSixtyFourDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SIXTYFOURVIEW_H__321FCD3D_DB5B_4AB5_99E5_E1DDFA6A5D6D__INCLUDED_)
