add koko_legumes
[exterlulz-kokogems.git] / src / Gem.h
blobd553976d61ec53e9821b3ee4e3a2785bbfa6f43c
1 /* ----====----====----====----====----====----====----====----====----====----
2 Gem.h (jeweltoy)
4 JewelToy is a simple game played against the clock.
5 Copyright (C) 2001 Giles Williams
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 ----====----====----====----====----====----====----====----====----====---- */
22 #import <Cocoa/Cocoa.h>
23 #import <Foundation/Foundation.h>
25 #define GEMSTATE_RESTING 1
26 #define GEMSTATE_FADING 2
27 #define GEMSTATE_FALLING 3
28 #define GEMSTATE_SHAKING 4
29 #define GEMSTATE_ERUPTING 5
30 #define GEMSTATE_MOVING 6
32 // MW...
34 #define GEMSTATE_SHIVERING 7
37 #define FADE_STEPS 8.0
38 #define GRAVITY 1.46
39 #define GEM_ERUPT_DELAY 45
42 // Open GL Z value for gems
44 #define GEM_SPRITE_Z -0.25
47 @class OpenGLSprite;
49 @interface Gem : NSObject
51 int gemType;
52 NSImage *image;
54 // Open GL
55 OpenGLSprite *sprite;
58 NSSound *tink;
59 NSSound *sploink;
61 // MW
62 int waitForFall;
64 int _state;
65 int _animationCounter;
66 double vx, vy;
67 NSPoint positionOnScreen, positionOnBoard;
70 @property int _state;
71 @property int _animationCounter;
73 - (id)init;
74 - (void)dealloc;
76 + (Gem *)gemWithNumber:(int)d andImage:(NSImage *)img;
77 + (Gem *)gemWithNumber:(int)d andSprite:(OpenGLSprite *)aSprite;
79 - (int) animate;
80 - (void) fade;
81 - (void) fall;
82 - (void) shake;
83 - (void) erupt;
85 // MW...
86 - (void) shiver;
88 - (int) gemType;
89 - (void) setGemType:(int) d;
91 - (NSImage *) image;
92 - (void) setImage:(NSImage *) value;
93 - (void) drawImage;
95 - (OpenGLSprite *) sprite;
96 - (void) setSprite:(OpenGLSprite *) value;
97 - (void) drawSprite;
99 - (NSPoint) positionOnScreen;
100 - (void) setPositionOnScreen:(int) valx :(int) valy;
101 - (void) setVelocity:(int) valx :(int) valy :(int) steps;
103 - (NSPoint) positionOnBoard;
104 - (void) setPositionOnBoard:(int) valx :(int) valy;
106 - (void) setSoundsTink:(NSSound *) tinkSound Sploink:(NSSound *) sploinkSound;
108 @end