1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: lyt_DrawInfo.h 4 5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Revision: 26780 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_LYT_DRAWINFO_H_ 17 #define NW_LYT_DRAWINFO_H_ 18 19 #include <nw/math/math_Types.h> 20 #include <nw/font/font_WideTextWriter.h> 21 #include <nw/ut/ut_Rect.h> 22 23 namespace nw 24 { 25 namespace lyt 26 { 27 28 class GraphicsResource; 29 class Layout; 30 31 //--------------------------------------------------------------------------- 32 //! :category 描画 33 //! 34 //! @brief 描画情報クラスです。 35 //! 36 //! @details 37 //! 全体的な描画方法の制御や、描画中の情報の受け渡しに使用されます。 38 //! 39 //! 描画の前に SetGraphicsResource() により GraphicsResource を 40 //! 設定しておく必要があります。 41 //! 42 //! @sa Layout 43 //! 44 //! @since 2009/09/18 初版。 45 //--------------------------------------------------------------------------- 46 class DrawInfo 47 { 48 public: 49 //---------------------------------------- 50 //! @name コンストラクタ/デストラクタ 51 //@{ 52 53 //! @brief コンストラクタです。 54 //! 55 //! @since 2009/09/18 初版。 56 //! 57 DrawInfo(); 58 59 //! @brief デストラクタです。 60 //! 61 //! @since 2009/09/18 初版。 62 //! 63 virtual ~DrawInfo(); 64 65 //@} 66 67 //---------------------------------------- 68 //! @name 取得/設定 69 //@{ 70 71 //! @brief 現在のビュー行列を取得します。 72 //! 73 //! @return ビュー行列を返します。 74 //! 75 //! @sa SetViewMtx 76 //! 77 //! @since 2009/09/18 初版。 78 //! GetViewMtx()79 const math::MTX34& GetViewMtx() const 80 { 81 return m_ViewMtx; 82 } 83 84 //! @brief ビュー行列を設定します。 85 //! 86 //! @param value ビュー行列です。 87 //! 88 //! @sa GetViewMtx 89 //! 90 //! @since 2009/09/18 初版。 91 //! SetViewMtx(const math::MTX34 & value)92 void SetViewMtx(const math::MTX34& value) 93 { 94 m_ViewMtx = value; 95 } 96 97 //! @brief 親のアルファ値の変化が子に影響するかどうかを判定します。 98 //! 99 //! @return 親のアルファ値の変化が子に影響する場合は true を返します。 100 //! 101 //! @sa SetInfluencedAlpha 102 //! 103 //! @since 2009/09/18 初版。 104 //! IsInfluencedAlpha()105 bool IsInfluencedAlpha() const 106 { 107 return m_Flag.influencedAlpha; 108 } 109 110 //! @brief 親のアルファ値の変化が子に影響するかどうかを設定します。 111 //! 112 //! @param bEnable 親のアルファ値の変化を子に影響させる場合には true を指定します。 113 //! 114 //! @sa IsInfluencedAlpha 115 //! 116 //! @since 2009/09/18 初版。 117 //! SetInfluencedAlpha(bool bEnable)118 void SetInfluencedAlpha(bool bEnable) 119 { 120 m_Flag.influencedAlpha = bEnable; 121 } 122 123 //! @brief 位置調整処理を行うかどうかの設定を取得します。 124 //! 125 //! @return 位置調整処理を行う場合は true を返します。 126 //! 127 //! @sa SetLocationAdjust 128 //! 129 //! @since 2009/09/18 初版。 130 //! IsLocationAdjust()131 bool IsLocationAdjust() const 132 { 133 return m_Flag.locationAdjust; 134 } 135 136 //! @brief 位置調整処理を行うかどうかを設定します。 137 //! 138 //! @param bEnable 位置調整処理を行う場合には true を指定します。 139 //! 140 //! @details 141 //! 位置調整処理を有効にした場合、Pane::IsLocationAdjust() が true を 142 //! を返すペインに位置調整処理のスケールが適用されます。 143 //! 144 //! 該当ペインの子孫ペインも位置調整処理のスケールの影響を受けます。 145 //! 146 //! @sa IsLocationAdjust 147 //! @sa SetLocationAdjustScale 148 //! @sa Pane::IsLocationAdjust 149 //! 150 //! @since 2009/09/18 初版。 151 //! SetLocationAdjust(bool bEnable)152 void SetLocationAdjust(bool bEnable) 153 { 154 m_Flag.locationAdjust = bEnable; 155 } 156 157 //! @brief 位置調整処理のスケールを取得します。 158 //! 159 //! @return 位置調整処理のスケールを返します。 160 //! 161 //! @sa SetLocationAdjustScale 162 //! 163 //! @since 2009/09/18 初版。 164 //! GetLocationAdjustScale()165 const math::VEC2& GetLocationAdjustScale() const 166 { 167 return m_LocationAdjustScale; 168 } 169 170 //! @brief 位置調整処理のスケールを設定します。 171 //! 172 //! @param scale スケールです。 173 //! 174 //! @sa GetLocationAdjustScale 175 //! 176 //! @since 2009/09/18 初版。 177 //! SetLocationAdjustScale(const math::VEC2 & scale)178 void SetLocationAdjustScale(const math::VEC2& scale) 179 { 180 m_LocationAdjustScale = scale; 181 } 182 183 //! @brief アルファ値を取得します。 184 //! 185 //! @return アルファ値を返します。 186 //! 187 //! @sa SetGlobalApha 188 //! 189 //! @since 2009/09/18 初版。 190 //! GetGlobalAlpha()191 f32 GetGlobalAlpha() const 192 { 193 return m_GlobalAlpha; 194 } 195 196 //! @brief アルファ値を設定します。 197 //! 198 //! @param alpha アルファ値です。 199 //! 200 //! @sa GetGlobalAlpha 201 //! 202 //! @since 2009/09/18 初版。 203 //! SetGlobalAlpha(f32 alpha)204 void SetGlobalAlpha(f32 alpha) 205 { 206 m_GlobalAlpha = alpha; 207 } 208 209 //! @brief 非表示のペインに対して行列計算を行うかどうかを判定します。 210 //! 211 //! @return 非表示のペインに対して行列計算を行う場合は true を返します。 212 //! 213 //! @sa SetInvisiblePaneCalculateMtx 214 //! 215 //! @since 2009/09/18 初版。 216 //! IsInvisiblePaneCalculateMtx()217 bool IsInvisiblePaneCalculateMtx() const 218 { 219 return m_Flag.invisiblePaneCalculateMtx; 220 } 221 222 //! @brief 非表示のペインに対して行列計算を行うかどうかを設定します。 223 //! 224 //! @param bEnable 非表示のペインに対して行列計算を行う場合には true を指定します。 225 //! 226 //! @details 227 //! bEnable に true を指定した場合、非表示のペインに対しても Pane::CalculateMtx() を 228 //! 呼び出して行列計算を行います。 229 //! 230 //! @sa IsInvisiblePaneCalculateMtx 231 //! @sa Pane::CalculateMtx 232 //! @sa Pane::IsVisible 233 //! 234 //! @since 2009/09/18 初版。 235 //! SetInvisiblePaneCalculateMtx(bool bEnable)236 void SetInvisiblePaneCalculateMtx(bool bEnable) 237 { 238 m_Flag.invisiblePaneCalculateMtx = bEnable; 239 } 240 241 #if ! defined(NW_RELEASE) 242 //! @brief デバッグモードか判定します。 243 //! 244 //! @details 245 //! この関数は %Final ビルドでは提供されません。 246 //! 247 //! @return デバッグモードなら true を返します。 248 //! 249 //! @sa SetDebugDrawMode 250 //! 251 //! @since 2009/09/18 初版。 252 //! IsDebugDrawMode()253 bool IsDebugDrawMode() const 254 { 255 return m_Flag.debugDrawMode; 256 } 257 258 //! @brief デバッグモードを設定します。 259 //! 260 //! @details 261 //! この関数は %Final ビルドでは提供されません。 262 //! 263 //! デバッグモードにすると Null, Bounding ペインの位置が表示されます。 264 //! 265 //! @param bEnable デバッグモードにする場合には true を指定します。 266 //! 267 //! @sa IsDebugDrawMode 268 //! 269 //! @since 2009/09/18 初版。 270 //! SetDebugDrawMode(bool bEnable)271 void SetDebugDrawMode(bool bEnable) 272 { 273 m_Flag.debugDrawMode = bEnable; 274 } 275 #endif 276 277 //! @brief %GraphicsResource オブジェクトを取得します。 278 //! 279 //! @return GraphicsResource オブジェクトへのポインタを返します。 280 //! 281 //! @sa SetGraphicsResource 282 //! 283 //! @since 2009/09/18 初版。 284 //! GetGraphicsResource()285 GraphicsResource* GetGraphicsResource() const 286 { 287 return m_pGraphicsResource; 288 } 289 290 //! @brief %GraphicsResource オブジェクトを設定します。 291 //! 292 //! @param pGraphicsResource GraphicsResource オブジェクトへのポインタです。 293 //! 294 //! @sa GetGraphicsResource 295 //! 296 //! @since 2009/09/18 初版。 297 //! SetGraphicsResource(GraphicsResource * pGraphicsResource)298 void SetGraphicsResource(GraphicsResource* pGraphicsResource) 299 { 300 m_pGraphicsResource = pGraphicsResource; 301 } 302 303 //! @brief 射影行列を設定します。 304 //! 305 //! @param mtx 射影行列です。 306 //! 307 //! @since 2009/09/18 初版。 308 //! 309 void SetProjectionMtx(const nw::math::MTX44& mtx); 310 311 //@} 312 313 //! :private 314 //! @brief 描画中のレイアウトを取得します。 315 //! 316 //! @details 317 //! Layout::Draw() の実行中に現在描画しているレイアウトを取得します。 318 //! 319 //! @return レイアウトへのポインタを返します。 320 //! GetLayout()321 Layout* GetLayout() const 322 { 323 return m_pLayout; 324 } 325 326 //! :private 327 //! @brief これから描画するレイアウトを設定します。 SetLayout(Layout * pLayout)328 void SetLayout(Layout* pLayout) const 329 { 330 m_pLayout = pLayout; 331 } 332 333 //! :private 334 //! @brief 射影行列を取得します。 GetProjectionMtx()335 const nw::math::MTX44& GetProjectionMtx() const 336 { 337 return m_ProjMtx; 338 } 339 340 protected: 341 //! @details :private 342 math::MTX44 m_ProjMtx; 343 344 //! @details :private 345 math::MTX34 m_ViewMtx; 346 347 //! @details :private 348 math::VEC2 m_LocationAdjustScale; 349 350 //! @details :private 351 f32 m_GlobalAlpha; 352 353 //! @details :private 354 GraphicsResource* m_pGraphicsResource; 355 356 //! @details :private 357 mutable Layout* m_pLayout; 358 359 //! :private 360 //! @brief フラグです。 361 struct Flag 362 { 363 u8 influencedAlpha : 1; 364 u8 locationAdjust : 1; 365 u8 invisiblePaneCalculateMtx : 1; 366 #if ! defined(NW_RELEASE) 367 u8 debugDrawMode : 1; 368 #endif 369 }; 370 371 //! @details :private 372 Flag m_Flag; 373 }; 374 375 } // namespace nw::lyt 376 } // namespace nw 377 378 #endif // NW_LYT_DRAWINFO_H_ 379 380