Skip to content

Commit

Permalink
Merge pull request #12 from anag0/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ernestmarcinko authored Jul 8, 2023
2 parents 63076a9 + d02e6e5 commit 053a8b4
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 2 deletions.
1 change: 1 addition & 0 deletions dist/flappybird.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"copy-webpack-plugin": "^11.0.0",
"cssnano": "^6.0.1",
"esc": "^0.0.3",
"flappybird-ts": "^0.1.2",
"nodemon": "^2.0.22",
"postcss": "^8.4.23",
"webpack": "^5.84.0",
Expand Down
10 changes: 10 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ app.get('/typewriter', function(req, res) {
});
});

app.get('/flappybird', function(req, res) {
var att = {
title: 'Flappy Bird in TypeScript by Ernest Marcinko',
description: 'Play Flappy Bird online. Created in javascript, typescript using a canvas.'
};
res.render('pages/flappybird',{
att: att,
});
});

let sitemap;
app.get('/sitemap.xml', async function(req, res) {
res.header('content-type', 'application/xml');
Expand Down
12 changes: 12 additions & 0 deletions src/flappybird.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import FlappyBird from "flappybird-ts";

function flappy() {
new FlappyBird('game');
}

if (document.readyState === "complete" || document.readyState === "loaded" || document.readyState === "interactive") {
// document is already ready to go
flappy();
} else {
window.addEventListener('DOMContentLoaded', flappy);
}
20 changes: 20 additions & 0 deletions views/pages/flappybird.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../parts/head'); %>
</head>
<body>
<main class="wrapper" role="main">
<section class="intro" style="width:auto">
<h1 id="tw1">Flappy Bird TS</h1>
<p>You can integrate this Flappy Bird game to your project</p>
<p><a href='https://youtu.be/3HwsIWoDhrU'>YouTube Video</a> | <a href='https://github.com/anag0/flappybird'>Github repository</a> | <a href="https://www.npmjs.com/package/flappybird-ts">npm</a></p>
<pre>npm i flappybird-ts --save-dev</pre>
<p><canvas id="game"></canvas></p>
<p><a href='../'><< Back Home</a></p>
</section>
</main>
<script src="/dist/flappybird.js" async></script>
<%- include('../parts/footer'); %>
</body>
</html>
13 changes: 13 additions & 0 deletions views/pages/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
</p>
</section>
<section class="projects flexy">
<div class="project">
<a class="title" href="/flappybird/">
<h2>Flappy Bird in TypeScript</h2>
</a>
<p>The Flappy Bird game written compltely in TypeScript, packed into a NPM package.</p>
<p>Do not get angry while playing.</p>
<ul>
<li><a href='/flappybird/'>Play</a></li>
<li><a href='https://youtu.be/3HwsIWoDhrU'>YouTube Video</a></li>
<li><a href='https://github.com/anag0/flappybird' target="_blank">Github Repository</a></li>
<li><a href='https://www.npmjs.com/package/flappybird-ts' target="_blank">npm Repository</a></li>
</ul>
</div>
<div class="project">
<a class="title" target="_blank" href="https://dominijs.com/">
<img alt="Ajax Search Pro" src="img/64-dominijs.png">
Expand Down
12 changes: 10 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { default as postcss } from 'postcss';

const __dirname = getDirName(import.meta.url);

export default {
export default [{
entry: './src/site.js',
output: {
path: path.resolve(__dirname, 'dist'),
Expand Down Expand Up @@ -33,4 +33,12 @@ export default {
],

watch: true,
};
},
{
entry: './src/flappybird.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'flappybird.js',
},
}
];

0 comments on commit 053a8b4

Please sign in to comment.