add styles
This commit is contained in:
parent
47ccf1f3b5
commit
24e07ff3bc
@ -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
20
public/styles.css
Normal 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
0
src/canvas.js
Normal file
3
src/config.json
Normal file
3
src/config.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"debug": true
|
||||
}
|
36
src/index.js
36
src/index.js
@ -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() {
|
||||
}
|
@ -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'),
|
||||
|
Loading…
Reference in New Issue
Block a user