@@ -243,21 +243,19 @@ void drawTexturedCircle(std::pair<float, float> texCenter, float texRadius, std:
243243 double angle = ((double ) i) * (2 . * M_PI) / (double )articulation;
244244 double tangle = ((double ) -i) * (2 . * M_PI) / (double )articulation;
245245 texCoordPair ({texCenter.first + texRadius * std::cos (tangle), texCenter.second + texRadius * std::sin (tangle)});
246- // std::cout << texCenter.first + texRadius << "\n";
247246 glVertex2d (screenCenter.first + (screenRadius * std::cos (angle)), screenCenter.second + (screenRadius * std::sin (angle)));
248- // std::cout << screenCenter.first + (screenRadius * std::cos(angle));
249247
250248 }
251249 glEnd ();
252250}
253251
254252void drawTexturedRectangle (std::pair<float , float > texTopLeft, float sideLength, std::pair<float , float > screenTopLeft, float screenSideLength) {
255253
256- static const GLuint diceTextures = loadImageAsTexture (" resources/catan_dice_new.bmp" );
257- glBindTexture (GL_TEXTURE_2D, diceTextures);
254+
258255
259256 glBegin (GL_QUADS);
260257
258+
261259
262260
263261 texCoordPair ({texTopLeft.first + 0 .0f , texTopLeft.second + 0 .0f });
@@ -293,36 +291,38 @@ void drawTexturedRectangle(std::pair<float, float> texTopLeft, float sideLength,
293291 glEnd ();
294292
295293
296- glBindTexture (GL_TEXTURE_2D, 0 );
294+
297295
298296
299297
300298}
301299
302300void DrawingGameVisitor::visit (GameDice& dice) {
303301
304-
302+ static const GLuint diceTextures = loadImageAsTexture (" resources/catan_dice_new.bmp" );
303+ glBindTexture (GL_TEXTURE_2D, diceTextures);
305304
306-
307- /* static const std::map<int, std::pair<float, float>> topLeftOffset = {
305+ glColor3d ( 1.0 , 1.0 , 1.0 );
306+ static const std::map<int , std::pair<float , float >> topLeftOffset = {
308307 make_pair (1 , make_pair (4 .f , 8 .f )),
309308 make_pair (2 , make_pair (134 .f , 8 .f )),
310309 make_pair (3 , make_pair (264 .f , 8 .f )),
311310 make_pair (4 , make_pair (4 .f , 142 .f )),
312311 make_pair (5 , make_pair (134 .f , 142 .f )),
313312 make_pair (6 , make_pair (264 .f , 142 .f ))
314- };*/
315- /*
313+ };
314+
316315 drawTexturedRectangle (topLeftOffset.find (dice.getFirst ())->second , 96 .f ,
317316 make_pair (.8f , .9f ), 0.03 );
318- */
317+
319318
320- // drawTexturedRectangle(make_pair(134.f, 8.f), 96.f, make_pair(.8f, .9f), 0.03);
319+ drawTexturedRectangle (topLeftOffset.find (dice.getSecond ())->second , 96 .f ,
320+ make_pair (.84f , .9f ), 0.03 );
321321
322- // drawTexturedRectangle(topLeftOffset.find(dice.getSecond())->second, 96.f,
323- // make_pair(.84f, .9f), 0.03);
322+ glBindTexture (GL_TEXTURE_2D, 0 );
324323
325- drawTexturedRectangle (make_pair (4 .f , 8 .f ), 1000 .f , make_pair (.7f , .9f ), 0.03 );
324+ // hardcoded 2 die for testing
325+ // drawTexturedRectangle(make_pair(4.f, 8.f), 96.f, make_pair(.7f, .9f), 0.03);
326326
327327
328328
@@ -395,6 +395,12 @@ void DrawingGameVisitor::visit(ResourceTile& tile) {
395395 }
396396 glBindTexture (GL_TEXTURE_2D, 0 );
397397
398+
399+ static const GLuint diceTextures = loadImageAsTexture (" resources/catan_dice_new.bmp" );
400+ glBindTexture (GL_TEXTURE_2D, diceTextures);
401+ drawTexturedRectangle (make_pair (4 .f , 8 .f ), 96 .f , make_pair (.7f , .9f ), 0.03 );
402+ glBindTexture (GL_TEXTURE_2D, 0 );
403+
398404
399405}
400406
0 commit comments