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/baglib/pda.h"
27 #include "bagel/baglib/storage_dev_win.h"
28 #include "bagel/baglib/wield.h"
29 #include "bagel/baglib/pan_bitmap.h"
30 #include "bagel/boflib/stdinc.h"
31 
32 namespace Bagel {
33 
34 #define BOFCURS 1
35 
36 #define DEF_WIDTH 639
37 #define DEF_HEIGHT 479
38 
39 #define EVAL_EXPR 303
40 
41 // The height and width of the pan area
42 #define PAN_AREA_WIDTH 480
43 #define PAN_AREA_HEIGHT 360
44 
45 //
46 // CBagPanWindow -
47 // CBagPanWindow is a window that contains a slide bitmap object. It has specialize
48 // functions for handling slide bitmaps and slide objects.
49 //
51 private:
52  static int _nCorrection;
53  static int _nPanSpeed;
54 
55  //
56  // private data members
57  //
58  CPoint _xViewPortPos; // Position of the viewport
59  CRect _xMovementRect; // if mouse is in this region will not scroll
60  CRect _cLeftRect;
61  CRect _cRightRect;
62  CRect _cTopRect;
63  CRect _cBottomRect;
64 
65  CBagPanBitmap *_pSlideBitmap; // Contains the full bitmap of the world
66  CBofBitmap *_pViewPortBitmap; // Contains the current viewport bitmap
67  CBofPalette *_pPalette;
68 
69  CBofPoint _bDraggingStart; // Starting location of the dragged object
70  bool _bDraggingObject; // Whether or not the first FG object is being dragged
71 
72  bool _bStretchToScreen; // Whether or not the backdrop is painted full screen
73  bool _bPaintToBackdrop; // Whether or not the backdrop is a extra paint surface
74 
75  CBofList<CBagObject *> *_pFGObjectList; // Objects to be painted to the window
76 
77 public:
78  static CBagWield *_pWieldBmp; // Pointer to the WIELD object
79 
80  CBagPanWindow();
81  virtual ~CBagPanWindow();
82  static void initialize();
83 
84  ErrorCode attachActiveObjects() override;
85 
86  ErrorCode onRender(CBofBitmap *pBmp, CRect *pRect = nullptr) override;
87 
94  ErrorCode runModal(CBagObject *pObj) override;
95 
96  ErrorCode insertFGObjects(CBagObject *pBmp);
97  void deleteFGObjects();
98  CBagObject *getFGObjects(const CBofString &sObjName);
99 
100  CBofPalette *setSlideBitmap(const CBofString &xSlideBmp, const CRect &xSlideRect = CRect(0, 0, 0, 0));
101 
106 
107  uint32 rotateTo(CPoint &xPoint, int nRate = 8);
108 
109  void activateView();
110  void deActivateView();
111 
112  void enable() override;
113  void disable() override;
114 
115  ErrorCode paintObjects(CBofList<CBagObject *> *list, CBofBitmap *pBmp, CRect &viewOffsetRect,
116  CBofList<CRect> * = nullptr, bool tempVar = true) override;
117 
118  const CBofPoint devPtToViewPort(const CBofPoint &xPoint) override;
119  const CBofPoint viewPortToDevPt(const CBofPoint &xPoint) override;
120 
121  void setViewPortSize(const CSize &xViewSize);
122  const CRect getViewPort();
123  const CSize getViewPortSize();
124 
125  CBagPanBitmap *getSlideBitmap() const {
126  return _pSlideBitmap;
127  }
128  void setViewPortPos(const CPoint &pos) {
129  _xViewPortPos = pos; // Position of the viewport
130  }
131 
132  static void setPanSpeed(int nSpeed) {
133  _nPanSpeed = nSpeed;
134  }
135  static int getPanSpeed() {
136  return _nPanSpeed;
137  }
138 
139  const CPoint getViewPortPos() {
140  return _xViewPortPos;
141  }
142 
143  const CRect getMaxView() {
144  return _pSlideBitmap->getMaxView();
145  }
146  void setMovementRect(const CRect &rect) {
147  _xMovementRect = rect;
148  }
149  const CRect &getMovementRect() {
150  return _xMovementRect;
151  }
152  void setPaintToBackdrop(const bool bPaint) {
153  _bPaintToBackdrop = bPaint;
154  }
155  bool getStretchToScreen() {
156  return _bStretchToScreen;
157  }
158  bool setStretchToScreen(bool val = true) {
159  return _bStretchToScreen = val;
160  }
161  static int getRealCorrection() {
162  return _nCorrection;
163  }
164  static void setRealCorrection(int n) {
165  _nCorrection = n;
166  }
167  int getCorrection() {
168  return _pSlideBitmap->getCorrWidth();
169  }
170  void setCorrection(int nCorr) {
171  _pSlideBitmap->setCorrWidth(nCorr);
172  }
173  double getFOV() {
174  return _pSlideBitmap->getFOV();
175  }
176  void setFOV(double fov) {
177  _pSlideBitmap->setFOV(fov);
178  }
179 
180  CBofPalette *getPalette() {
181  return _pSlideBitmap->getPalette();
182  }
183 
184  uint32 benchmark();
185 
186 public:
187  static void flushInputEvents();
188 
189  void onClose() override;
190  void onMouseMove(uint32 nFlags, CBofPoint *p, void * = nullptr) override;
191  void onLButtonDown(uint32 nFlags, CBofPoint *point, void * = nullptr) override;
192  void onLButtonUp(uint32 nFlags, CBofPoint *point, void * = nullptr) override;
193  void onKeyHit(uint32 lKey, uint32 lRepCount) override;
194  virtual void onSize(uint32 nType, int cx, int cy);
195  void OnWindowPosChanging(WindowPos *lpwndpos);
196 
197  ErrorCode onCursorUpdate(int nCurrObj) override;
198 
199  static CBagPDA *_pPDABmp; // Pointer to the PDA object
200 
205  bool deactivatePDA();
206 
211  bool activatePDA();
212 
213  void waitForPDA();
214 };
215 
216 } // namespace Bagel
217 
218 #endif
Definition: storage_dev_win.h:406
Definition: wield.h:30
Definition: bitmap.h:55
ErrorCode runModal(CBagObject *pObj) override
Definition: rect.h:36
Definition: pan_bitmap.h:34
Definition: object.h:85
Definition: pan_window.h:50
CBofRect unSetSlideBitmap()
Definition: string.h:38
Definition: pda.h:33
Definition: stdinc.h:56
Definition: bagel.h:31
Definition: point.h:34
Definition: palette.h:69
Definition: list.h:60