diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 13:39:40 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-01-19 13:39:40 -0500 |
commit | 76446f179d3de3b5635e8b4c40e1bd49ea99995c (patch) | |
tree | 9d79082ecde0866d27062f9b2d940f85caefbb21 /public/gl/io | |
parent | merge (diff) | |
download | webgl-76446f179d3de3b5635e8b4c40e1bd49ea99995c.tar.gz webgl-76446f179d3de3b5635e8b4c40e1bd49ea99995c.tar.bz2 webgl-76446f179d3de3b5635e8b4c40e1bd49ea99995c.zip |
cube working
Diffstat (limited to 'public/gl/io')
-rw-r--r-- | public/gl/io/File.js (renamed from public/gl/io/file.js) | 4 | ||||
-rw-r--r-- | public/gl/io/Input.js | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/public/gl/io/file.js b/public/gl/io/File.js index f89565c..2b3c23b 100644 --- a/public/gl/io/file.js +++ b/public/gl/io/File.js @@ -1,6 +1,6 @@ -export { readFileAsync } +export const File = {} -const readFileAsync = async (path) => { +File.readFileAsync = async (path) => { try { let data = await fetch(path) let text = await data.text() diff --git a/public/gl/io/Input.js b/public/gl/io/Input.js new file mode 100644 index 0000000..ecc4af5 --- /dev/null +++ b/public/gl/io/Input.js @@ -0,0 +1,16 @@ +export const Input = {} + +const keys = {} +Input.setup = () => { + document.onkeydown = function(e) { + keys[e.key] = true + + }; + document.onkeyup = function(e) { + keys[e.key] = false + } +} + +Input.isKeyDown = (key) => { + return keys[key] +}
\ No newline at end of file |