diff options
author | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-01-13 19:47:58 +1000 |
commit | f9158592e1478b2013afc7041d9ed041cf2d2f4a (patch) | |
tree | b16e389d7988700e21b4c9741044cefa536dcbae /libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp | |
parent | Libraries readme updated with change markers and more of the Irrlicht changes. (diff) | |
download | SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.zip SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.gz SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.bz2 SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.xz |
Update Irrlicht to 1.8.1. Include actual change markers this time. lol
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp deleted file mode 100644 index 1ef2c5a..0000000 --- a/libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | // This file is part of the "Irrlicht Engine". | ||
2 | // written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de | ||
3 | // modified by Thomas Alten | ||
4 | |||
5 | #include "CGUIImageList.h" | ||
6 | |||
7 | |||
8 | namespace irr | ||
9 | { | ||
10 | namespace gui | ||
11 | { | ||
12 | |||
13 | //! constructor | ||
14 | CGUIImageList::CGUIImageList( video::IVideoDriver* driver ) | ||
15 | : Driver( driver ), | ||
16 | Texture( 0 ), | ||
17 | ImageCount( 0 ), | ||
18 | ImageSize( 0, 0 ), | ||
19 | ImagesPerRow( 0 ), | ||
20 | UseAlphaChannel( false ) | ||
21 | { | ||
22 | #ifdef _DEBUG | ||
23 | setDebugName( "CGUIImageList" ); | ||
24 | #endif | ||
25 | |||
26 | if( Driver ) | ||
27 | { | ||
28 | Driver->grab(); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | |||
33 | |||
34 | //! destructor | ||
35 | CGUIImageList::~CGUIImageList() | ||
36 | { | ||
37 | if( Driver ) | ||
38 | { | ||
39 | Driver->drop(); | ||
40 | } | ||
41 | |||
42 | if( Texture ) | ||
43 | { | ||
44 | Texture->drop(); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | |||
49 | //! Creates the image list from texture. | ||
50 | bool CGUIImageList::createImageList(video::ITexture* texture, | ||
51 | core::dimension2d<s32> imageSize, | ||
52 | bool useAlphaChannel) | ||
53 | { | ||
54 | if( !texture ) | ||
55 | { | ||
56 | return false; | ||
57 | } | ||
58 | |||
59 | Texture = texture; | ||
60 | Texture->grab(); | ||
61 | |||
62 | ImageSize = imageSize; | ||
63 | |||
64 | ImagesPerRow = Texture->getSize().Width / ImageSize.Width; | ||
65 | ImageCount = ImagesPerRow * Texture->getSize().Height / ImageSize.Height; | ||
66 | |||
67 | UseAlphaChannel = useAlphaChannel; | ||
68 | |||
69 | return true; | ||
70 | } | ||
71 | |||
72 | //! Draws an image and clips it to the specified rectangle if wanted | ||
73 | void CGUIImageList::draw( s32 index, const core::position2d<s32>& destPos, | ||
74 | const core::rect<s32>* clip /*= 0*/ ) | ||
75 | { | ||
76 | core::rect<s32> sourceRect; | ||
77 | |||
78 | if( !Driver || index < 0 || index >= ImageCount ) | ||
79 | { | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | sourceRect.UpperLeftCorner.X = ( index % ImagesPerRow ) * ImageSize.Width; | ||
84 | sourceRect.UpperLeftCorner.Y = ( index / ImagesPerRow ) * ImageSize.Height; | ||
85 | sourceRect.LowerRightCorner.X = sourceRect.UpperLeftCorner.X + ImageSize.Width; | ||
86 | sourceRect.LowerRightCorner.Y = sourceRect.UpperLeftCorner.Y + ImageSize.Height; | ||
87 | |||
88 | Driver->draw2DImage( Texture, destPos, sourceRect, clip, | ||
89 | video::SColor( 255, 255, 255, 255 ), UseAlphaChannel ); | ||
90 | } | ||
91 | |||
92 | } // end namespace gui | ||
93 | } // end namespace irr | ||