-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrackRacerView.h
118 lines (100 loc) · 3 KB
/
TrackRacerView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// TrackRacerView.h : interface of the CTrackRacerView class
//
#pragma once
#pragma comment(lib, "opengl32")
#pragma comment(lib, "glu32")
#pragma comment(lib, "winmm")
#include "resource.h"
#include <gl/GL.h>
#include <gl/GLU.h>
#include <mmsystem.h>
#include "includes\Utility.h"
#include "includes\Mp3.h"
#include "includes\surface.h"
#define IDT_MAIN 0
#define IDT_INITSOUND 1
#define VK_X 0x58
#define VK_Z 0x5A
class CTrackRacerView : public CView
{
DECLARE_DYNCREATE(CTrackRacerView)
// Contructor/Destructors
protected:
CTrackRacerView();
// Attributes
public:
HDC m_hDC; // Device context
HGLRC m_hRC; // Rendering context
CRect m_rtClient; // Client rect
CRect m_rtViewport; // Viewport rect
double m_eyeTort;
double m_eyeTens;
byte* m_bkgnTexture; // Background texture
CSize m_bkgnSize; // Background size
UINT m_nBkgnID; // Background ID
bool m_bBkgnDay; // Is background night
HSURFACE m_aCarSurface[256]; // car surfaces
int m_nCarSurface; // number of car surfaces
HSURFACE m_aFlagSurface[256]; // flag surfaces
int m_nFlagSurface; // number of ''
bool m_bFullView; // Is full view mode
CWnd* m_formerWnd; // Saved former window
int m_nElapse; // Timer period
double m_mapScale; // Track scale
Mp3 m_sndStart;
Mp3 m_sndMotor;
Mp3 m_sndAccel;
Mp3 m_sndDrive;
Mp3 m_sndHorn;
CTrackRacerDoc* GetDocument() const;
// Operations
public:
void GLPrepare();
void GLUnprepare();
void GLInit();
void GLUpdate();
void GLReshape(int cx, int cy);
void GLDisplay(CTrackRacerDoc* pDoc);
void InitSound();
void UpdateSound();
// Overidables
public:
virtual void OnDraw(CDC* pDC); // Overriden for redraw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/);
protected:
// Implements
public:
virtual ~CTrackRacerView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Created message map functions
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
afx_msg void OnViewFull();
afx_msg void OnBackground(UINT nID);
afx_msg void OnUpdateBackground(CCmdUI* pCmd);
afx_msg void OnBackgroundDay();
afx_msg void OnUpdateBackgroundDay(CCmdUI *pCmdUI);
afx_msg void OnBackgroundNight();
afx_msg void OnUpdateBackgroundNight(CCmdUI *pCmdUI);
afx_msg void OnHelpInstruction();
};
#ifndef _DEBUG
inline CTrackRacerDoc* CTrackRacerView::GetDocument() const
{
return reinterpret_cast<CTrackRacerDoc*>(m_pDocument);
}
#endif