summaryrefslogtreecommitdiffhomepage
path: root/StarsEx/Mouse.h
blob: 1c20b9522c57bc70892c05f7da298c009588ad8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2024, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.

    AUTHOR:       John DiCamillo


    OVERVIEW
    ========
    Mouse class
*/

#ifndef Mouse_h
#define Mouse_h

#include "Types.h"

// +--------------------------------------------------------------------+

class Bitmap;
class Screen;
class Window;

// +--------------------------------------------------------------------+

class Mouse
{
    friend LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    friend class Game;

public:
    static const char* TYPENAME() { return "Mouse"; }

    enum CURSOR    { ARROW, CROSS, WAIT, NOT, DRAG, USER1, USER2, USER3 };
    enum HOTSPOT   { HOTSPOT_CTR, HOTSPOT_NW };

    static int     X()               { return x; }
    static int     Y()               { return y; }
    static int     LButton()         { return l; }
    static int     MButton()         { return m; }
    static int     RButton()         { return r; }
    static int     Wheel()           { return w; }

    static void    Paint();

    static void    SetCursorPos(int x, int y);
    static void    Show(int s=1);
    static int     SetCursor(CURSOR c);
    static int     LoadCursor(CURSOR c, const char* name, HOTSPOT hs = HOTSPOT_CTR);

    static void    Create(Screen* screen);
    static void    Resize(Screen* screen);
    static void    Close();

private:
    static int     show;
    static int     cursor;

    static int     x;
    static int     y;
    static int     l;
    static int     m;
    static int     r;
    static int     w;

    static Bitmap* image[8];
    static int     hotspot[8];

    static Window* window;
};

#endif  // Mouse_h