new life 2.0

This commit is contained in:
Alexander Popov 2022-03-28 21:04:17 +03:00
parent ac91901296
commit 7f1140f997
Signed by: iiiypuk
GPG Key ID: 3F76816AEE08F908
15 changed files with 507 additions and 470 deletions

23
.editorconfig Normal file
View File

@ -0,0 +1,23 @@
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.py]
indent_style = space
indent_size = 4
[{*.html,*.css,*.json}]
indent_style = tab
indent_size = 4
[humans.txt]
indent_style = tab
indent_size = 2
[*.js]
indent_style = space
indent_size = 2

21
LICENSE
View File

@ -1,7 +1,22 @@
MIT License
Copyright 2022 Paul Saikko
Copyright 2022 Alexander Popov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

View File

@ -1,8 +1,5 @@
# raycast
A small raycaster graphics engine in javascript with html 5 canvas.
# JSRay
A Small Raycaster Graphics Engine in JavaScript with HTML5 `<canvas>`.
Code mostly follows [this C++ raycaster tutorial](http://lodev.org/cgtutor/raycasting.html)
Live at [github.io](http://psaikko.github.io/raycast/)
![screenshot](https://raw.githubusercontent.com/psaikko/raycast/master/screenshot.png)
## Original author
Paul Saikko - [Github](https://github.com/psaikko/raycast)

21
game.js
View File

@ -1,21 +0,0 @@
var raycast = raycast || {};
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback, element){
window.setTimeout(callback, 1000 / 60);
};
})();
function start() {
document.onkeyup = raycast.keyhandler.onKeyup;
document.onkeydown = raycast.keyhandler.onKeydown;
var textureFiles = ["img/brick.png", "img/ground.png", "img/sky.png"];
raycast.texture.initiateLoad(textureFiles, raycast.engine.start);
};
window.onload = start;

View File

@ -1,17 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
</head>
<body bgcolor="999999">
<div id="canvasdiv">
<canvas id="viewport" width="800" height="600"></canvas>
</div>
<script src="keyhandler.js"></script>
<script src="texture.js"></script>
<script src="raycast.js"></script>
<script src="game.js"></script>
</body>
</html>

1
requirements-dev.txt Normal file
View File

@ -0,0 +1 @@
editorconfig-checker==2.4.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

21
src/game.js Normal file
View File

@ -0,0 +1,21 @@
var raycast = raycast || {};
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback, element){
window.setTimeout(callback, 1000 / 60);
};
})();
function start() {
document.onkeyup = raycast.keyhandler.onKeyup;
document.onkeydown = raycast.keyhandler.onKeydown;
var textureFiles = ["img/brick.png", "img/ground.png", "img/sky.png"];
raycast.texture.initiateLoad(textureFiles, raycast.engine.start);
};
window.onload = start;

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 215 B

18
src/index.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>JSRay</title>
</head>
<body bgcolor="999999">
<div id="canvasdiv">
<canvas id="viewport" width="800" height="600"></canvas>
</div>
<script src="keyhandler.js"></script>
<script src="texture.js"></script>
<script src="raycast.js"></script>
<script src="game.js"></script>
</body>
</html>