Compare commits

...

3 Commits

Author SHA1 Message Date
Alexander Popov 24e07ff3bc
add styles 2022-07-29 02:34:47 +03:00
Alexander Popov 47ccf1f3b5
💀 2022-07-28 23:58:54 +03:00
Alexander Popov 3e036598a2
new 2022-07-28 23:57:59 +03:00
11 changed files with 2180 additions and 1 deletions

21
.editorconfig Normal file
View File

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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
dist/

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) <year> <copyright holders>
Copyright (c) 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:

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"license": "MIT",
"private": true,
"scripts": {
"serve": "webpack serve",
"build": "webpack"
},
"dependencies": {
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},
"devDependencies": {
"webpack-dev-server": "^4.9.3"
}
}

20
public/index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>test</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div class="container">
<div class="canvas">
<canvas id="game" width="400" height="620">
<!-- ... -->
</canvas>
</div>
</div>
<script type="text/javascript" src="game.js"></script>
</body>
</html>

20
public/styles.css Normal file
View File

@ -0,0 +1,20 @@
@font-face {
font-family: 'Monogram';
src: url('/assets/monogram-extended.ttf') format('truetype');
font-weight: 500;
font-style: normal;
font-display: swap;
}
body {
margin: 0;
}
div.canvas {
text-align: center;
padding: 8px;
}
canvas#game {
border: 2px solid #5d5d5d;
}

0
src/canvas.js Normal file
View File

3
src/config.json Normal file
View File

@ -0,0 +1,3 @@
{
"debug": true
}

36
src/index.js Normal file
View File

@ -0,0 +1,36 @@
'use strict';
// engine config file
import config from './config.json';
const DEBUG = config.debug;
let canvas = null;
let context = null;
let cW = null;
let cH = null;
window.onload = function() {
canvas = document.getElementById('game');
context = canvas.getContext('2d');
cW = canvas.width;
cH = canvas.height;
// print canvas size
if (DEBUG) console.log(`Canvas size ${cW} x ${cH}`);
window.requestAnimationFrame(gameLoop);
}
function gameLoop(timeStamp) {
update();
draw();
window.requestAnimationFrame(gameLoop);
}
function update() {
//
}
function draw() {
}

15
webpack.config.js Normal file
View File

@ -0,0 +1,15 @@
const path = require('path');
module.exports = {
mode: 'development',
entry: './src/index.js',
output: {
filename: 'game.js',
path: path.resolve(__dirname, 'public'),
},
devServer: {
static: path.join(__dirname, 'public'),
compress: false,
port: 55555,
},
};

2048
yarn.lock Normal file

File diff suppressed because it is too large Load Diff