Skip to content

Commit

Permalink
Add icon and fix bug gameover
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Fay committed Oct 7, 2017
1 parent d6682c3 commit a3ba4d2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Binary file added client/img/icone.icns
Binary file not shown.
8 changes: 4 additions & 4 deletions client/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function displayTurn(turn){
case 2:
displayHumanTurnDiv.classList.add('hidden');
displayIaTurnDiv.classList.remove('hidden');
break;
break;
default:
displayHumanTurnDiv.classList.add('hidden');
displayIaTurnDiv.classList.add('hidden');
Expand All @@ -74,7 +74,7 @@ function displayTurn(turn){
}

function hideGameOver(){
var gameOverDiv = document.getElementById('gameover');
const gameOverDiv = document.getElementById('gameover');
gameOverDiv.classList.add('hidden');
}

Expand Down Expand Up @@ -116,11 +116,11 @@ ipcRenderer.on('humanMoved', (event, data) => {
ipcRenderer.on('iaMoved', (event, data) => {
console.log('Event : iaMoved');
updateGrid(data.board);
humanCanPlay = true;
displayTurn(1);
if (data.gameOver !== 0){
displayGameOver(data.gameOver);
}
humanCanPlay = true;
displayTurn(1);
});

newGame();
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const {dialog, BrowserWindow, app, ipcMain, Tray} = require('electron')
const Puissance4 = require('./puissance4');
const minMaxWorker = require('child_process').fork('./minmax');
const minMaxWorker = require('child_process').fork(`${__dirname}/minmax`);

let browserWindow, tray, game;

Expand All @@ -11,17 +11,17 @@ const createBrowserWindow = () => {
}

const createTray = () => {
tray = new Tray('client/img/red.png');
tray = new Tray(`${__dirname}/client/img/red.png`);
tray.setToolTip('A vous de jouer.');
}

const updateTray = (event) => {
let image, tooltip;
if (event === 'humanMoved') {
image = 'client/img/yellow.png'
image = `${__dirname}/client/img/yellow.png`
tooltip = 'A Electron de jouer';
} else {
image = 'client/img/red.png'
image = `${__dirname}/client/img/red.png`
tooltip = 'A vous de jouer';
}
tray.setImage(image);
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
},
"build": {
"appId": "com.electron.puissance4",
"productName": "Puissance 4",
"mac": {
"category": "public.app-category.games"
"category": "public.app-category.games",
"icon": "client/img/icone.icns"
}
}
}

0 comments on commit a3ba4d2

Please sign in to comment.