Author: machiel.sleeuwaert
(2008/10/15 14:12) Over 3 years ago
183
p << "[" << i << "]= " << m_DynArrPtr[i] << " \n ";
184
185
}
186
187
188
int& IntLijst::operator[] (int index)
189
{
190
if (index > m_AantalElementen || index < 0)
191
192
index = 0;
193
return m_DynArrPtr[index];
194
195
196
tstringstream& operator<<(tstringstream& stream, IntLijst& lijst)
197
198
for (int i=0;i<lijst.m_AantalElementen;++i)
199
200
stream << "[" << i << "]= " << lijst.m_DynArrPtr[i] << " \n ";
201
202
203
return stream;
204
205
tstring operator+(tstring string, IntLijst& lijst)
206
207
tstringstream temp;
208
temp << string;
209
temp << lijst;
210
return temp.str();
211
2
#include "GameEngine.h"
3
class IntLijst
4
5
friend tstringstream& operator<<(tstringstream& stream, IntLijst& lijst);
6
friend tstring operator+(tstring string, IntLijst& lijst);
7
8
public:
9
IntLijst();
10
11
...
30
bool operator==(const IntLijst& p);
34
31
bool operator!=(const IntLijst& p);
35
32
void operator>>(tstringstream &p);
36
37
int& operator[] (int index);
33
private:
38
void vergrootArray();
39
40
44
45
41
};
46
47
85
bool Vector3::operator==(const Vector3& p)
86
87
return (m_x == p.m_x && m_y == p.m_y && m_z == p.m_z);
88
89
90
Vector3 Machiel::operator*(int n, Vector3& p)
91
92
return Vector3(n * p.m_x,n * p.m_y,n * p.m_z);
93
94
95
tstringstream& Machiel::operator<<(tstringstream& stream, Vector3& vector3)
96
97
stream << vector3.m_x << "," << vector3.m_y << "," << vector3.m_z;
98
99
100
tstring Machiel::operator+(tstring string, Vector3& vector3)
101
102
103
104
temp << vector3;
105
106
class Vector3
// constructoren
Vector3();
bool operator!=(const Vector3& p);
float m_x,m_y,m_z;
friend tstringstream& operator<<(tstringstream& stream, Vector3& vector3);
42
friend tstring operator+(tstring string, Vector3& vector3);
43
friend Vector3 operator*(int n, Vector3& vector3);
48
49
50
51
void Week1Oplossing::GameStart()
for (int i=0;i<5;++i)
//for (int i=0;i<5;++i)
//{
lijst1.push_back(i);
// lijst1.push_back(i);
//}
for (int i=5;i<10;++i)
//for (int i=5;i<10;++i)
lijst2.push_back(i);
// lijst2.push_back(i);
for (int i=11;i<16;++i)
//for (int i=11;i<16;++i)
lijst3.push_back(i);
// lijst3.push_back(i);
52
//
53
lijst4 = lijst3+lijst2;
//lijst4 = lijst3+lijst2;
54
lijst4+=lijst1;
//lijst4+=lijst1;
55
56
lijst4 = lijst4;
//lijst4 = lijst4;
57
58
59
void Week1Oplossing::GamePaint(RECT rect)
70
71
GAME_ENGINE->SetColor(RGB(0,0,0));
72
73
tstring temp;
74
temp = _T("lol ");
75
76
GAME_ENGINE->DrawString(temp+Vector1PTR,100,10+(20*0));
GAME_ENGINE->DrawString(Vector1PTR.ToString(),100,10+(20*0));
GAME_ENGINE->DrawString(Vector2PTR.ToString(),100,10+(20*1));
77
GAME_ENGINE->DrawString(Vector3PTR.ToString(),100,10+(20*2));
78
GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*3));
79
80
Vector4PTR = Vector1PTR+Vector2PTR;
// GAME_ENGINE->DrawString(Vector2PTR.ToString(),100,10+(20*1));
81
GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*4));
// GAME_ENGINE->DrawString(Vector3PTR.ToString(),100,10+(20*2));
82
Vector4PTR = Vector1PTR + Vector3PTR;
// GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*3));
83
GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*5));
84
bool temp = Vector2PTR == Vector3PTR;
// Vector4PTR = Vector1PTR+Vector2PTR;
tstringstream temph;
// GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*4));
temph << temp;
// Vector4PTR = Vector1PTR + Vector3PTR;
GAME_ENGINE->DrawString(temph.str(),100,10+(20*6));
// GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*5));
temph.str(_T(""));
temp = Vector2PTR == Vector1PTR;
// bool temp = Vector2PTR == Vector3PTR;
// tstringstream temph;
GAME_ENGINE->DrawString(temph.str(),100,10+(20*7));
// temph << temp;
// GAME_ENGINE->DrawString(temph.str(),100,10+(20*6));
// temph.str(_T(""));
// temp = Vector2PTR == Vector1PTR;
// GAME_ENGINE->DrawString(temph.str(),100,10+(20*7));
{{{{{{{{{{{{{{{{{//for (int i=0;i<5;++i){//{// lijst1.push_back(i);//}//for (int i=5;i<10;++i){//{// lijst2.push_back(i);//}//for (int i=11;i<16;++i){//{// lijst3.push_back(i);//}////lijst4 = lijst3+lijst2;//lijst4+=lijst1;//lijst4 = lijst4;temp = _T("lol ");GAME_ENGINE->DrawString(temp+Vector1PTR,100,10+(20*0));GAME_ENGINE->DrawString(Vector1PTR.ToString(),100,10+(20*0));GAME_ENGINE->DrawString(Vector2PTR.ToString(),100,10+(20*1));GAME_ENGINE->DrawString(Vector3PTR.ToString(),100,10+(20*2));GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*3));Vector4PTR = Vector1PTR+Vector2PTR;// GAME_ENGINE->DrawString(Vector2PTR.ToString(),100,10+(20*1));GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*4));// GAME_ENGINE->DrawString(Vector3PTR.ToString(),100,10+(20*2));Vector4PTR = Vector1PTR + Vector3PTR;// GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*3));GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*5));bool temp = Vector2PTR == Vector3PTR;// Vector4PTR = Vector1PTR+Vector2PTR;tstringstream temph;// GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*4));temph << temp;// Vector4PTR = Vector1PTR + Vector3PTR;GAME_ENGINE->DrawString(temph.str(),100,10+(20*6));// GAME_ENGINE->DrawString(Vector4PTR.ToString(),100,10+(20*5));temph.str(_T(""));temp = Vector2PTR == Vector1PTR;// bool temp = Vector2PTR == Vector3PTR;temph << temp;// tstringstream temph;GAME_ENGINE->DrawString(temph.str(),100,10+(20*7));// temph << temp;// GAME_ENGINE->DrawString(temph.str(),100,10+(20*6));////// temph.str(_T(""));