Alright, I'm finishing up my game and I want to add one more function, I tried to make it so when you clicked the right mouse button it triggered an event.
The left mouse button detector works, the right detector however, doesnt.
Heres my code:
Well, as I said, a left click gets detected, a right click doesnt. I cant figure out why.Code:#include <iostream> //Some of theyse are unneeded in this snippit #include <windows.h> //But my whole code uses them all. #include <conio.h> #include <fstream.h> #include <stdlib.h> using namespace std; void Hi() { COORD Pos, Pos2; HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE); HANDLE hOt = GetStdHandle(STD_OUTPUT_HANDLE); DWORD evk; INPUT_RECORD rec; int x_pos, y_pos, x; Pos2.X = 0; Pos2.Y = 0; while(!ok) { for(;;) { ReadConsoleInput(hIn, &rec, 1, &evk); if(rec.EventType == MOUSE_EVENT) { if(rec.Event.MouseEvent.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED) { x_pos = rec.Event.MouseEvent.dwMousePosition.X; y_pos = rec.Event.MouseEvent.dwMousePosition.Y; break; } if(rec.Event.MouseEvent.dwButtonState == FROM_LEFT_2ND_BUTTON_PRESSED) { x_pos = rec.Event.MouseEvent.dwMousePosition.X; y_pos = rec.Event.MouseEvent.dwMousePosition.Y; Pos.X = x_pos; Pos.Y = y_pos; SetConsoleCursorPosition(hOt, Pos); cout << "To!"; } } } }
Thank you very much!



LinkBack URL
About LinkBacks


