source: abuse/trunk/src/imlib/mouse.h @ 645

Last change on this file since 645 was 645, checked in by Sam Hocevar, 12 years ago

imlib: clean up EventHandler? and JCMouse.

  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef __MOUSE_HPP_
12#define __MOUSE_HPP_
13
14#include "image.h"
15#include "sprite.h"
16
17class JCMouse
18{
19public:
20    JCMouse(image *screen, palette *pal);
21    ~JCMouse();
22
23    void set_shape(image *im, int centerx = 0, int centery = 0);
24    void update(int newx = -1, int newy = -1, int new_but = -1);
25    void set_shape(image *im) { if (here) sp->change_visual(im); }
26    sprite *mouse_sprite() { return sp; }
27    void set_position(int new_mx, int new_my);
28
29    int x() { return here ? mx : 0; }
30    int y() { return here ? my : 0; }
31    int drawx() { return mx - cx; }
32    int drawy() { return my - cy; }
33    int lastx() { return here ? lx : 0; }
34    int lasty() { return here ? ly : 0; }
35    int last_button() { return here ? lbut : 0; }
36    int button() { return but; }
37    int exists() { return here; }
38
39#ifdef __POWERPC__
40    int set_button(int b) { return (but = b); }
41#endif
42
43private:
44    int here, but;
45    sprite *sp;
46    image *m_screen;
47    int lx, ly, lbut, mx, my;
48    int cx, cy; // center of mouse cursor
49};
50
51#endif
52
Note: See TracBrowser for help on using the repository browser.