Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 146003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:31:26+00:00 2026-05-11T08:31:26+00:00

is there a way to use mouse as an event handler in c/c++ im

  • 0

is there a way to use mouse as an event handler in c/c++ im making a game on snakes and ladder (the famous board game) and trying to make it with basic borland c++ compiler working with a header file called graphics.h, which is very basic and gives output of 640 X 480 res, so I was wondering if there is a possiblity of using mouse as an event handler (about which i have no experiance)to have control over the palyer coins on the board.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:31:27+00:00Added an answer on May 11, 2026 at 8:31 am

    I’m not sure which version of graphics.h you happen to have, but there are functions getmousey, getmousey, clearmouseclick and getmouseclick. See this for some documentation that may work for you.

    It appeas that you can use registermousehandler and a call-back function to do some level of event-based programming. Here’s a sample from the document I sent you.

    // The click_handler will be called whenever the left mouse button is // clicked. It checks copies the x,y coordinates of the click to // see if the click was on a red pixel. If so, then the boolean // variable red_clicked is set to true. Note that in general // all handlers should be quick. If they need to do more than a little // work, they should set a variable that will trigger the work going, // and then return. bool red_clicked = false; void click_handler(int x, int y) {     if (getpixel(x,y) == RED)     red_clicked = true; }  // Call this function to draw an isosoles triangle with the given base and // height. The triangle will be drawn just above the botton of the screen. void triangle(int base, int height) {     int maxx = getmaxx( );     int maxy = getmaxy( );     line(maxx/2 - base/2, maxy - 10, maxx/2 + base/2, maxy - 10);     line(maxx/2 - base/2, maxy - 10, maxx/2, maxy - 10 - height);     line(maxx/2 + base/2, maxy - 10, maxx/2, maxy - 10 - height); } void main(void) {     int maxx, maxy; // Maximum x and y pixel coordinates     int divisor; // Divisor for the length of a triangle side     // Put the machine into graphics mode and get the maximum coordinates:     initwindow(450, 300);     maxx = getmaxx( );     maxy = getmaxy( );     // Register the function that handles a left mouse click     registermousehandler(WM_LBUTTONDOWN, click_handler);     // Draw a white circle with red inside and a radius of 50 pixels:     setfillstyle(SOLID_FILL, RED);     setcolor(WHITE);     fillellipse(maxx/2, maxy/2, 50, 50);     // Print a message and wait for a red pixel to be double clicked:     settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);     outtextxy(20, 20, 'Left click in RED to end.');     setcolor(BLUE);     red_clicked = false;     divisor = 2;     while (!red_clicked)     {         triangle(maxx/divisor, maxy/divisor);         delay(500);         divisor++;     }     cout << 'The mouse was clicked at: ';     cout << 'x=' << mousex( );     cout << ' y=' << mousey( ) << endl;     // Switch back to text mode:     closegraph( ); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to use inheritance in database (Specifically in SQL Server 2005)?
Is there a way to use JQuery to cloak or encrypt email addresses on
Is there any way to use a constant as a hash key? For example:
Is there a way to use constants in JavaScript ? If not, what's the
Is there a way to use form fields that does not correspond to database
Is there any way to use C# to build a container application where each
Is there a way to use .NET reflection to capture the values of all
Is there a way to use Enum values inside a JSP without using scriptlets.
Is there a way to use THE LOOP in Wordpress to load pages instead
Is there a way to use a foreach loop to iterate through a collection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.