ScummVM API documentation
pan_window.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_BAGLIB_PAN_WINDOW_H
24 #define BAGEL_BAGLIB_PAN_WINDOW_H
25 
26 #include "bagel/spacebar/baglib/pda.h"
27 #include "bagel/spacebar/baglib/storage_dev_win.h"
28 #include "bagel/spacebar/baglib/wield.h"
29 #include "bagel/spacebar/baglib/pan_bitmap.h"
30 #include "bagel/boflib/stdinc.h"
31 
32 namespace Bagel {
33 namespace SpaceBar {
34 
35 #define BOFCURS 1
36 
37 #define DEF_WIDTH 639
38 #define DEF_HEIGHT 479
39 
40 #define EVAL_EXPR 303
41 
42 // The height and width of the pan area
43 #define PAN_AREA_WIDTH 480
44 #define PAN_AREA_HEIGHT 360
45 
46 //
47 // CBagPanWindow -
48 // CBagPanWindow is a window that contains a slide bitmap object. It has specialize
49 // functions for handling slide bitmaps and slide objects.
50 //
52 private:
53  static int _nCorrection;
54  static int _nPanSpeed;
55 
56  //
57  // private data members
58  //
59  CBofPoint _xViewPortPos; // Position of the viewport
60  CBofRect _xMovementRect; // if mouse is in this region will not scroll
61  CBofRect _cLeftRect;
62  CBofRect _cRightRect;
63  CBofRect _cTopRect;
64  CBofRect _cBottomRect;
65 
66  CBagPanBitmap *_pSlideBitmap; // Contains the full bitmap of the world
67  CBofBitmap *_pViewPortBitmap; // Contains the current viewport bitmap
68  CBofPalette *_pPalette;
69 
70  CBofPoint _bDraggingStart; // Starting location of the dragged object
71  bool _bDraggingObject; // Whether or not the first FG object is being dragged
72 
73  bool _bStretchToScreen; // Whether or not the backdrop is painted full screen
74  bool _bPaintToBackdrop; // Whether or not the backdrop is a extra paint surface
75 
76  CBofList<CBagObject *> *_pFGObjectList; // Objects to be painted to the window
77 
78 public:
79  static CBagWield *_pWieldBmp; // Pointer to the WIELD object
80 
81  CBagPanWindow();
82  virtual ~CBagPanWindow();
83  static void initialize();
84 
85  ErrorCode attachActiveObjects() override;
86 
87  ErrorCode onRender(CBofBitmap *pBmp, CBofRect *pRect = nullptr) override;
88 
95  ErrorCode runModal(CBagObject *pObj) override;
96 
97  ErrorCode insertFGObjects(CBagObject *pBmp);
98  void deleteFGObjects();
99  CBagObject *getFGObjects(const CBofString &sObjName);
100 
101  CBofPalette *setSlideBitmap(const CBofString &xSlideBmp, const CBofRect &xSlideRect = CBofRect(0, 0, 0, 0));
102 
107 
108  uint32 rotateTo(CBofPoint &xPoint, int nRate = 8);
109 
110  void activateView();
111  void deActivateView();
112 
113  void enable() override;
114  void disable() override;
115 
116  ErrorCode paintObjects(CBofList<CBagObject *> *list, CBofBitmap *pBmp, CBofRect &viewOffsetRect,
117  CBofList<CBofRect> * = nullptr, bool tempVar = true) override;
118 
119  const CBofPoint devPtToViewPort(const CBofPoint &xPoint) override;
120  const CBofPoint viewPortToDevPt(const CBofPoint &xPoint) override;
121 
122  void setViewPortSize(const CBofSize &xViewSize);
123  const CBofRect getViewPort();
124  const CBofSize getViewPortSize();
125 
126  CBagPanBitmap *getSlideBitmap() const {
127  return _pSlideBitmap;
128  }
129  void setViewPortPos(const CBofPoint &pos) {
130  _xViewPortPos = pos; // Position of the viewport
131  }
132 
133  static void setPanSpeed(int nSpeed) {
134  _nPanSpeed = nSpeed;
135  }
136  static int getPanSpeed() {
137  return _nPanSpeed;
138  }
139 
140  const CBofPoint getViewPortPos() {
141  return _xViewPortPos;
142  }
143 
144  const CBofRect getMaxView() {
145  return _pSlideBitmap->getMaxView();
146  }
147  void setMovementRect(const CBofRect &rect) {
148  _xMovementRect = rect;
149  }
150  const CBofRect &getMovementRect() {
151  return _xMovementRect;
152  }
153  void setPaintToBackdrop(const bool bPaint) {
154  _bPaintToBackdrop = bPaint;
155  }
156  bool getStretchToScreen() {
157  return _bStretchToScreen;
158  }
159  bool setStretchToScreen(bool val = true) {
160  return _bStretchToScreen = val;
161  }
162  static int getRealCorrection() {
163  return _nCorrection;
164  }
165  static void setRealCorrection(int n) {
166  _nCorrection = n;
167  }
168  int getCorrection() {
169  return _pSlideBitmap->getCorrWidth();
170  }
171  void setCorrection(int nCorr) {
172  _pSlideBitmap->setCorrWidth(nCorr);
173  }
174  double getFOV() {
175  return _pSlideBitmap->getFOV();
176  }
177  void setFOV(double fov) {
178  _pSlideBitmap->setFOV(fov);
179  }
180 
181  CBofPalette *getPalette() {
182  return _pSlideBitmap->getPalette();
183  }
184 
185  uint32 benchmark();
186 
187 public:
188  static void flushInputEvents();
189 
190  void onClose() override;
191  void onMouseMove(uint32 nFlags, CBofPoint *p, void * = nullptr) override;
192  void onLButtonDown(uint32 nFlags, CBofPoint *point, void * = nullptr) override;
193  void onLButtonUp(uint32 nFlags, CBofPoint *point, void * = nullptr) override;
194  void onKeyHit(uint32 lKey, uint32 lRepCount) override;
195  virtual void onSize(uint32 nType, int cx, int cy);
196  void OnWindowPosChanging(WindowPos *lpwndpos);
197 
198  ErrorCode onCursorUpdate(int nCurrObj) override;
199 
200  static CBagPDA *_pPDABmp; // Pointer to the PDA object
201 
206  bool deactivatePDA();
207 
212  bool activatePDA();
213 
214  void waitForPDA();
215 };
216 
217 } // namespace SpaceBar
218 } // namespace Bagel
219 
220 #endif
Definition: pda.h:34
Definition: size.h:32
Definition: object.h:86
Definition: rect.h:35
Definition: wield.h:31
Definition: string.h:38
Definition: stdinc.h:58
Definition: palette.h:64
Definition: afxwin.h:27
Definition: pan_window.h:51
Definition: point.h:32
Definition: storage_dev_win.h:410
Definition: list.h:60
ErrorCode runModal(CBagObject *pObj) override
Definition: bitmap.h:57
Definition: pan_bitmap.h:35