+ 2
How can I read a mouse click on some character that is printed? (I can get its position in a COORD)...
I have an Airline Reservation Program. Now, to book the seats, one must enter them as strings in my current implementation like 1A, 4G and they will be marked automatically in real time and shown to the user in red color. Now I wished to know if there is a way I can remove the input part from keyboard and just allow the user to click on a seat and it gets selected? How can I achieve this? Please help as I have no idea about mouse inputs... (I am a beginner in such matters) Thank You in advance!
12 odpowiedzi
+ 4
sorry bro I forget to post the code.
here is the code
https://code.sololearn.com/cwnpB9LUGia2/?ref=app
+ 2
@MR Programmer
Will you be kind enough to answer as well?
+ 2
you have to use a graphics library like sdl
or
#include <Windows.h>
// inside main
POINT p;
GetCursorPos(&p);
p.x --------> x pos of mouse
p.y----------> y pos of mouse
+ 2
@MR Programmer
I specified that I can get the coordinates of the character I want to recieve a click on...
All I wish to know is how to call thr book function I have made when the user presses the left key on the seat 1A or 4H
+ 2
I could get you , do you want. button so that when you press it do something
+ 2
Tell me how to make that...
Ill modify it according to my requirements
+ 2
but you have to change lots of code , because button comes on the category of gui.
+ 2
You are using SDL or Windows.h?
+ 2
Windows.h , sdl still Learning
+ 2
It doesn't matter, just give it to me.
Ill modify. That will help me learn
+ 2
Still Waiting...
Just till tomorrow...
Then...
+ 1
Do you need the code ?