~tomprogs/gewoopi/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//------------------------------------------------------------------------------
// base_button.cpp - this file is part of the gewoopi game engine
// (c) copyright 2009 Thomas Geymayer <tomgey@gmail.com>
// For conditions of distribution and use, see copyright notice in gewoopi.hpp
//------------------------------------------------------------------------------

/*!
 * @file
 * @brief
 * @details
 * @author Thomas Geymayer <tomgey@gmail.com>
 * @date Date of Creation: 14.10.2009
 */

#define __SCOPE__ "input"

#include "input/base_button.hpp"

namespace gewoopi
{
namespace input
{

  //----------------------------------------------------------------------------
  BaseButton::BaseButton( const core::string& name ):
    _name( name )
  {
    LOG_STR_INFO_3("Button (" + name + ") created.");
  }

  //----------------------------------------------------------------------------
  BaseButton::~BaseButton()
  {

  }

  //----------------------------------------------------------------------------
  const bool BaseButton::isPressed() const
  {
    return getValue() > 0.2;
  }

  //----------------------------------------------------------------------------
  BaseButton::operator const BaseButton::ValueType() const
  {
    return getValue();
  }

  //----------------------------------------------------------------------------
  const bool BaseButton::operator_bool() const
  {
    return isPressed();
  }

  //----------------------------------------------------------------------------
  const std::string& BaseButton::getName() const
  {
    return _name;
  }

  //----------------------------------------------------------------------------
  void BaseButton::setName( const core::string& name )
  {
    _name = name;
  }

} // namespace input
} // namespace gewoopi