Skip to content

Commit 2cb2508

Browse files
committed
Fixed up declarations of make_image_surface in io2d.h to match the intended declarations that are found in Clause 14 of R6. Fixed all instances of new_path to be new_figure. Fixed issue in RocksInSpace with bounding_box not having .left(), .right(), .top(), and .bottom() member functions.
1 parent a105245 commit 2cb2508

File tree

10 files changed

+105
-101
lines changed

10 files changed

+105
-101
lines changed

N3888_RefImpl/RocksInSpace/Asteroid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void rocks_in_space::asteroid::draw(std::experimental::io2d::display_surface& ds
4141
auto path = path_builder<>{};
4242
path.clear();
4343
auto v = m_physics.position() + (m_path.m_vertices[0]);
44-
path.new_path(screen_space(v));
44+
path.new_figure(screen_space(v));
4545
std::for_each(&m_path.m_vertices[1], &m_path.m_vertices[m_path.m_count], [&](const auto& vert)
4646
{
4747
v += vert;

N3888_RefImpl/RocksInSpace/Maths.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ bool rocks_in_space::intersects(const bounding_box& a, const bounding_box& b)
5252
{
5353
return contains(a, b.top_left()) ||
5454
contains(a, b.bottom_right()) ||
55-
contains(a, point_2d(b.top(), b.right())) ||
56-
contains(a, point_2d(b.bottom(), b.left())) ||
55+
contains(a, point_2d(b.y(), b.x() + b.width())) ||
56+
contains(a, point_2d(b.y() + b.height(), b.x())) ||
5757
contains(b, a.top_left()) ||
5858
contains(b, a.bottom_right()) ||
59-
contains(b, point_2d(a.top(), a.right())) ||
60-
contains(b, point_2d(a.bottom(), a.left()));
59+
contains(b, point_2d(a.y(), a.x() + a.width())) ||
60+
contains(b, point_2d(a.y() + a.height(), a.x()));
6161
}
6262

6363
bool rocks_in_space::contains(const bounding_box& r, const point_2d& p)
6464
{
65-
return p.x >= r.left() &&
66-
p.x <= r.right() &&
67-
p.y >= r.top() &&
68-
p.y <= r.bottom();
65+
return p.x >= r.x() &&
66+
p.x <= r.x() + r.width() &&
67+
p.y >= r.y() &&
68+
p.y <= r.y() + r.height();
6969
}
7070

7171
float rocks_in_space::radius(const bounding_box& r)

N3888_RefImpl/RocksInSpace/Ship.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void rocks_in_space::ship::draw(display_surface& ds)
4949
auto path = path_builder<>{};
5050
path.clear();
5151
auto v = m_physics.position() + (m_path.m_vertices[0]);
52-
path.new_path(screen_space(v));
52+
path.new_figure(screen_space(v));
5353
std::for_each(&m_path.m_vertices[1], &m_path.m_vertices[m_path.m_count], [&](const auto& vert)
5454
{
5555
v += vert;
@@ -90,7 +90,7 @@ void rocks_in_space::missile::draw(display_surface& ds)
9090
if (!active()) return;
9191

9292
auto path = path_builder<>{};
93-
path.new_path(screen_space(m_physics.position()));
93+
path.new_figure(screen_space(m_physics.position()));
9494
path.line(screen_space(m_physics.position() - m_physics.velocity()));
9595

9696
ds.stroke(brush{ rgba_color::white }, path);

N3888_RefImpl/SampleApp/brush_examples.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace brush_test {
1010
brush foreBrush{ rgba_color::white };
1111
path_builder<> pb{};
1212
imgSfc.paint(backBrush);
13-
pb.new_path({ 80.0, 20.0 });
13+
pb.new_figure({ 80.0, 20.0 });
1414
pb.line({ 220.0, 20.0 });
1515
pb.rel_line({ 60.0, 160.0 });
1616
pb.rel_line({ -260.0, 0.0 });

N3888_RefImpl/SampleApp/entrypoint.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main() {
6868
// path_builder<> pb{};
6969
//
7070
// pb.clear();
71-
// pb.new_path({ 80.0, 20.0 });
71+
// pb.new_figure({ 80.0, 20.0 });
7272
// pb.line({ 220.0, 20.0 });
7373
// pb.rel_line({ 60.0, 160.0 });
7474
// pb.rel_line({ -260.0, 0.0 });
@@ -82,13 +82,13 @@ int main() {
8282
// imgSfc.save("pathexample01.png"s, image_file_format::png);
8383
//#endif
8484
// pb.clear();
85-
// pb.new_path({ 20.0, 20.0 });
85+
// pb.new_figure({ 20.0, 20.0 });
8686
// pb.rel_line({ 100.0, 0.0 });
8787
// pb.rel_line({ 0.0, 160.0 });
8888
// pb.rel_line({ -100.0, 0.0 });
8989
// pb.rel_line({ 0.0, -160.0 });
9090
//
91-
// pb.new_path({ 180.0, 20.0 });
91+
// pb.new_figure({ 180.0, 20.0 });
9292
// pb.rel_line({ 100.0, 0.0 });
9393
// pb.rel_line({ 0.0, 160.0 });
9494
// pb.rel_line({ -100.0, 0.0 });
@@ -164,7 +164,7 @@ point_2d testArcClockwiseEndAngle(path_builder<>& pb, point_2d location, bool cl
164164
point_2d ctrVal{};
165165

166166
// Test end angle 90 degree increments starting at 180.
167-
pb.new_path(location);
167+
pb.new_figure(location);
168168
const point_2d initialRelLine{ 40.0, 0.0 };
169169
pb.rel_line(initialRelLine);
170170
location += initialRelLine;
@@ -174,28 +174,28 @@ point_2d testArcClockwiseEndAngle(path_builder<>& pb, point_2d location, bool cl
174174
}
175175

176176
location += locadd;
177-
pb.new_path(location + point_2d{ 0.0, 0.0 });
177+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
178178
pb.arc(rad, -pi<float>, half_pi<float>);
179179
if (closePath) {
180180
pb.close_figure();
181181
}
182182

183183
location += locadd;
184-
pb.new_path(location + point_2d{ 0.0, 0.0 });
184+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
185185
pb.arc(rad, -pi<float>, 0.0);
186186
if (closePath) {
187187
pb.close_figure();
188188
}
189189

190190
location += locadd;
191-
pb.new_path(location + point_2d{ 0.0, 0.0 });
191+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
192192
pb.arc(rad, -pi<float>, three_pi_over_two<float>);
193193
if (closePath) {
194194
pb.close_figure();
195195
}
196196

197197
location += locadd;
198-
pb.new_path(location + point_2d{ 0.0, 0.0 });
198+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
199199
pb.arc(rad, -two_pi<float>, pi<float>);
200200
pb.rel_line({ -40.0, 0.0 });
201201
if (closePath) {
@@ -204,35 +204,35 @@ point_2d testArcClockwiseEndAngle(path_builder<>& pb, point_2d location, bool cl
204204

205205
// Test end angle 90 degree intervals starting at 135
206206
location += locadd;
207-
pb.new_path(location + point_2d{ 0.0, 0.0 });
207+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
208208
pb.arc(rad, -pi<float>, pi<float> -quarterPi);
209209
if (closePath) {
210210
pb.close_figure();
211211
}
212212

213213
location += locadd;
214-
pb.new_path(location + point_2d{ 0.0, 0.0 });
214+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
215215
pb.arc(rad, -pi<float>, quarterPi);
216216
if (closePath) {
217217
pb.close_figure();
218218
}
219219

220220
location += locadd;
221-
pb.new_path(location + point_2d{ 0.0, 0.0 });
221+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
222222
pb.arc(rad, -pi<float>, -quarterPi);
223223
if (closePath) {
224224
pb.close_figure();
225225
}
226226

227227
location += locadd;
228-
pb.new_path(location + point_2d{ 0.0, 0.0 });
228+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
229229
pb.arc(rad, -pi<float>, pi<float> +quarterPi);
230230
if (closePath) {
231231
pb.close_figure();
232232
}
233233

234234
location += locadd;
235-
pb.new_path(location + point_2d{ 0.0, 0.0 });
235+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
236236
pb.arc(rad, -two_pi<float>, three_pi_over_two<float> +quarterPi);
237237
pb.rel_line({ 40.0, 40.0 });
238238
if (closePath) {
@@ -246,7 +246,7 @@ point_2d testArcCounterclockwiseEndAngle(path_builder<>& pb, point_2d location,
246246
const float quarterPi = half_pi<float> / 2.0;
247247

248248
// Test end angle 90 degree increments starting at 180.
249-
pb.new_path(location);
249+
pb.new_figure(location);
250250
const point_2d initialRelLine{ 40.0, 0.0 };
251251
pb.rel_line(initialRelLine);
252252
location += initialRelLine;
@@ -256,28 +256,28 @@ point_2d testArcCounterclockwiseEndAngle(path_builder<>& pb, point_2d location,
256256
}
257257

258258
location += locadd;
259-
pb.new_path(location + point_2d{ 0.0, 0.0 });
259+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
260260
pb.arc(rad, pi<float>, half_pi<float>);
261261
if (closePath) {
262262
pb.close_figure();
263263
}
264264

265265
location += locadd;
266-
pb.new_path(location + point_2d{ 0.0, 0.0 });
266+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
267267
pb.arc(rad, pi<float>, 0.0);
268268
if (closePath) {
269269
pb.close_figure();
270270
}
271271

272272
location += locadd;
273-
pb.new_path(location + point_2d{ 0.0, 0.0 });
273+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
274274
pb.arc(rad, pi<float>, three_pi_over_two<float>);
275275
if (closePath) {
276276
pb.close_figure();
277277
}
278278

279279
location += locadd;
280-
pb.new_path(location + point_2d{ 0.0, 0.0 });
280+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
281281
pb.arc(rad, two_pi<float>, pi<float>);
282282
pb.rel_line({ -40.0, 0.0 });
283283
if (closePath) {
@@ -286,35 +286,35 @@ point_2d testArcCounterclockwiseEndAngle(path_builder<>& pb, point_2d location,
286286

287287
// Test end angle 90 degree intervals starting at 135
288288
location += locadd;
289-
pb.new_path(location + point_2d{ 0.0, 0.0 });
289+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
290290
pb.arc(rad, pi<float>, pi<float> -quarterPi);
291291
if (closePath) {
292292
pb.close_figure();
293293
}
294294

295295
location += locadd;
296-
pb.new_path(location + point_2d{ 0.0, 0.0 });
296+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
297297
pb.arc(rad, pi<float>, quarterPi);
298298
if (closePath) {
299299
pb.close_figure();
300300
}
301301

302302
location += locadd;
303-
pb.new_path(location + point_2d{ 0.0, 0.0 });
303+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
304304
pb.arc(rad, pi<float>, -quarterPi);
305305
if (closePath) {
306306
pb.close_figure();
307307
}
308308

309309
location += locadd;
310-
pb.new_path(location + point_2d{ 0.0, 0.0 });
310+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
311311
pb.arc(rad, pi<float>, pi<float> +quarterPi);
312312
if (closePath) {
313313
pb.close_figure();
314314
}
315315

316316
location += locadd;
317-
pb.new_path(location + point_2d{ 0.0, 0.0 });
317+
pb.new_figure(location + point_2d{ 0.0, 0.0 });
318318
pb.arc(rad, two_pi<float>, three_pi_over_two<float> +quarterPi);
319319
pb.rel_line({ 40.0, 40.0 });// *scale);
320320
if (closePath) {

0 commit comments

Comments
 (0)