CeresEngine
0.2.0
A game development framework
Loading...
Searching...
No Matches
Range.hpp
Go to the documentation of this file.
1
//
2
// CeresEngine - A game development framework
3
//
4
// Created by Rogiel Sulzbach.
5
// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6
//
7
8
#pragma once
9
10
#include "
Input.hpp
"
11
12
#include "
CeresEngine/Macros.hpp
"
13
14
namespace
CeresEngine
{
15
16
class
InputState;
17
18
class
CE_SCRIPT_EXPORT
(storage =
"ref"
)
InputRange
{
19
public
:
21
CE_SCRIPT_EXPORT
()
22
double
value = 0.0;
23
24
public
:
26
virtual
~
InputRange
() =
default
;
27
28
public
:
31
[[
nodiscard
]]
explicit
operator
double
()
const
noexcept
;
32
33
public
:
// Updating
36
virtual
void
update(
const
InputState
&
state
) = 0;
37
38
protected
:
41
void
updateValue(
double
value);
42
};
43
44
class
CE_SCRIPT_EXPORT
()
AxisInputRange
final
:
public
InputRange
{
45
private
:
47
Axis
axis
;
48
49
public
:
52
CE_SCRIPT_EXPORT
()
53
explicit
AxisInputRange
(
Axis
axis
)
noexcept
;
54
55
public
:
// Updating
57
void
update(
const
InputState
&
state
)
final
;
58
};
59
60
class
CE_SCRIPT_EXPORT
()
DeltaAxisInputRange
final
:
public
InputRange
{
61
private
:
63
Axis
axis
;
64
66
double
lastValue = 0.0;
67
69
bool
receivedFirstUpdate =
false
;
70
71
public
:
75
CE_SCRIPT_EXPORT
()
76
explicit
DeltaAxisInputRange
(
Axis
axis
)
noexcept
;
77
78
public
:
// Updating
80
void
update(
const
InputState
&
state
)
final
;
81
};
82
83
template
<
typename
T
>
84
concept
CInputRange
=
std
::
is_base_of_v
<InputRange,
T
>;
85
86
}
// namespace CeresEngine
Input.hpp
Macros.hpp
CE_SCRIPT_EXPORT
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition
Macros.hpp:247
CeresEngine::AxisInputRange
Definition
Range.hpp:44
CeresEngine::AxisInputRange::axis
Axis axis
The axis to update from.
Definition
Range.hpp:47
CeresEngine::DeltaAxisInputRange
Definition
Range.hpp:60
CeresEngine::DeltaAxisInputRange::axis
Axis axis
The axis to update from.
Definition
Range.hpp:63
CeresEngine::InputRange
Definition
Range.hpp:18
CeresEngine::InputState
Definition
InputState.hpp:20
CeresEngine::CInputRange
Definition
Range.hpp:84
CeresEngine
Definition
Application.hpp:19
CeresEngine::Button::T
@ T
CeresEngine::Axis
Axis
A enumeration of known axes.
Definition
Input.hpp:400
CeresEngine::state
struct CeresEngine::GLState state
CeresEngine::axis
Axis axis(const StringView &str) noexcept
Returns the Axis constant that is represented by str.
CeresEngine::hash
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition
Hash.hpp:25
std
Definition
Span.hpp:668
Sources
CeresEngine
Input
Range.hpp
Generated by
1.9.8