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 | #include "image.h" |
---|
14 | #include "sprite.h" |
---|
15 | |
---|
16 | class JCMouse |
---|
17 | { |
---|
18 | int here,but; |
---|
19 | sprite *sp; |
---|
20 | image *screen; |
---|
21 | int lx,ly,lbut,mx,my; |
---|
22 | int cx,cy; // center of mouse cursor |
---|
23 | public : |
---|
24 | JCMouse(image *Screen, palette *pal); |
---|
25 | void set_shape(image *im, int centerx=0, int centery=0); |
---|
26 | void update(int newx=-1, int newy=-1, int new_but=-1); |
---|
27 | void set_shape(image *im) { if (here) sp->change_visual(im); } |
---|
28 | int x() { if (here) return mx; else return 0; } |
---|
29 | int y() { if (here) return my; else return 0; } |
---|
30 | int drawx() { return mx-cx; } |
---|
31 | int drawy() { return my-cy; } |
---|
32 | int lastx() { if (here) return lx; else return 0; } |
---|
33 | int lasty() { if (here) return ly; else return 0; } |
---|
34 | int last_button() { if (here) return lbut; else return 0; } |
---|
35 | int button() { return but; } |
---|
36 | int exsist() { return here; } |
---|
37 | sprite *mouse_sprite() { return sp; } |
---|
38 | void set_position(int new_mx, int new_my); |
---|
39 | ~JCMouse(); |
---|
40 | |
---|
41 | #ifdef __POWERPC__ |
---|
42 | int set_button(int b) { return (but = b); } |
---|
43 | #endif |
---|
44 | } ; |
---|
45 | |
---|
46 | #endif |
---|
47 | |
---|