1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     SmSliderBar.h
4 
5   Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain proprietary
8   information of Nintendo and/or its licensed developers and are protected by
9   national and international copyright laws. They may not be disclosed to third
10   parties or copied or duplicated in any form, in whole or in part, without the
11   prior written consent of Nintendo.
12 
13   The content herein is highly confidential and should be handled accordingly.
14 
15   $Revision: $
16  *---------------------------------------------------------------------------*/
17 #ifndef SM_SLIDERBAR_H_
18 #define SM_SLIDERBAR_H_
19 
20 #include <nw/demo.h>
21 
22 #include "../include/SmPrimitive.h"
23 #include "../include/SmMessage.h"
24 #include "../include/SmRectCollision.h"
25 #include "../include/SmCommandUtility.h"
26 
27 //------------------------------------------------------------------------------
28 // �X���C�_�[�o�[��\������N���X
29 class SmSliderBar : public SmMessage
30 {
31 public:
32     // �^�C�v
33     enum
34     {
35         SM_SLIDER_BAR_VERTICAL = 0,     // ����
36         SM_SLIDER_BAR_HORAIZON = 1      // ����
37     };
38     typedef u32 SmSliderBarType;
39 
40     // �R���X�g���N�^
41     SmSliderBar( uint x,
42                  uint y,
43                  uint length,
44                  SmSliderBarType type );
45 
46     // �f�X�g���N�^
47     ~SmSliderBar();
48 
49     // ���b�Z�[�W��M
50     virtual bool ReceveMessage( SmMessageType type, void* object, uint targetId );
51 
52     // �`��
53     virtual void Render();
54 
55     // 0.f ~ 1.f
GetSliderParam()56     f32 GetSliderParam()
57     {
58 //        return m_OffsetY;
59         return static_cast<f32>(m_OffsetY)/m_Length;
60     }
61 
62 private:
63     SmSliderBarType     m_SliderType;
64 
65     Sm2DPrimPC*         m_Bar;
66     Sm2DPrimPC*         m_Slider;
67 
68     SmRectCollision     m_Collision;
69 
70     uint                m_Length;
71     bool                m_IsGrab;
72     s32                 m_BaseX;
73     s32                 m_BaseY;
74     s32                 m_GrabX;
75     s32                 m_GrabY;
76     s32                 m_OffsetX;
77     s32                 m_OffsetY;
78     s32                 m_PreOffsetX;
79     s32                 m_PreOffsetY;
80 
81     SmCommandReuser     m_BarCmd;
82 };
83 
84 
85 
86 
87 #endif  // SM_SLIDERBAR_H_
88