Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / interfaces_manager / bitmap_base.cpp
blob42cdc5ed8fc808f0badf0102fe8c73333e5425cb
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/>.
19 #include "stdpch.h"
22 /////////////
23 // Include //
24 /////////////
25 // Misc
26 #include "nel/misc/bitmap.h"
27 #include "nel/misc/path.h"
28 // Client
29 #include "bitmap_base.h"
30 #include "interfaces_manager.h"
33 //-----------------------------------------------
34 // CBitmapBase :
35 // Constructor.
36 //-----------------------------------------------
37 CBitmapBase::CBitmapBase()
39 init(0, CRGBA(255,255,255,255));
40 }// CBitmapBase //
42 //-----------------------------------------------
43 // CBitmapBase :
44 // Constructor.
45 //-----------------------------------------------
46 CBitmapBase::CBitmapBase(uint texture, const CRGBA &rgba)
48 init(texture, rgba);
49 }// CBitmapBase //
51 //-----------------------------------------------
52 // init :
53 // Initialize the class(only 1 function for all constructor -> easier).
54 //-----------------------------------------------
55 void CBitmapBase::init(uint texture, const CRGBA &rgba)
57 _RGBA = rgba;
58 _Tiled = false;
59 CBitmapBase::texture( texture );
60 }// init //
63 //-----------------------------------------------
64 // texture :
65 // Set the texture.
66 //-----------------------------------------------
67 void CBitmapBase::texture(uint texture)
69 _TextureId = texture;
70 _Texture = CInterfMngr::getTexture(_TextureId);
72 _TexturePath.clear();
73 _TextureWidth = 0;
74 _TextureHeight = 0;
76 if ( _Texture != NULL)
78 _TexturePath = NLMISC::CPath::lookup( _Texture->getFileName(), false);
80 if ( ! _TexturePath.empty() )
82 NLMISC::CBitmap bitmap;
83 bitmap.loadSize( _TexturePath , _TextureWidth, _TextureHeight);
86 }// texture //
89 //-----------------------------------------------
90 // textureId:
91 // get the textureId.
92 //-----------------------------------------------
93 uint CBitmapBase::textureId() const
95 return _TextureId;
96 }// rgba //
99 //-----------------------------------------------
100 // rgba :
101 // Set the rgba.
102 //-----------------------------------------------
103 void CBitmapBase::rgba(const CRGBA &rgba)
105 _RGBA = rgba;
106 }// rgba //
109 //-----------------------------------------------
110 // rgba :
111 // get the rgba.
112 //-----------------------------------------------
113 const CRGBA &CBitmapBase::rgba() const
115 return _RGBA;
116 }// rgba //