add styles

This commit is contained in:
Alexander Popov 2022-07-29 02:34:47 +03:00
parent 47ccf1f3b5
commit 24e07ff3bc
Signed by: iiiypuk
GPG Key ID: D8C9B59A9F04A70C
6 changed files with 63 additions and 2 deletions

View File

@ -4,6 +4,7 @@
<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">
@ -13,5 +14,7 @@
</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
}

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() {
}

View File

@ -5,8 +5,7 @@ module.exports = {
entry: './src/index.js',
output: {
filename: 'game.js',
publicPath: 'public',
path: path.resolve(__dirname, 'dist'),
path: path.resolve(__dirname, 'public'),
},
devServer: {
static: path.join(__dirname, 'public'),