Commit 59a3d96b authored by Gerard Gascón's avatar Gerard Gascón
Browse files

refactor: made the input reader expandable

parent 12304c6b
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
using System;
using System.Collections.Generic;
using Domain.Input;

namespace Domain {
	public class CustomInput {
		private readonly Dictionary<Type, InputReader> _readers = new();

		public CustomInput() {
			_readers.Add(typeof(CedillaReader), new CedillaReader());
		}

		public void UpdateInput() {
			foreach (KeyValuePair<Type, InputReader> reader in _readers) {
				reader.Value.UpdateInput();
			}
		}

		public bool KeyDown(Type key) => _readers[key].KeyDown();
		public bool KeyPressed(Type key) => _readers[key].KeyPressed();
		public bool KeyUp(Type key) => _readers[key].KeyUp();
	}
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: aab774881fcc4971913f24037e449469
timeCreated: 1713112890
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: ad3db3db2d5e4647bad7a257606eea0c
timeCreated: 1713112359
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
namespace Domain.Input {
	public class CedillaReader : InputReader {
		protected override int Key { get; } = 0xBF; //VK_OEM_2 | cedilla
	}
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: d07951ea53d84d559bda9060a769ce93
timeCreated: 1713112770
 No newline at end of file
Loading