Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Panels.h

Go to the documentation of this file.
00001 /*
00002  * Panels.h
00003  *
00004  * Part of Fly! Legacy project
00005  *
00006  * Copyright 2003 Chris Wallace
00007  *
00008  * Fly! Legacy is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  * Fly! Legacy is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  *   along with Fly! Legacy; if not, write to the Free Software
00020  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00028 #ifndef PANELS_H
00029 #define PANELS_H
00030 
00031 #include "FlyLegacy.h"
00032 #include "Gauges.h"
00033 #include <map>
00034 #include <vector>
00035 
00036 
00038 //
00039 // Vehicle panels
00040 //
00041 // The following classes represent static (i.e. fixed, non-interactive) and
00042 //   dynamic (scrolling, interactive) panels for all vehicle types, including
00043 //   ground vehicles, airplanes and helicopters.
00044 //
00046 
00047 typedef enum {
00048   PANEL_STATIC,
00049   PANEL_INTERACTIVE
00050 } EPanelType;
00051 
00052 typedef struct {
00053   int   x;
00054   int   y;
00055 } SPanelOffset;
00056 
00057 
00058 //
00059 // CPanel represents an instance of either a static or interactive panel
00060 //
00061 class CPanel : public CStreamObject {
00062 public:
00063   CPanel (Tag id, const char* filename);
00064   ~CPanel (void);
00065 
00066   virtual int   Read (SStream *stream, Tag tag);
00067   virtual void  ReadFinished (void);
00068 
00069   // CPanel methods
00070   Tag   GetId (void);
00071   void  Draw (void);
00072   void  Activate (void);
00073   void  Deactivate (void);
00074 
00075   void  CreepUp (void);
00076   void  CreepDown (void);
00077   void  CreepLeft (void);
00078   void  CreepRight (void);
00079 
00080   bool  GaugeHit (int mouseX, int mouseY, int& i, CGauge **gptr, int &x, int &y);
00081   void  GaugeMouseClick (int mouseX, int mouseY);
00082   void  GaugeTrackClick (int mouseX, int mouseY);
00083   void  GaugeStopClick (int mouseX, int mouseY);
00084   void  MouseMotion (int x, int y);
00085   void  MouseClick (int button, int updown, int x, int y);
00086 
00087   void      ScrollUp (void);
00088   void      ScrollDown (void);
00089   void      ScrollLeft (void);
00090   void      ScrollRight (void);
00091   void      Home (void);
00092   void      PageUp (void);
00093   void      PageDown (void);
00094 
00095 protected:
00096   Tag         id;
00097   char        filename[64];
00098   EPanelType  type;
00099 
00100   // Interactive panel data members
00101   char    panl[64]; // Base panel bitmap filename
00102   int     x_3Dxy, y_3Dxy;
00103   int     x_3Dsz, y_3Dsz;
00104   int     x_isiz, y_isiz;
00105 
00106   std::map<int, int>            hoff;
00107   std::map<int, SPanelOffset>   home;
00108 
00109   bool    keep;
00110   bool    scrl;
00111   bool    clao;
00112   Tag     dlid;
00113 
00114   SBitmap                   bmPanl;   // Backdrop panel bitmap
00115 //  std::vector<CPanelLight*> lite;     // Vector of panel lights
00116   std::vector<CGauge*>      gage;     // Vector of panel gauges
00117 
00118   SSurface  *surface; // Drawing surface for panel
00119   int       xScreen, yScreen;   // Window dimensions (TEMPORARY)
00120   int       xOffset;  // Offsets of top-left corner of panel to top-left
00121   int       yOffset;  //    corner of screen
00122   int       xMinLimit, xMaxLimit, yMinLimit, yMaxLimit;
00123 
00124   // Creeping flags.  These are set by the passive mouse motion method, and
00125   //   used to creep the panel in the Draw() method
00126   bool    creep_up, creep_down, creep_left, creep_right;
00127 
00128   // Mouse handling data members
00129   EClickResult  track;
00130   int       buttonsDown;
00131 
00132   // Sound effect source for this panel
00134   int       sfx_source;
00135 };
00136 
00137 
00138 #endif // PANELS_H
00139 
SourceForge.net Logo Documentation generated by doxygen