summaryrefslogtreecommitdiff
path: root/lib/nes/app/input
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-01-31 23:30:56 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-01-31 23:30:56 +0100
commitccb81b60dac888e44079fb0228c1d5d8542ceade (patch)
tree297b672e2cd4de2ce4203c19b973274c5750e60d /lib/nes/app/input
parentcd8ae0e4f628bd491fcaf1dd4778bc283d619065 (diff)
move components into dedicated namespaces
Diffstat (limited to 'lib/nes/app/input')
-rw-r--r--lib/nes/app/input/input-device-controller.hh4
-rw-r--r--lib/nes/app/input/input-device-keyboard.hh4
-rw-r--r--lib/nes/app/input/input-device.hh24
-rw-r--r--lib/nes/app/input/input-manager.cc4
-rw-r--r--lib/nes/app/input/input-manager.hh4
5 files changed, 20 insertions, 20 deletions
diff --git a/lib/nes/app/input/input-device-controller.hh b/lib/nes/app/input/input-device-controller.hh
index 6adb79c..b4e6570 100644
--- a/lib/nes/app/input/input-device-controller.hh
+++ b/lib/nes/app/input/input-device-controller.hh
@@ -4,7 +4,7 @@
#include "nes/common/list.hh"
#include <string_view>
-namespace nes
+namespace nes::app
{
/// A game controller input device.
class input_device_controller : public input_device, public list<input_device_controller>::node
@@ -35,4 +35,4 @@ namespace nes
protected:
explicit input_device_controller() = default;
};
-} // namespace nes \ No newline at end of file
+} // namespace nes::app \ No newline at end of file
diff --git a/lib/nes/app/input/input-device-keyboard.hh b/lib/nes/app/input/input-device-keyboard.hh
index d61417d..dddcab6 100644
--- a/lib/nes/app/input/input-device-keyboard.hh
+++ b/lib/nes/app/input/input-device-keyboard.hh
@@ -2,7 +2,7 @@
#include "nes/app/input/input-device.hh"
-namespace nes
+namespace nes::app
{
/// A keyboard input device.
class input_device_keyboard : public input_device
@@ -13,4 +13,4 @@ namespace nes
protected:
explicit input_device_keyboard() = default;
};
-} // namespace nes \ No newline at end of file
+} // namespace nes::app \ No newline at end of file
diff --git a/lib/nes/app/input/input-device.hh b/lib/nes/app/input/input-device.hh
index 9ac7423..8e54f61 100644
--- a/lib/nes/app/input/input-device.hh
+++ b/lib/nes/app/input/input-device.hh
@@ -2,7 +2,7 @@
#include "nes/sys/types/button-mask.hh"
-namespace nes
+namespace nes::app
{
/// An abstract input device which can be used to play games.
class input_device
@@ -24,21 +24,21 @@ namespace nes
virtual auto read_key_select() -> bool = 0;
virtual auto read_key_start() -> bool = 0;
- auto read_mask() -> button_mask
+ auto read_mask() -> sys::button_mask
{
- auto res = button_mask{};
- if (read_key_up()) { res.add(buttons::up); }
- if (read_key_down()) { res.add(buttons::down); }
- if (read_key_left()) { res.add(buttons::left); }
- if (read_key_right()) { res.add(buttons::right); }
- if (read_key_a()) { res.add(buttons::a); }
- if (read_key_b()) { res.add(buttons::b); }
- if (read_key_select()) { res.add(buttons::select); }
- if (read_key_start()) { res.add(buttons::start); }
+ auto res = sys::button_mask{};
+ if (read_key_up()) { res.add(sys::buttons::up); }
+ if (read_key_down()) { res.add(sys::buttons::down); }
+ if (read_key_left()) { res.add(sys::buttons::left); }
+ if (read_key_right()) { res.add(sys::buttons::right); }
+ if (read_key_a()) { res.add(sys::buttons::a); }
+ if (read_key_b()) { res.add(sys::buttons::b); }
+ if (read_key_select()) { res.add(sys::buttons::select); }
+ if (read_key_start()) { res.add(sys::buttons::start); }
return res;
}
protected:
explicit input_device() = default;
};
-} // namespace nes \ No newline at end of file
+} // namespace nes::app \ No newline at end of file
diff --git a/lib/nes/app/input/input-manager.cc b/lib/nes/app/input/input-manager.cc
index 1c9db9e..dec899a 100644
--- a/lib/nes/app/input/input-manager.cc
+++ b/lib/nes/app/input/input-manager.cc
@@ -1,6 +1,6 @@
#include "nes/app/input/input-manager.hh"
-namespace nes
+namespace nes::app
{
namespace
{
@@ -99,4 +99,4 @@ namespace nes
}
}
}
-} // namespace nes \ No newline at end of file
+} // namespace nes::app \ No newline at end of file
diff --git a/lib/nes/app/input/input-manager.hh b/lib/nes/app/input/input-manager.hh
index 10308c7..525debc 100644
--- a/lib/nes/app/input/input-manager.hh
+++ b/lib/nes/app/input/input-manager.hh
@@ -4,7 +4,7 @@
#include "nes/app/input/input-device-controller.hh"
#include "nes/common/list.hh"
-namespace nes
+namespace nes::app
{
/// Manages input devices.
///
@@ -42,4 +42,4 @@ namespace nes
private:
auto fill_unassigned_inputs() -> void;
};
-} // namespace nes \ No newline at end of file
+} // namespace nes::app \ No newline at end of file