Skip to Content
C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners
book

C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners

by Will Briggs
December 2020
Beginner to intermediate
681 pages
11h 20m
English
Apress
Content preview from C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners
© 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... ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners

C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners

Will Briggs

Publisher Resources

ISBN: 9781484263068Purchase LinkPublisher Website