Files
CoCoPlanes/Controller.h
T
Brian Holman 7939132267 Import coco-planes 0.1.0 upstream source snapshot
Original author: Pierre Sarrazin. Preserve upstream GPLv3-or-later and file-specific notices.
Source: http://sarrazip.com/dev/coco-planes-0.1.0.tar.gz
Archive SHA-256: 29191e6ba225965caa637ee726e1189639dc7fcdf2b68310fb93fbffd56c9c52
2026-11-09 23:39:59 -07:00

62 lines
1.2 KiB
C

#ifndef _H_Controller
#define _H_Controller
#include "KeyState.h"
enum { KEYBOARD_CONTROLLER, JOYSTICK_CONTROLLER, AUTOMATIC_CONTROLLER };
// Use for the state machine that is used with AUTOMATIC_CONTROLLER.
//
enum
{
STATE_READY_FOR_TAKE_OFF,
STATE_ON_RUNWAY,
STATE_FIRST_CLIMB,
STATE_IN_FLIGHT,
STATE_LOOPING_CLIMB,
STATE_LOOPING_DIVE,
STATE_ATTACK_CLIMB,
STATE_ATTACK_DIVE,
};
typedef struct Controller
{
byte controlType; // *_CONTROLLER enum value
struct BiplaneMover *mover;
// For KEYBOARD_CONTROLLER case:
KeyState fireKeyState;
// For JOYSTICK_CONTROLLER case:
byte joyButtonMask;
// For AUTOMATIC_CONTROLLER case:
byte state; // STATE_* value
word numFramesBeforeStateChange;
} Controller;
// probeBit: KEY_PROBE_*.
// testBit: KEY_BIT_*.
// joyButtonMask: JOY_BUTTON_*_MASK.
//
void Controller_init(Controller *self,
byte controlType,
struct BiplaneMover *mover,
byte probeBit,
byte testBit,
byte joyButtonMask);
// Must be called at each point where the plane starts exploding.
//
void Controller_onBiplaneExplosion(Controller *self);
#endif /* _H_Controller */