1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     SmSliderBar.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: 1 $
14  *---------------------------------------------------------------------------*/
15 #ifndef SM_SLIDERBAR_H_
16 #define SM_SLIDERBAR_H_
17 
18 #include <nw/demo.h>
19 
20 #include "../include/SmPrimitive.h"
21 #include "../include/SmMessage.h"
22 #include "../include/SmRectCollision.h"
23 #include "../include/SmCommandUtility.h"
24 
25 //------------------------------------------------------------------------------
26 // �X���C�_�[�o�[��\������N���X
27 class SmSliderBar : public SmMessage
28 {
29 public:
30     // �^�C�v
31     enum
32     {
33         SM_SLIDER_BAR_VERTICAL = 0,     // ����
34         SM_SLIDER_BAR_HORAIZON = 1      // ����
35     };
36     typedef u32 SmSliderBarType;
37 
38     // �R���X�g���N�^
39     SmSliderBar( uint x,
40                  uint y,
41                  uint length,
42                  SmSliderBarType type );
43 
44     // �f�X�g���N�^
45     ~SmSliderBar();
46 
47     // ���b�Z�[�W��M
48     virtual bool ReceveMessage( SmMessageType type, void* object, uint targetId );
49 
50     // �`��
51     virtual void Render();
52 
53     // 0.f ~ 1.f
GetSliderParam()54     f32 GetSliderParam()
55     {
56 //        return m_OffsetY;
57         return static_cast<f32>(m_OffsetY)/m_Length;
58     }
59 
60 private:
61     SmSliderBarType     m_SliderType;
62 
63     Sm2DPrimPC*         m_Bar;
64     Sm2DPrimPC*         m_Slider;
65 
66     SmRectCollision     m_Collision;
67 
68     uint                m_Length;
69     bool                m_IsGrab;
70     s32                 m_BaseX;
71     s32                 m_BaseY;
72     s32                 m_GrabX;
73     s32                 m_GrabY;
74     s32                 m_OffsetX;
75     s32                 m_OffsetY;
76     s32                 m_PreOffsetX;
77     s32                 m_PreOffsetY;
78 
79     SmCommandReuser     m_BarCmd;
80 };
81 
82 
83 
84 
85 #endif  // SM_SLIDERBAR_H_
86