99bfe88aa54992045c40f01354836a9a2dbfe87a
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ControlEngine / iPhone / Classes / Menus / HUD.h
1 #include "ConstantsAndMacros.h"
2 #import "ARDrone.h"
3 #import "SettingsMenu.h"
4
5 typedef void (*control_callback)(float percent);
6
7 typedef struct Joystick
8 {
9         // Value between -1.0 and 1.0
10         bool_t can_use_accelero;
11         control_callback up_down;
12         control_callback left_right;
13 } JOYSTICK;
14
15 typedef struct Controls
16 {
17         JOYSTICK Left;
18         JOYSTICK Right;
19 } CONTROLS;
20
21 @interface HUD : UIViewController <UIAccelerometerDelegate, SettingsMenuDelegate> {
22     IBOutlet UILabel     *messageBoxLabel;
23     IBOutlet UILabel     *batteryLevelLabel;
24         
25         IBOutlet UIImageView *batteryImageView;
26         IBOutlet UIImageView *joystickRightThumbImageView;
27         IBOutlet UIImageView *joystickRightBackgroundImageView;
28         IBOutlet UIImageView *joystickLeftThumbImageView;
29         IBOutlet UIImageView *joystickLeftBackgroundImageView;
30         
31         IBOutlet UIButton        *backToMainMenuButton;
32         IBOutlet UIButton    *settingsButton;
33         IBOutlet UIButton    *switchScreenButton;
34     IBOutlet UIButton    *takeOffButton;
35         IBOutlet UIButton        *emergencyButton;
36         
37         IBOutlet UIButton        *joystickRightButton;
38         IBOutlet UIButton        *joystickLeftButton;
39         
40         BOOL firePressed;
41         BOOL settingsPressed;
42         BOOL mainMenuPressed;
43         
44         CONTROLS controls;
45 }
46
47 @property (nonatomic, assign) BOOL firePressed;
48 @property (nonatomic, assign) BOOL settingsPressed;
49 @property (nonatomic, assign) BOOL mainMenuPressed;
50
51 - (id)initWithFrame:(CGRect)frame withState:(BOOL)inGame withHUDConfiguration:(ARDroneHUDConfiguration)hudconfiguration withControlData:(ControlData*)data;
52 - (void)setMessageBox:(NSString*)str;
53 - (void)setTakeOff:(NSString*)str;
54 - (void)setEmergency:(NSString*)str;
55 - (void)setBattery:(int)percent;
56 - (void)changeState:(BOOL)inGame;
57 - (void)showBackToMainMenu:(BOOL)show;
58
59 - (IBAction)buttonPress:(id)sender forEvent:(UIEvent *)event;
60 - (IBAction)buttonRelease:(id)sender forEvent:(UIEvent *)event;
61 - (IBAction)buttonClick:(id)sender forEvent:(UIEvent *)event;
62 - (IBAction)buttonDrag:(id)sender forEvent:(UIEvent *)event;
63 @end