From 959831f4ef5a3e797f576c3de08cd65032c997ad Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 13 Jan 2013 18:54:10 +1000 Subject: Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard. --- .../irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp | 186 ++++++++++----------- 1 file changed, 93 insertions(+), 93 deletions(-) (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp') diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp index e02030d..1ef2c5a 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp +++ b/libraries/irrlicht-1.8/source/Irrlicht/CGUIImageList.cpp @@ -1,93 +1,93 @@ -// This file is part of the "Irrlicht Engine". -// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de -// modified by Thomas Alten - -#include "CGUIImageList.h" - - -namespace irr -{ -namespace gui -{ - -//! constructor -CGUIImageList::CGUIImageList( video::IVideoDriver* driver ) - : Driver( driver ), - Texture( 0 ), - ImageCount( 0 ), - ImageSize( 0, 0 ), - ImagesPerRow( 0 ), - UseAlphaChannel( false ) -{ - #ifdef _DEBUG - setDebugName( "CGUIImageList" ); - #endif - - if( Driver ) - { - Driver->grab(); - } -} - - - -//! destructor -CGUIImageList::~CGUIImageList() -{ - if( Driver ) - { - Driver->drop(); - } - - if( Texture ) - { - Texture->drop(); - } -} - - -//! Creates the image list from texture. -bool CGUIImageList::createImageList(video::ITexture* texture, - core::dimension2d imageSize, - bool useAlphaChannel) -{ - if( !texture ) - { - return false; - } - - Texture = texture; - Texture->grab(); - - ImageSize = imageSize; - - ImagesPerRow = Texture->getSize().Width / ImageSize.Width; - ImageCount = ImagesPerRow * Texture->getSize().Height / ImageSize.Height; - - UseAlphaChannel = useAlphaChannel; - - return true; -} - -//! Draws an image and clips it to the specified rectangle if wanted -void CGUIImageList::draw( s32 index, const core::position2d& destPos, - const core::rect* clip /*= 0*/ ) -{ - core::rect sourceRect; - - if( !Driver || index < 0 || index >= ImageCount ) - { - return; - } - - sourceRect.UpperLeftCorner.X = ( index % ImagesPerRow ) * ImageSize.Width; - sourceRect.UpperLeftCorner.Y = ( index / ImagesPerRow ) * ImageSize.Height; - sourceRect.LowerRightCorner.X = sourceRect.UpperLeftCorner.X + ImageSize.Width; - sourceRect.LowerRightCorner.Y = sourceRect.UpperLeftCorner.Y + ImageSize.Height; - - Driver->draw2DImage( Texture, destPos, sourceRect, clip, - video::SColor( 255, 255, 255, 255 ), UseAlphaChannel ); -} - -} // end namespace gui -} // end namespace irr +// This file is part of the "Irrlicht Engine". +// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de +// modified by Thomas Alten + +#include "CGUIImageList.h" + + +namespace irr +{ +namespace gui +{ + +//! constructor +CGUIImageList::CGUIImageList( video::IVideoDriver* driver ) + : Driver( driver ), + Texture( 0 ), + ImageCount( 0 ), + ImageSize( 0, 0 ), + ImagesPerRow( 0 ), + UseAlphaChannel( false ) +{ + #ifdef _DEBUG + setDebugName( "CGUIImageList" ); + #endif + + if( Driver ) + { + Driver->grab(); + } +} + + + +//! destructor +CGUIImageList::~CGUIImageList() +{ + if( Driver ) + { + Driver->drop(); + } + + if( Texture ) + { + Texture->drop(); + } +} + + +//! Creates the image list from texture. +bool CGUIImageList::createImageList(video::ITexture* texture, + core::dimension2d imageSize, + bool useAlphaChannel) +{ + if( !texture ) + { + return false; + } + + Texture = texture; + Texture->grab(); + + ImageSize = imageSize; + + ImagesPerRow = Texture->getSize().Width / ImageSize.Width; + ImageCount = ImagesPerRow * Texture->getSize().Height / ImageSize.Height; + + UseAlphaChannel = useAlphaChannel; + + return true; +} + +//! Draws an image and clips it to the specified rectangle if wanted +void CGUIImageList::draw( s32 index, const core::position2d& destPos, + const core::rect* clip /*= 0*/ ) +{ + core::rect sourceRect; + + if( !Driver || index < 0 || index >= ImageCount ) + { + return; + } + + sourceRect.UpperLeftCorner.X = ( index % ImagesPerRow ) * ImageSize.Width; + sourceRect.UpperLeftCorner.Y = ( index / ImagesPerRow ) * ImageSize.Height; + sourceRect.LowerRightCorner.X = sourceRect.UpperLeftCorner.X + ImageSize.Width; + sourceRect.LowerRightCorner.Y = sourceRect.UpperLeftCorner.Y + ImageSize.Height; + + Driver->draw2DImage( Texture, destPos, sourceRect, clip, + video::SColor( 255, 255, 255, 255 ), UseAlphaChannel ); +} + +} // end namespace gui +} // end namespace irr -- cgit v1.1