@@ -494,6 +494,14 @@ void DrawingGameVisitor::visit(DevelopmentCard& card) {
494494
495495}
496496
497+ /* *
498+ * Construct a trading view.
499+ * @param initiating The player initiating the trade.
500+ * @param receiving The other player involved in the trade.
501+ * @param trade The callback for the "trade" button, invoked with the current offer.
502+ * @param cancel The callback for the "cancel" button
503+ * @param initialOffer The initial offer to display.
504+ */
497505TradingView::TradingView (Player& initiating, Player& receiving, std::function<bool (std::array<int , 5 >, ScreenCoordinate)> trade, std::function<bool(ScreenCoordinate)> cancel, std::array<int, 5> initialOffer) :
498506 ViewElement({{0.1 , 0.1 },{0.9 , 0.9 }}), initiating(initiating), receiving(receiving),
499507 trade(std::bind(trade, std::ref(offer), std::placeholders::_1), {{0.7 , 0.1 }, {0.9 , 0.2 }}, " resources/TypeWritersSubstitute-Black.ttf" , 50 , " Trade" ),
@@ -502,10 +510,17 @@ TradingView::TradingView(Player& initiating, Player& receiving, std::function<bo
502510
503511}
504512
513+ /* *
514+ * Destroy the TradingView.
515+ */
505516TradingView::~TradingView () {
506517
507518}
508519
520+ /* *
521+ * Handle a user clicking on the TradingView.
522+ * @param coord The coordinate clicked on.
523+ */
509524bool TradingView::clicked (ScreenCoordinate coord) {
510525 if (cancel.handleClick (coord)) {
511526 return true ;
@@ -520,6 +535,9 @@ bool TradingView::clicked(ScreenCoordinate coord) {
520535 return true ;
521536}
522537
538+ /* *
539+ * Render the TradingView.
540+ */
523541void TradingView::render () {
524542 glBindTexture (GL_TEXTURE_2D, 0 );
525543 glColor3d (1 , 1 , 0 );
0 commit comments