© Will Briggs 2021
W. BriggsC++20 for Lazy Programmershttps://doi.org/10.1007/978-1-4842-6306-8_4

4. Mouse, and if

Will Briggs1  
(1)
Lynchburg, VA, USA
 

In this chapter, we’ll get mouse input, and the art of making decisions, computer style.

Mouse functions

Example 4-1 shows a program to detect where you clicked the mouse and report the result. Amazing, huh? Thus, we introduce three mouse functions: SSDL_GetMouseX, SSDL_GetMouseY, and SSDL_WaitMouse.
// Program to get a mouse click, and report its location
//              -- from _C++20 for Lazy Programmers_
#include "SSDL.h"
int main(int argc, char** argv)
{
    sout << "Click the mouse and we'll see where you clicked.\n";
    // Get the mouse click
    SSDL_WaitMouse();                   // wait for click... ...

Get C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.