add Gem.sound properties
[exterlulz-kokogems.git] / src / Gem.h
blobfe41148200f44f75fd3893a4512739e871c3f8da
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
41 // Open GL Z value for gems
42 #define GEM_SPRITE_Z -0.25
44 @class OpenGLSprite;
46 @interface Gem : NSObject
48 int _gemType;
49 NSImage *_image;
51 // Open GL
52 OpenGLSprite *sprite;
54 NSSound *_tinkSound;
55 NSSound *_sploinkSound;
57 // MW
58 int waitForFall;
60 int _state;
61 int _animationCounter;
62 double vx, vy;
63 NSPoint positionOnScreen, positionOnBoard;
66 @property int gemType;
68 @property (assign) NSImage *image;
70 @property (assign) NSSound *tinkSound;
71 @property (assign) NSSound *sploinkSound;
73 @property int state;
74 @property int animationCounter;
76 - (id)init;
77 - (void)dealloc;
79 + (Gem *)gemWithNumber:(int)d andImage:(NSImage *)img;
80 + (Gem *)gemWithNumber:(int)d andSprite:(OpenGLSprite *)aSprite;
82 - (int)animate;
83 - (void)fade;
84 - (void)fall;
85 - (void)shake;
86 - (void)erupt;
88 // MW...
89 - (void)shiver;
91 - (int)gemType;
92 - (void)setGemType:(int)d;
94 - (void) drawImage;
96 - (OpenGLSprite *) sprite;
97 - (void) setSprite:(OpenGLSprite *) value;
99 - (void) drawSprite;
101 - (NSPoint) positionOnScreen;
102 - (void) setPositionOnScreen:(int) valx :(int) valy;
103 - (void) setVelocity:(int) valx :(int) valy :(int) steps;
105 - (NSPoint) positionOnBoard;
106 - (void) setPositionOnBoard:(int) valx :(int) valy;
108 @end