[A5] al_draw_filled_polygon don't work
SilverTES

Hum, it's strange :

#SelectExpand
1 2... 3 std::vector<Vec2D> polygon0; 4 5 polygon0.push_back(Vec2D{100,100}); 6 polygon0.push_back(Vec2D{120,100}); 7 polygon0.push_back(Vec2D{160,140}); 8 polygon0.push_back(Vec2D{130,160}); 9 polygon0.push_back(Vec2D{80,140}); 10 11 12 if (Collision2D::pointPolygon<Vec2D>(Point{(int)_xMouse, (int)_yMouse}, &polygon0[0], polygon0.size() )) 13 { 14 std::cout << "<-- Mouse in Polygon -->"; 15 16 al_draw_filled_polygon // don't draw anything ! <----- 17 ( 18 (float*)&polygon0[0], 19 polygon0.size(), 20 al_map_rgb(180,130,240) 21 ); 22 23 al_draw_polygon // draw the polygon normally ! 24 ( 25 (float*)&polygon0[0], 26 polygon0.size(), 27 ALLEGRO_LINE_JOIN_BEVEL, 28 al_map_rgb(180,130,240), 29 4, 30 0 31 ); 32 } 33...

:'( I don't understand the problem.

Polybios

This could be the problem, although I'm not really sure about the order right now:

Allegro manual said:

When the y-axis is facing downwards (the usual), the coordinates must be ordered anti-clockwise.

SilverTES

:-X, Thanks, it's working now ! :)

Thread #616776. Printed from Allegro.cc