-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nasrulcodes/dev
Dev
- Loading branch information
Showing
13 changed files
with
508 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,130 @@ | ||
:root{ | ||
font-size: 100%; | ||
background-color: #0f768d; | ||
} | ||
div.container{ | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
} | ||
div.container > div.screen{ | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
} | ||
|
||
div.container > div.screen >div.content >canvas{ | ||
position:absolute; | ||
border-radius: 2%; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
div.container > div.screen >div.menu{ | ||
height: 10%; | ||
width: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
color: white; | ||
font-size: 1.2rem; | ||
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; | ||
} | ||
div.container > div.screen >div.menu>span{ | ||
padding-right: .3rem; | ||
padding-left: .3rem; | ||
display: flex; | ||
align-items: center; | ||
} | ||
div.container > div.screen >div.menu> span >img{ | ||
width: 1.2rem; | ||
height: 1.2rem; | ||
} | ||
div.container > div.screen >div.footer{ | ||
height: 10%; | ||
width: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
color: white; | ||
font-size: 1.2rem; | ||
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; | ||
} | ||
div.container > div.screen >div.footer> a{ | ||
text-decoration: none; | ||
color: white ; | ||
display: flex; | ||
align-items: center; | ||
} | ||
div.container canvas.main-canvas{ | ||
div.container > div.screen >div.footer> a > span{ | ||
display: flex; | ||
height: 90vmin; | ||
width: 90vmin; | ||
} | ||
align-items: center; | ||
padding-right: .3rem; | ||
} | ||
div.container > div.screen >div.footer> a >span >img{ | ||
width: 1.2rem; | ||
height: 1.2rem; | ||
} | ||
div.container > div.screen >div.content{ | ||
border-radius: 2%; | ||
box-shadow: rgba(100, 100, 111, 0.9) 0px 7px 29px 0px; | ||
position: relative; | ||
height: 80%; | ||
width: 80%; | ||
} | ||
div.container > div.screen > div.content > div.game-over > p{ | ||
color: white; | ||
font-size: 1.5rem; | ||
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; | ||
} | ||
div.container > div.screen > div.content > div.game-over{ | ||
position:absolute; | ||
border-radius: 2%; | ||
height: 100%; | ||
width: 100%; | ||
background-color: rgba(0, 0, 0, .5); | ||
display: none; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
z-index: 999; | ||
} | ||
div.container > div.screen >div.content> div.game-over > span.play-again{ | ||
color: white; | ||
border: .2rem solid white; | ||
transition: .3s; | ||
} | ||
div.container > div.screen >div.content> div.game-over > span.play-again:hover{ | ||
color: black; | ||
background-color: white; | ||
} | ||
div.container > div.screen >div.content> div.game-over > span.button{ | ||
cursor: pointer; | ||
text-align: center; | ||
border-radius: .9rem; | ||
padding: 1rem; | ||
font-size: 2rem; | ||
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; | ||
} | ||
@media only screen and (max-width: 600px) { | ||
div.container > div.screen >div.content{ | ||
height: 90%; | ||
width: 90%; | ||
} | ||
div.container > div.screen >div.menu{ | ||
height: 5%; | ||
position: absolute; | ||
top: -5%; | ||
} | ||
div.container > div.screen >div.footer | ||
{ | ||
height: 5%; | ||
position: absolute; | ||
bottom: -5%; | ||
} | ||
div.container > div.screen >div.content> div.game-over > span.play-again{ | ||
transition: none; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
// stored canvas element from html | ||
export const main = document.getElementById("main-canvas"); | ||
export const pointer = document.getElementById("pointer-canvas"); | ||
export const stroke = document.getElementById("stroke-canvas"); | ||
export const screen = document.querySelector(".screen"); | ||
export const gameOverScreen = document.querySelector(".game-over"); | ||
export const flag = document.querySelector(".menu .flags p"); | ||
export const gameOverOption = document.querySelector(".game-over p"); | ||
export const root = document.querySelector(":root"); | ||
// get the context of the canvas for drawing pusposes; | ||
export const ctx = main.getContext("2d", { alpha: false }); | ||
export const ptrCtx = pointer.getContext("2d"); | ||
export const strCtx = stroke.getContext("2d"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
// class for configuration of the canvas | ||
export default class Config { | ||
// size of a grid in the canvas | ||
static size = 10; | ||
static bomCount = 15; | ||
static size = 15; | ||
static bomCount = 25; | ||
} | ||
export class Theme { | ||
static defaultFontSize = 1000; | ||
static boomIconUrl = "./img/bomb-icon.png"; | ||
static boomIconSize = 0.9; | ||
static boomIconSize = 0.7; | ||
static flagIconUrl = "./img/flag-icon.png"; | ||
static flagIconSize = 0.7; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
import { main as canvas } from "./canvas.js"; | ||
import { partialRender } from "./grid-generator.js"; | ||
import { pointer, gameOverScreen } from "./canvas.js"; | ||
import { partialRender, pointerRender } from "./grid-generator.js"; | ||
import { run as runUI } from "./ui-handler.js"; | ||
import initStyle from "./style.js"; | ||
// init event | ||
export function init() { | ||
// register event listener for prevent context menu | ||
addEventListener("resize", (e) => { | ||
if (screen.width < screen.height) return; | ||
initStyle(); | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}); | ||
pointer.addEventListener("contextmenu", (e) => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}); | ||
// register event listener for canvas element | ||
gameOverScreen.addEventListener("mouseup", (e) => { | ||
// render just one part of the grid | ||
runUI(e); | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}); | ||
// register event listener for canvas element | ||
canvas.addEventListener("click", (e) => { | ||
pointer.addEventListener("mouseup", (e) => { | ||
// render just one part of the grid | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
console.log(e); | ||
partialRender(e); | ||
}); | ||
// register event listener for canvas element | ||
pointer.addEventListener("mousemove", (e) => { | ||
// render just one part of the grid | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
console.log(e); | ||
pointerRender(e); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.