From 631ff8ded11fd3740d7cc2179d84743ee3f55a30 Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 10 Feb 2003 05:40:28 +0000 Subject: [PATCH] Construct from SDL_Rect --- include/ZE_ZRect.h | 10 +++++++++- src/ZE_ZRect.cpp | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/ZE_ZRect.h b/include/ZE_ZRect.h index 6d2a8d5..537a78d 100644 --- a/include/ZE_ZRect.h +++ b/include/ZE_ZRect.h @@ -13,7 +13,7 @@ File: ZE_ZRect.h
Description: Header file for core ZEngine Rectangle Object.
Author(s): James Turk
-$Id: ZE_ZRect.h,v 1.7 2003/02/10 04:40:16 cozman Exp $
+$Id: ZE_ZRect.h,v 1.8 2003/02/10 05:40:28 cozman Exp $
\file ZE_ZRect.h \brief Definition file for ZRect. @@ -66,6 +66,14 @@ class ZRect **/ ZRect(float x, float y, float width, float height); + /*! + \brief Constructor for ZRect that uses an SDL_Rect. + + Constructor for ZRect that initializes from an SDL_Rect. + \param rect SDL_Rect to intialize from. + **/ + ZRect(const SDL_Rect &rect); + /*! \brief Copy constructor for ZRect. diff --git a/src/ZE_ZRect.cpp b/src/ZE_ZRect.cpp index 449d4e2..59b0e29 100644 --- a/src/ZE_ZRect.cpp +++ b/src/ZE_ZRect.cpp @@ -13,7 +13,7 @@ File: ZE_ZRect.cpp
Description: Implementation source file for core ZEngine Rectangle Object.
Author(s): James Turk
-$Id: ZE_ZRect.cpp,v 1.8 2003/02/10 04:40:30 cozman Exp $
+$Id: ZE_ZRect.cpp,v 1.9 2003/02/10 05:40:28 cozman Exp $
\file ZE_ZRect.cpp \brief Source file for ZRect. @@ -36,6 +36,14 @@ ZRect::ZRect(float x, float y, float width, float height) : { } +ZRect::ZRect(const SDL_Rect &rect) : + rX(static_cast(rect.x)), + rY(static_cast(rect.y)), + rWidth(static_cast(rect.w)), + rHeight(static_cast(rect.h)) +{ +} + ZRect::ZRect(const ZRect &rhs) : rX(rhs.X()),rY(rhs.Y()),rWidth(rhs.Width()),rHeight(rhs.Height()) {