📄 gballoon.h
字号:
#ifndef _GBALLOON_H
#define _GBALLOON_H
// class for balloon manipulation using simulated auto pilot
// (based on an idea of Dave Reed)
// modified: 8/30/94, 12/29/94, 11/3/95
// graphics version 3/22/99
//
// member function explanation:
//
// Ascend: rise to specified height in a sequence of burns
// Each burn raises the altitude by 10 meters
//
// Cruise: cruise for specified time-steps/seconds
// Random wind-shear can cause balloon to rise and fall,
// but vents and burns keep ballon within 5 m. of start altitude
//
// Descend: descend to specified height in sequence of vents
// Each vent drops the balloon 10 m. or to ground if < 10 m.
//
// int GetAltitude: returns altitude (in meters) (y-coord)
// int GetLocation: returns how many time steps/secs elapsed (x-coord)
#include "canvas.h"
#include "utils.h"
class Balloon
{
public:
Balloon(); // use default color (gold)
Balloon(color c); // balloon of specified color
void Ascend (int height); // ascend so altitude >= parameter
void Descend (int height); // descend so altitude <= parameter
void Cruise (int steps); // cruise for parameter time-steps
int GetAltitude() const; // returns height above ground (y-coord)
int GetLocation() const; // returns # time-steps (x-coord)
private:
void Create(color c);
void Burn();
void Vent();
void AdjustAltitude();
void Display();
void Message();
int myAltitude;
int mySteps;
Mover * myShape;
TextShape * myLegend;
static AnimatedCanvas ourCanvas;
static int ourCount;
int myCount;
int myDisplayHeight;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -