© Will Briggs 2019
Will BriggsC++ for Lazy Programmershttps://doi.org/10.1007/978-1-4842-5187-4_4

4. Mouse, and if

Will Briggs
(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++ 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...
    int ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.