Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / interfaces_manager / bitmap.cpp
blob680fb91c951bdcd08c1a26c76ebe9697ebb496a1
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "stdpch.h"
21 //////////////
22 // Includes //
23 //////////////
24 // Net.
25 // 3D Interface.
26 #include "nel/3d/u_driver.h"
28 // Client.
29 #include "bitmap.h"
30 #include "interfaces_manager.h"
31 #include "graphic.h"
33 ///////////
34 // Using //
35 ///////////
36 using namespace NL3D;
37 using namespace std;
40 /////////////
41 // Externs //
42 /////////////
43 extern UDriver *Driver;
46 /////////////
47 // Globals //
48 /////////////
51 ///////////////
52 // Functions //
53 ///////////////
54 //-----------------------------------------------
55 // CBitm :
56 // Constructor.
57 //-----------------------------------------------
58 CBitm::CBitm(uint id)
59 : CControl(id)
61 init();
62 }// CBitm //
64 //-----------------------------------------------
65 // CBitm :
66 // Constructor.
67 //-----------------------------------------------
68 CBitm::CBitm(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, const CBitmapBase &bitmapBase)
69 : CControl(id, x, y, x_pixel, y_pixel, w, h, w_pixel, h_pixel), CBitmapBase(bitmapBase)
71 init();
72 }// CBitm //
74 //-----------------------------------------------
75 // CBitm :
76 // Constructor.
77 //-----------------------------------------------
78 CBitm::CBitm(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, uint texture, const CRGBA &rgba)
79 : CControl(id, x, y, x_pixel, y_pixel, w, h, w_pixel, h_pixel), CBitmapBase(texture, rgba)
81 init();
82 }// CBitm //
85 //-----------------------------------------------
86 // init :
87 // Initialize the button (1 function called for all constructors -> easier).
88 //-----------------------------------------------
89 void CBitm::init()
91 }// init //
95 //-----------------------------------------------
96 // display :
97 // Display the Button.
98 //-----------------------------------------------
99 void CBitm::display()
101 // If the control is hide -> return
102 if(!_Show)
103 return;
105 // Draw the Bitmap.
106 if ( _Tiled && !_TexturePath.empty() )
108 uint32 w, h;
109 CInterfMngr::getWindowSize(w, h);
110 drawBitmapTiled( Driver,_X_Display, _Y_Display, _W_Display, _H_Display, w, h, *_Texture, _TextureWidth, _TextureHeight, true, _RGBA);
112 else if (_Texture != NULL)
114 Driver->drawBitmap(_X_Display, _Y_Display, _W_Display, _H_Display, *_Texture, true, _RGBA);
116 else
118 Driver->drawQuad(_X_Display, _Y_Display, _W_Display, _H_Display, _RGBA);
121 // Driver->drawBitmap(_X_Display, _Y_Display, _W_Display, _H_Display, *texture, true, _RGBA);
122 }// display //