Screen.cpp
Go to the documentation of this file.00001 //*** Screen.cpp ** 00002 00003 #include "Screen.h" 00004 #include "Bitmap_16Bit.h" 00005 #include "Platform_Screen.h" 00006 00007 00008 //*** Constructor *** 00009 00010 Screen::Screen(int width, int height): 00011 backBuffer_(0), 00012 backgroundColor_(0) 00013 { 00014 backBuffer_=new Bitmap_16bit(width,height); 00015 backBuffer_->Clear(); 00016 } 00017 00018 00019 //*** Destructor *** 00020 00021 Screen::~Screen() 00022 { 00023 delete backBuffer_; 00024 } 00025 00026 00027 //*** GetBackbuffer *** 00028 00029 Bitmap& Screen::GetBackBuffer() 00030 { 00031 return *backBuffer_; 00032 } 00033 00034 00035 //*** Present *** 00036 00037 void Screen::Present(unsigned short modulate) 00038 { 00039 if (Platform::GetPlatform_Screen()) 00040 { 00041 Platform::GetPlatform_Screen()->Present(backBuffer_->GetColorData(),backBuffer_->GetHPitch(),backBuffer_->GetVPitch(),modulate,backgroundColor_); 00042 } 00043 } 00044 00045 00046 //*** SetBackgroundColor *** 00047 00048 void Screen::SetBackgroundColor(unsigned short color) 00049 { 00050 backgroundColor_=color; 00051 } 00052 00053 00054 //*** GetBackgroundColor *** 00055 00056 unsigned short Screen::GetBackgroundColor() 00057 { 00058 return backgroundColor_; 00059 } 00060 00061 00062 //*** SetFullscreen *** 00063 00064 void Screen::SetFullscreen(bool fullscreen) 00065 { 00066 if (Platform::GetPlatform_Screen()) 00067 { 00068 Platform::GetPlatform_Screen()->SetFullscreen(fullscreen); 00069 } 00070 } 00071 00072 00073 //*** GetFullscreen *** 00074 00075 bool Screen::GetFullscreen() 00076 { 00077 if (Platform::GetPlatform_Screen()) 00078 { 00079 return Platform::GetPlatform_Screen()->GetFullscreen(); 00080 } 00081 00082 return false; 00083 } 00084 00085 00086 //*** SetInterpolationMode *** 00087 00088 void Screen::SetInterpolationMode(bool InterpolationMode) 00089 { 00090 if (Platform::GetPlatform_Screen()) 00091 { 00092 Platform::GetPlatform_Screen()->SetInterpolationMode(InterpolationMode); 00093 } 00094 } 00095 00096 00097 //*** GetInterpolationMode *** 00098 00099 bool Screen::GetInterpolationMode() 00100 { 00101 if (Platform::GetPlatform_Screen()) 00102 { 00103 return Platform::GetPlatform_Screen()->GetInterpolationMode(); 00104 } 00105 00106 return false; 00107 } 00108 00109 00110 //*** SetWindowSize *** 00111 00112 void Screen::SetWindowSize(int width, int height) 00113 { 00114 if (Platform::GetPlatform_Screen()) 00115 { 00116 Platform::GetPlatform_Screen()->SetSize(width,height); 00117 } 00118 } 00119 00120 00121 //*** GetWindowWidth *** 00122 00123 int Screen::GetWindowWidth() 00124 { 00125 if (Platform::GetPlatform_Screen()) 00126 { 00127 return Platform::GetPlatform_Screen()->GetWidth(); 00128 } 00129 00130 return 0; 00131 } 00132 00133 00134 //*** GetWindowHeight *** 00135 00136 int Screen::GetWindowHeight() 00137 { 00138 if (Platform::GetPlatform_Screen()) 00139 { 00140 return Platform::GetPlatform_Screen()->GetHeight(); 00141 } 00142 00143 return 0; 00144 } 00145 00146 00147 //*** MatchWindowToScreenSize *** 00148 00149 void Screen::MatchWindowToScreenSize() 00150 { 00151 if (Platform::GetPlatform_Screen()) 00152 { 00153 Platform::GetPlatform_Screen()->SetSize(backBuffer_->GetWidth(),backBuffer_->GetHeight()); 00154 } 00155 }
Reproduction/republishing of any material on this site without permission is strictly prohibited.
