HoverRace  2.0
Viewport2D.h
Go to the documentation of this file.
1 // Viewport2D.h
2 //
3 //
4 // Copyright (c) 1995-1998 - Richard Langlois and Grokksoft Inc.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 //
22 
23 #pragma once
24 
25 #include "../Util/MR_Types.h"
26 
27 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
28 # ifdef MR_ENGINE
29 # define MR_DllDeclare __declspec( dllexport )
30 # else
31 # define MR_DllDeclare __declspec( dllimport )
32 # endif
33 #else
34 # define MR_DllDeclare
35 #endif
36 
37 namespace HoverRace {
38 namespace VideoServices {
39 
40 class VideoBuffer;
41 
43 {
44  protected:
45 
46  enum {
47  eNone = 0,
48  eBuffer = 1,
49  eXSize = 2,
50  eYSize = 4,
51  eXPitch = 8,
52  eYPitch = 16
53  };
54 
55  // VideobufferRelativeStock
57  MR_UInt8 *mBuffer; // With computed offset
58  int mLineLen;
59 
60  int mXPitch;
61  int mYPitch;
62 
63  // ViewportStock
64  int mXRes;
65  int mYRes;
66 
67  MR_DllDeclare virtual void OnMetricsChange(int pMetrics);
68 
69  public:
70 
73 
74  MR_DllDeclare void Setup(VideoBuffer * pBuffer, int pX0, int pY0, int pSizeX, int pSizeY, int pMetrics = eNone);
75  MR_DllDeclare void Clear(MR_UInt8 pColor = 0);
76 
77  MR_DllDeclare int GetXRes() const;
78  MR_DllDeclare int GetYRes() const;
79 
80  // 2DDrawing primitives, defined in VideoBuffer2DDraw.cpp
81  MR_DllDeclare void DrawPoint(int pX, int pY, MR_UInt8 pColor);
82  MR_DllDeclare void DrawLine(int pX0, int pY0, int pX1, int pY1, MR_UInt8 pColor);
83  MR_DllDeclare void DrawHorizontalLine(int pY, int pX0, int pX1, MR_UInt8 pColor);
84 
85  // HighLevel 2D functionalities
86  MR_DllDeclare void DrawHorizontalMeter(int pX0, int pXLen, int pY0, int pYHeight, int pXM, MR_UInt8 pColor, MR_UInt8 pBackColor);
87 
88  // Buffer access functions
90  int GetLineLen() const;
91 
92 };
93 
94 } // namespace VideoServices
95 } // namespace HoverRace
96 
97 #undef MR_DllDeclare
MR_UInt8 * mBuffer
Definition: Viewport2D.h:57
virtual MR_DllDeclare void OnMetricsChange(int pMetrics)
Definition: Viewport2D.cpp:48
MR_DllDeclare void DrawPoint(int pX, int pY, MR_UInt8 pColor)
Definition: Viewport2D.cpp:126
int mYRes
Definition: Viewport2D.h:65
int mLineLen
Definition: Viewport2D.h:58
int mXPitch
Definition: Viewport2D.h:60
MR_DllDeclare void Clear(MR_UInt8 pColor=0)
Definition: Viewport2D.cpp:115
int mXRes
Definition: Viewport2D.h:64
Definition: Viewport2D.h:42
MR_DllDeclare void DrawLine(int pX0, int pY0, int pX1, int pY1, MR_UInt8 pColor)
Definition: Viewport2D.cpp:162
MR_DllDeclare ~Viewport2D()
Definition: Viewport2D.cpp:44
MR_DllDeclare void DrawHorizontalMeter(int pX0, int pXLen, int pY0, int pYHeight, int pXM, MR_UInt8 pColor, MR_UInt8 pBackColor)
Definition: Viewport2D.cpp:219
MR_DllDeclare void DrawHorizontalLine(int pY, int pX0, int pX1, MR_UInt8 pColor)
Definition: Viewport2D.cpp:134
Video framebuffer for legacy (8-bit, palettized) rendering.
Definition: VideoBuffer.h:54
MR_DllDeclare void Setup(VideoBuffer *pBuffer, int pX0, int pY0, int pSizeX, int pSizeY, int pMetrics=eNone)
Definition: Viewport2D.cpp:72
MR_DllDeclare int GetYRes() const
Definition: Viewport2D.cpp:57
#define MR_DllDeclare
Definition: Viewport2D.h:34
VideoBuffer * mVideoBuffer
Definition: Viewport2D.h:56
int mYPitch
Definition: Viewport2D.h:61
MR_DllDeclare int GetXRes() const
Definition: Viewport2D.cpp:52
MR_DllDeclare Viewport2D()
Definition: Viewport2D.cpp:30
Definition: Announcement.h:24
int GetLineLen() const
Definition: Viewport2D.cpp:67
uint8_t MR_UInt8
Definition: MR_Types.h:40
MR_UInt8 * GetBuffer()
Definition: Viewport2D.cpp:62