1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gr_Viewport.h
4 
5   Copyright (C)2010 Nintendo Co., Ltd.  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   $Rev: 26151 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_GR_VIEWPORT_H_
17 #define NN_GR_VIEWPORT_H_
18 
19 #include <nn/gr/CTR/gr_Prefix.h>
20 #include <nn/gr/CTR/gr_Utility.h>
21 
22 namespace nn
23 {
24     namespace gr
25     {
26         namespace CTR
27         {
28 
29             /*!
30                 @brief ビューポート関連のコマンドを生成するためのクラスです。
31                        あらかじめ x, y, width, heightの各メンバに値を入れておき、MakeCommand() でコマンドを生成します。
32             */
33             class Viewport
34             {
35             public:
36                 /*!
37                     @brief デフォルト値(0, 0, 240, 320)で初期化するコンストラクタです。
38                 */
Viewport(void)39                 Viewport( void ) : x( 0 ), y( 0 ), width( 240 ), height( 320 ) {}
40 
41                 /*!
42                     @brief 指定した値で初期化するコンストラクタです。
43 
44                     @param[in]   x_      ビューポート左下端のx座標です。
45                     @param[in]   y_      ビューポート左下端のy座標です。
46                     @param[in]   width_  ビューポートの幅です。
47                     @param[in]   height_ ビューポートの高さです。
48                  */
Viewport(s32 x_,s32 y_,u32 width_,u32 height_)49                 Viewport( s32 x_, s32 y_, u32 width_, u32 height_ ) : x( x_ ), y( y_ ), width( width_ ), height( height_ ) {}
50 
51             public:
52                 /*!
53                     @brief 設定された情報をもとに、描画コマンドを生成します。
54 
55                     @param[in]    command    描画コマンド書き込み先の先頭アドレスです。
56 
57                     @return                  書き込まれた描画コマンドの終端の次のアドレスを返します。
58                 */
59                 u32* MakeCommand( u32* command );
60 
61             public:
62                 /*!
63                     @brief パラメータを一括で指定する便利関数です。
64                            この関数を使わずに直接メンバ変数に代入を行ってもかまいません。
65 
66                     @param[in]   x_      ビューポート左下端のx座標です。
67                     @param[in]   y_      ビューポート左下端のy座標です。
68                     @param[in]   width_  ビューポートの幅です。
69                     @param[in]   height_ ビューポートの高さです。
70                 */
Set(s32 x_,s32 y_,u32 width_,u32 height_)71                 void Set( s32 x_, s32 y_, u32 width_, u32 height_ )
72                 {
73                     x = x_; y = y_; width = width_; height = height_;
74                 }
75 
76             public:
77                 /*!
78                     @brief ビューポート左下端のx座標です。型は s32 です。
79                 */
80                 s32	x;
81 
82                 /*!
83                     @brief ビューポート左下端のy座標です。型は s32 です。
84                 */
85                 s32	y;
86 
87                 /*!
88                     @brief ビューポートの幅です。型は u32 です。
89                 */
90                 u32	width;
91 
92                 /*!
93                     @brief ビューポートの高さです。型は u32 です。
94                 */
95                 u32	height;
96             };
97 
98         } // namespace CTR
99     } // namespace gr
100 } // namespace nn
101 
102 #endif // NN_GR_VIEWPORT_H_
103