forked from timdetering/Beginning_Net_Game_Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEratta.html
217 lines (136 loc) · 6.03 KB
/
Eratta.html
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
C# Eratta<br/>
========================================================================<br/>
Chapter 1, Page 5<br/>
<br/>
private PicSourcePaint...<br/>
should say<br/>
private void PicSourcePaint...<br/>
========================================================================<br/>
Chapter 1: Page 6<br/>
<br/>
Graphics graph = new Graphics();<br/>
This line isn't legal code. The correct code is <br/>
Graphics graph;<br/>
And the Graphics object must be obtained from a preexisting context.<br/>
Also, this line:<br/>
graphics = Graphics.FromHwnd(picSource.Handle);<br/>
should be <br/>
graphics = Graphics.FromImage(picSource.Image);<br/>
(also note that .Image is capitalized, unlike the code sample in the <br/>
middle of page 6)<br/>
========================================================================<br/>
Chapter 1, Page 7<br/>
<br/>
linGrBrush = new Drawing2D.LinearGradientBrush(...)<br/>
is missing a semicolon. The last line should say<br/>
Color.FromArgb(255, 0, 0, 255)); //Blue<br/>
========================================================================<br/>
Chapter 1, Page 8<br/>
<br/>
brushSquare.SurroundColors = new Color(){Color.FromArgb(255,0,0,255)};<br/>
should be<br/>
brushSquare.SurroundColors = new Color[]{Color.FromArgb(255,0,0,255)};<br/>
And...<br/>
Graph.FillPath(brushSquare, graphPath);<br/>
should be<br/>
graph.FillPath(brushSquare, graphPath);<br/>
========================================================================<br/>
Chapter 1, Page 10<br/>
<br/>
if(Dx > (r1.extentX+r2.extentX) && (Dy > (r1.extentY+r2.extentY))...<br/>
should be<br/>
if((Dx < (r1.extentX+r2.extentX)) && (Dy < (r1.extentY+r2.extentY))<br/>
//overlap<br/>
else<br/>
//no overlap<br/>
========================================================================<br/>
Chapter 1, Page 16<br/>
<br/>
Some readers have indicated that the Implementation of CircleIntersect at the bottom of Page 18 is erroneous,<br/>
indicating that the call to Math.Sqr (squaring function) should be Math.Sqrt (Square root). This is not an error. <br/>
Kind of. The error is that we should have used Math.Pow. Math.Sqr isn't a valid function. In addition, the return <br/>
result:<br/>
return (Radius*Radius) < dist;<br/>
should be<br/>
return dist < (Radius*Radius);<br/>
In order to simplify understanding this collision test, I've added a class and an Nunit test harness to help.<br/>
The class is AxisAlignedBoundingBox and the test is AABBTest. Please refer to this code instead of the code <br/>
snippets on page 16.<br/>
========================================================================<br/>
Chapter 1, Page 19<br/>
<br/>
Figure 1-17 says<br/>
Dividing a screen into 64 zones<br/>
should say<br/>
Dividing a screen into 256 zones<br/>
========================================================================<br/>
Chapter 1, Page 22<br/>
<br/>
The extension to Arvo's algorithm on this page is incorrect. Adding a Z axis<br/>
check to the AxisAlignedBoundingBox and test code (mentioned above) will yield<br/>
correct results.<br/>
========================================================================<br/>
Chapter 1, Page 34<br/>
<br/>
square.Draw(picBackground.Handle);<br/>
should be<br/>
square.Show(picBackground.Handle);<br/>
========================================================================<br/>
Chapter 1, Page 35<br/>
<br/>
square.Draw(picBackground.Handle);<br/>
should be<br/>
square.Show(picBackground.Handle);<br/>
========================================================================<br/>
Chapter 1, Page 38<br/>
<br/>
case BlockTypes.Square:<br/>
square1.Location = new Point(Location.X, Location.Y);<br/>
square2.Location = new Point(Location.X+squareSize, Location.Y);<br/>
square3.Location = new Point(Location.X, Location.Y+squareSize);<br/>
square4.Location = new Point(Location.X+squareSize, Location.Y+squareSize);<br/>
break;<br/>
should be<br/>
case BlockTypes.Square:<br/>
square1.Location = new Point(location.X, location.Y);<br/>
square2.Location = new Point(location.X+squareSize, location.Y);<br/>
square3.Location = new Point(location.X, location.Y+squareSize);<br/>
square4.Location = new Point(location.X+squareSize, location.Y+squareSize);<br/>
break;<br/>
========================================================================<br/>
Chapter 1,Pages 39-42<br/>
<br/>
squareN.location <br/>
should be <br/>
squareN.Location<br/>
========================================================================<br/>
Chapter 1, page 49<br/>
<br/>
private void CmdStart_Click event handler must have this value set somewhere<br/>
in the method:<br/>
CmdStart.Enabled = false;<br/>
========================================================================<br/>
Chapter 6, pg 294<br/>
<br/>
The new SDK simply returns an identical reference to a mesh if you call Mesh.Clean and nothing changes,<br/>
so these lines of code:<br/>
tempMesh = Mesh.Clean(CleanType.Optimization, systemMemoryMesh, adjacencyBuffer, adjacencyBuffer, out errorString);<br/>
systemMemoryMesh.Dispose();<br/>
systemMemoryMesh = tempMesh;<br/>
Will yield a nulled SystemMemoryMesh if Mesh.Clean does nothing. You must explicitly check to verify that the meshes<br/>
are identical by using the Equals method:<br/>
tempMesh = Mesh.Clean(CleanType.Optimization, systemMemoryMesh, adjacencyBuffer, adjacencyBuffer, out errorString);<br/>
if (tempMesh != systemMemoryMesh) {<br/>
systemMemoryMesh.Dispose();<br/>
systemMemoryMesh = tempMesh;<br/>
}<br/>
========================================================================<br/>
Chapter 6, pg 295<br/>
<br/>
The Managed DirectX mesh flag OptimizeAttrSort has been changed to OptimizeAttributeSort to conform to Microsoft <br/>
coding standards.<br/>
========================================================================<br/>
Chapter 6/7<br/>
<br/>
The shell code for the Spacewar3D game used the PureDevice flag when creating the device caps. This resulted in<br/>
very strange side-effects or non-functional programs. That flag has been terminated with prejudice.<br/>