picross-commit Mailing List for picross
Status: Pre-Alpha
Brought to you by:
yvan_norsa
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(40) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(30) |
May
(15) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(10) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(38) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <yva...@us...> - 2020-04-12 15:00:35
|
Revision: 139 http://sourceforge.net/p/picross/code/139 Author: yvan_norsa Date: 2020-04-12 15:00:32 +0000 (Sun, 12 Apr 2020) Log Message: ----------- fixed hint bug Modified Paths: -------------- trunk/phaser/GridModel.js Modified: trunk/phaser/GridModel.js =================================================================== --- trunk/phaser/GridModel.js 2020-04-11 13:39:28 UTC (rev 138) +++ trunk/phaser/GridModel.js 2020-04-12 15:00:32 UTC (rev 139) @@ -638,7 +638,8 @@ for (var i = currentBox; i < this.boxes.length; i++) { if (this.boxes[i][row].isChecked()) { // If this is the case, we cancel everything - result.clear(); + //result.clear(); + result = []; break; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2020-04-11 13:39:30
|
Revision: 138 http://sourceforge.net/p/picross/code/138 Author: yvan_norsa Date: 2020-04-11 13:39:28 +0000 (Sat, 11 Apr 2020) Log Message: ----------- added menu and level loading Modified Paths: -------------- trunk/phaser/GameScene.js trunk/phaser/MainMenu.js trunk/phaser/RandomPicrossModel.js trunk/phaser/SimpleButton.js trunk/phaser/UIBox.js trunk/phaser/index.html trunk/phaser/picross.js Added Paths: ----------- trunk/phaser/AbstractPicrossModel.js trunk/phaser/LevelMenu.js trunk/phaser/ModeMenu.js trunk/phaser/XBMModel.js Added: trunk/phaser/AbstractPicrossModel.js =================================================================== --- trunk/phaser/AbstractPicrossModel.js (rev 0) +++ trunk/phaser/AbstractPicrossModel.js 2020-04-11 13:39:28 UTC (rev 138) @@ -0,0 +1,88 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +/** + * Model handling the puzzle data. + * + * @author Y. Norsa + */ + class AbstractPicrossModel { + + + /*** Constructor ***/ + + /** Constructor. */ + /*** Accessors ***/ + + /** + * Returns the width. + * + * @return grid width + */ + getWidth() { + return this.width; + } + + /** + * Returns the height. + * + * @return grid height + */ + getHeight() { + return this.height; + } + + /** + * Returns the content. + * + * @return grid content + */ + getData() { + return this.data; + /* + boolean[][] dataCopy = new boolean[this.data.length][]; + + for (int i = 0; i < this.data.length; i++) { + dataCopy[i] = new boolean[this.data[i].length]; + System.arraycopy(this.data[i], 0, + dataCopy[i], 0, + this.data[i].length); + } + + return dataCopy; + */ + } +} + Modified: trunk/phaser/GameScene.js =================================================================== --- trunk/phaser/GameScene.js 2020-03-14 09:39:37 UTC (rev 137) +++ trunk/phaser/GameScene.js 2020-04-11 13:39:28 UTC (rev 138) @@ -37,6 +37,17 @@ super({ key: 'game' }); } + + init(data) { + if (data.file) { + this.gridModel = new XBMModel(this, data.file); + } else { + this.gridModel = new RandomPicrossModel(); + } + + this.gridModel.isComplete; + } + preload () { this.load.setBaseURL('http://picross.sourceforge.net/phaser/images/'); this.load.image('checked-rollover', 'checked-rollover.png'); @@ -73,12 +84,11 @@ } */ - var gridModel = new RandomPicrossModel(); - var width = gridModel.width; - var height = gridModel.height; + var width = this.gridModel.width; + var height = this.gridModel.height; - this.model = new GridMediator(width, height, gridModel.data, this); + this.model = new GridMediator(width, height, this.gridModel.data, this); //this.input.on('pointermove', function (pointer) {this.model.controller.mouseMoved(pointer)}, this); Added: trunk/phaser/LevelMenu.js =================================================================== --- trunk/phaser/LevelMenu.js (rev 0) +++ trunk/phaser/LevelMenu.js 2020-04-11 13:39:28 UTC (rev 138) @@ -0,0 +1,72 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + class LevelMenu extends Phaser.Scene { + constructor () { + super({ key: 'levelMenu' }); + } + + preload () { + this.load.setBaseURL('http://picross.sourceforge.net/phaser/images/'); + this.load.image('background', 'background.png'); + this.load.image('empty_button', 'empty_button.png'); + } + + create () { + this.add.image(0, 0, "background").setOrigin(0, 0); + + new SimpleButton( this, + 225, + 200, + 'empty_button', + function() { + this.scene.start('game', {file: 'data/apple.xbm'}); + }); + + + this.add.text(200, 190, "apple").setOrigin(0); + + + new SimpleButton( this, + 225, + 300, + 'empty_button', + function() { + this.scene.start('game', {file: 'data/batman2.xbm'}); + }); + + + this.add.text(200, 290, "batman2").setOrigin(0); + } +}; \ No newline at end of file Modified: trunk/phaser/MainMenu.js =================================================================== --- trunk/phaser/MainMenu.js 2020-03-14 09:39:37 UTC (rev 137) +++ trunk/phaser/MainMenu.js 2020-04-11 13:39:28 UTC (rev 138) @@ -44,15 +44,16 @@ //this.load.image('checked', 'checked.png'); //this.load.image('crossed', 'crossed.png'); //this.load.image('crossed-rollover', 'crossed-rollover.png'); - this.load.image('empty_button', 'empty_button.png'); + //this.load.image('empty_button', 'empty_button.png'); //this.load.image('empty-rollover', 'empty-rollover.png'); //this.load.image('empty', 'empty.png'); //this.load.image('hint', 'hint.png'); + this.load.image('play_button', 'en/button_play.png'); } buttonCallback() { //TODO rest of the menu - this.scene.start("game"); + this.scene.start("modeMenu"); } create () { @@ -64,10 +65,10 @@ */ new SimpleButton( this, - 150, - 200, - 'empty_button', + 225, + 225, + 'play_button', this.buttonCallback); - this.add.text(160, 210, "Play"); + //this.add.text(160, 210, "Play"); } }; \ No newline at end of file Added: trunk/phaser/ModeMenu.js =================================================================== --- trunk/phaser/ModeMenu.js (rev 0) +++ trunk/phaser/ModeMenu.js 2020-04-11 13:39:28 UTC (rev 138) @@ -0,0 +1,70 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + class ModeMenu extends Phaser.Scene { + constructor () { + super({ key: 'modeMenu' }); + } + + preload () { + this.load.setBaseURL('http://picross.sourceforge.net/phaser/images/'); + this.load.image('background', 'background.png'); + this.load.image('select_button', 'en/button_select.png'); + this.load.image('random_button', 'en/button_random.png'); + } + + selectButtonCallback() { + this.scene.start("levelMenu"); + } + + randomButtonCallback() { + this.scene.start("game"); + } + + create () { + this.add.image(0, 0, "background").setOrigin(0, 0); + + new SimpleButton( this, + 225, + 200, + 'select_button', + this.selectButtonCallback); + + new SimpleButton( this, + 225, + 275, + 'random_button', + this.randomButtonCallback); + } +}; \ No newline at end of file Modified: trunk/phaser/RandomPicrossModel.js =================================================================== --- trunk/phaser/RandomPicrossModel.js 2020-03-14 09:39:37 UTC (rev 137) +++ trunk/phaser/RandomPicrossModel.js 2020-04-11 13:39:28 UTC (rev 138) @@ -33,9 +33,11 @@ */ -class RandomPicrossModel { +class RandomPicrossModel extends AbstractPicrossModel { constructor() { +super(); + this.width = 0; this.height = 0; Modified: trunk/phaser/SimpleButton.js =================================================================== --- trunk/phaser/SimpleButton.js 2020-03-14 09:39:37 UTC (rev 137) +++ trunk/phaser/SimpleButton.js 2020-04-11 13:39:28 UTC (rev 138) @@ -33,25 +33,19 @@ */ class SimpleButton extends Phaser.GameObjects.Image { - constructor(_scene, _x, _y, _tex, _callback) { - super(_scene, _x, _y, _tex, _tex); + constructor(scene, x, y, img, callback) { + super(scene, x, y, img, img); - this.myCallback = _callback; - this.myScope = _scene; // scope - + this.callback = callback; + this.scene = scene; + this.setInteractive(); - this.on('pointerup', this.pointerUp, this); - this.on('pointerdown', this.pointerDown, this); + this.on('pointerup', this.mouseReleased, this); - _scene.add.existing(this); - + scene.add.existing(this); } - pointerUp(pointer) { - this.myCallback.call(this.myScope,'up'); + mouseReleased(e) { + this.callback.call(this.scene,'up'); } - - pointerDown(pointer) { - this.myCallback.call(this.myScope,'down'); - } } \ No newline at end of file Modified: trunk/phaser/UIBox.js =================================================================== --- trunk/phaser/UIBox.js 2020-03-14 09:39:37 UTC (rev 137) +++ trunk/phaser/UIBox.js 2020-04-11 13:39:28 UTC (rev 138) @@ -1,4 +1,4 @@ - /* Copyright Yvan Norsa (2007-2020) +/* Copyright Yvan Norsa (2007-2020) * * yva...@gm... * Added: trunk/phaser/XBMModel.js =================================================================== --- trunk/phaser/XBMModel.js (rev 0) +++ trunk/phaser/XBMModel.js 2020-04-11 13:39:28 UTC (rev 138) @@ -0,0 +1,262 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + +/** + * Class loading a XBM file. + * + * @author Y. Norsa + */ +class XBMModel extends AbstractPicrossModel { + + /*** Constructor ***/ + + /** + * Constructor. + * + * @param input XBM file input stream + * @throws IllegalArgumentException if <code>input</code> + * is <code>null</code> + * @throws IOException if there is a problem while reading the file + * @throws XBMException if the file isn't a valid XBM file + */ + constructor(scene, filename) { + super(); + + this.filename = filename; + +/* + if (input == null) { + throw new IllegalArgumentException("input can't be null"); + } + */ + + this.scene = scene; + + scene.load.once('filecomplete', this.buildLevel, this); + scene.load.text(filename, 'http://picross.sourceforge.net/phaser/' + filename); + scene.load.start(); + } + + buildLevel() { + // List<String> byteValues = new ArrayList<String>(); + const byteValues = []; + + var data = this.scene.cache.text.get(this.filename); + var lines = data.split('\n'); + + for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + //while ((line = in.readLine()) != null) { + line = line.trim(); + + if (line.startsWith(XBMModel.DEFINE_DIRECTIVE) + && line.includes(XBMModel.WIDTH_KEYWORD)) { + + this.width = XBMModel.readLineValue(line); + + //XBMModel.log.debug("width = " + this.width); + continue; + } + + if (line.startsWith(XBMModel.DEFINE_DIRECTIVE) + && line.includes(XBMModel.HEIGHT_KEYWORD)) { + + this.height = XBMModel.readLineValue(line); + + //XBMModel.log.debug("height = " + this.height); + continue; + } + + if (line.includes(XBMModel.BITS_KEYWORD)) { + //this.data = new boolean[this.width][this.height]; + this.data = Array(this.width).fill().map(() => Array(this.height).fill(false)); + + //while ((line = in.readLine()) != null) + //FIXME read file again + while ((line = lines[++i])) + { + var values = line.split(XBMModel.VALUE_SEPARATOR); + + for (var k = 0; k < values.length; k++) { + if (values[k].includes(XBMModel.HEX_LEADING)) { + values[k] = values[k].trim(); + + //XBMModel.log.debug("values[" + i + "] = " + // + values[i]); + + if ((values[k].length + < XBMModel.VALUE_END_POS) + || !XBMModel.isLetterOrDigit(values[k] + .charAt(XBMModel + .VALUE_END_POS + - 1))) { + values[k] = values[k] + .substring(0, + XBMModel.VALUE_BEGINNING_POS) + + 0 + + values[k] + .substring(XBMModel + .VALUE_BEGINNING_POS); + } + + var byteStr = + values[k] + .substring(XBMModel.VALUE_BEGINNING_POS, + XBMModel.VALUE_END_POS); + byteValues.push(byteStr); + } + } + } + } + } + + // in.close(); + +/* + if (width <= 0 || height <= 0 || this.data == null) { + throw new XBMException("Invalid XBM file"); + } +*/ + var xIndex = 0; + var yIndex = 0; + + for (var i = 0; i < byteValues.length; i++) { + var byteStr = byteValues[i]; + var binaryStr = XBMModel.toBits(byteStr); + //XBMModel.log.debug("binaryStr : " + binaryStr); + + for (var j = XBMModel.BYTE_LENGTH - 1; j >= 0; j--) { + //XBMModel.log.debug("this.data[" + yIndex + //+ "][" + xIndex + "] = " + //+ (binaryStr.charAt(j) == '1' ? true + //: false)); + + this.data[yIndex++][xIndex] = + (binaryStr.charAt(j) == '1' ? true : false); + + if (yIndex == this.width) { + xIndex++; + yIndex = 0; + + break; + } + + } + } + + } + + /*** Static methods ***/ + + static isLetterOrDigit(character) { + var letterNumber = /^[0-9a-zA-Z]+$/; + + if (character.match(letterNumber)) { + return true; + } + + return false; + } + + /** + * Reads a constant value (C-style) in a line. + * + * @param line the line to read + * @return defined value or -1 + * @throws XBMException if the line format is incorrect + */ + static readLineValue(line) { + var spaceIndex = line.lastIndexOf(XBMModel.VALUE_MARKER); + + if (spaceIndex == -1) { + return XBMModel.ERROR_VALUE; + } + + return Number(line.substring(spaceIndex).trim()); + + } + + /** + * Converts a hex value to its binary representation. + * + * @param byteStr the original String + * @return binary representation + */ + static toBits( byteStr) { + var byteVal = parseInt(byteStr, XBMModel.HEX_RADIX); + var binaryStr = byteVal.toString(2); + + binaryStr = binaryStr.padStart(XBMModel.BYTE_LENGTH, '0'); + + return binaryStr; + } +} + + /*** Constants ***/ + + /** Indicates a constant definition. */ + XBMModel.DEFINE_DIRECTIVE = "#define "; + + /** The width value. */ + XBMModel.WIDTH_KEYWORD = "width"; + + /** The height value. */ + XBMModel.HEIGHT_KEYWORD = "height"; + + /** Character before the int value. */ + XBMModel.VALUE_MARKER = ' '; + + /** The data values. */ + XBMModel.BITS_KEYWORD = "bits"; + + /** Value separator. */ + XBMModel.VALUE_SEPARATOR = ","; + + /** String indicating a hex value. */ + XBMModel.HEX_LEADING = "0x"; + + /** In case of error. */ + XBMModel.ERROR_VALUE = -1; + + /** Beginning of the actual value. */ + XBMModel.VALUE_BEGINNING_POS = 2; + + /** End of the actual value. */ + XBMModel.VALUE_END_POS = 4; + + /** Hexadecimal number radix. */ + XBMModel.HEX_RADIX = 16; + + /** Length of a byte. */ + XBMModel.BYTE_LENGTH = 8; Modified: trunk/phaser/index.html =================================================================== --- trunk/phaser/index.html 2020-03-14 09:39:37 UTC (rev 137) +++ trunk/phaser/index.html 2020-04-11 13:39:28 UTC (rev 138) @@ -10,7 +10,11 @@ <script src="SimpleButton.js"></script> <script src="MainMenu.js"></script> + <script src="ModeMenu.js"></script> + <script src="LevelMenu.js"></script> + <script src="AbstractPicrossModel.js"></script> <script src="RandomPicrossModel.js"></script> + <script src="XBMModel.js"></script> <script src="CompletedHints.js"></script> <script src="HintBox.js"></script> <script src="Box.js"></script> Modified: trunk/phaser/picross.js =================================================================== --- trunk/phaser/picross.js 2020-03-14 09:39:37 UTC (rev 137) +++ trunk/phaser/picross.js 2020-04-11 13:39:28 UTC (rev 138) @@ -36,11 +36,11 @@ var config = { type: Phaser.AUTO, - width: 900, + width: 1000, height: 900, backgroundColor: '#ffffff', disableContextMenu: true, - scene: [/*MainMenu, */GameScene] + scene: [MainMenu, ModeMenu, LevelMenu, GameScene] }; var game = new Phaser.Game(config); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2020-03-14 09:39:38
|
Revision: 137 http://sourceforge.net/p/picross/code/137 Author: yvan_norsa Date: 2020-03-14 09:39:37 +0000 (Sat, 14 Mar 2020) Log Message: ----------- added JS phaser implementation Added Paths: ----------- trunk/phaser/ trunk/phaser/Box.js trunk/phaser/CompletedHints.js trunk/phaser/GameScene.js trunk/phaser/GridAction.js trunk/phaser/GridController.js trunk/phaser/GridMediator.js trunk/phaser/GridModel.js trunk/phaser/GridUI.js trunk/phaser/HintBox.js trunk/phaser/MainMenu.js trunk/phaser/RandomPicrossModel.js trunk/phaser/SimpleButton.js trunk/phaser/UIBox.js trunk/phaser/index.html trunk/phaser/picross.js Added: trunk/phaser/Box.js =================================================================== --- trunk/phaser/Box.js (rev 0) +++ trunk/phaser/Box.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,110 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + /** Possibles states of a box. */ + class BoxState { }; + /** An empty box. */ + BoxState.EMPTY = 0; + + /** A checked box. */ + BoxState.CHECKED = 1; + + /** A crossed box. */ + BoxState.CROSSED = 2; + +/** + * Representation of a box in the grid. + * + * @author Y. Norsa + */ + class Box { + + /*** Constructor ***/ + + /** Constructor. */ + constructor() { + this.empty(); + this.hash = Math.random(); + } + + + hashCode() { + return this.hash; + } + + /*** Methods ***/ + + /** + * Permits to know if the box is checked. + * + * @return boolean telling if the box is checked + */ + isChecked() { + return this.state == BoxState.CHECKED; + } + + /** + * Permits to know if the box is crossed. + * + * @return boolean telling if the box is crossed + */ + isCrossed() { + return this.state == BoxState.CROSSED; + } + + /** + * Permits to know if the box is empty. + * + * @return boolean telling if the box is empty + */ + isEmpty() { + return this.state == BoxState.EMPTY; + } + + /** Empties the box. */ + empty() { + this.state = BoxState.EMPTY; + } + + /** Checks the box. */ + check() { + this.state = BoxState.CHECKED; + } + + /** Crosses the box. */ + cross() { + this.state = BoxState.CROSSED; + } +} + Added: trunk/phaser/CompletedHints.js =================================================================== --- trunk/phaser/CompletedHints.js (rev 0) +++ trunk/phaser/CompletedHints.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,193 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + +/** + * This class contains the list of hints, marking those which are completed. + * + * @author Y. Norsa + */ +class CompletedHints { + /*** Constructor ***/ + + /** + * Constructor. + * + * @param colsHintsWidth width of the column hints list + * @param colsHintsHeight height of the column hints list + * @param rowsHintsWidth width of the row hints list + * @param rowsHintsHeight height of the row hints list + * @throws IllegalArgumentException if one of the parameters is <= 0 + */ + constructor( colsHintsWidth, colsHintsHeight, + rowsHintsWidth, rowsHintsHeight) + { + + /** List of completed column hints. */ + this.completedCols = Array(colsHintsWidth).fill().map(() => Array(colsHintsHeight).fill(false)); + /** List of completed row hints. */ + this.completedRows = Array(rowsHintsWidth).fill().map(() => Array(rowsHintsHeight).fill(false)); + + } + + /*** Methods ***/ + + /** + * Tells wether a specific column hint is complete. + * + * @param x column number + * @param y hint position + * @return boolean telling wether the hint is completed + */ + isColHintComplete( x, y) { + return this.completedCols[x][y]; + } + + /** + * Returns the list of the completed column hints. + * + * @param column column number + * @return list of completed hints in the column + * @throws IllegalArgumentException if <code>column</code> is lesser + * than 0 or greater than the number of hints columns + */ + getCompleteColHints( column) { + + + var res = []; + + for (var i = 0; i < this.completedCols[column].length; i++) { + if (this.completedCols[column][i]) { + res.push(i); + } + } + + return res; + } + + /** + * Resets the state of a hint. + * + * @param col column number + * @param hintIndex hint position + */ + clearColHint( col, hintIndex) { + this.completedCols[col][hintIndex] = false; + } + + /** + * Marks a hint as complete. + * + * @param col column number + * @param index hint position + */ + setCompleteColHint( col, index) { + this.completedCols[col][index] = true; + } + + /** + * Marks a whole column as complete. + * + * @param col column number + */ + setCompleteCol( col) { + for (var i = 0; i < this.completedCols[col].length; i++) { + this.setCompleteColHint(col, i); + } + } + + /** + * Tells wether a specific row hint is complete. + * + * @param x row number + * @param y hint position + * @return boolean telling wether the hint is completed + */ + isRowHintComplete( x, y) { + return this.completedRows[x][y]; + } + + /** + * Returns the list of the completed row hints. + * + * @param row row number + * @return list of completed hints in the row + * @throws IllegalArgumentException if <code>row</code> is lesser + * than 0 or greater than the number of hints row + */ + getCompleteRowHints( row) { + + + var res = []; + + for (var i = 0; i < this.completedRows[row].length; i++) { + if (this.completedRows[row][i]) { + res.push(i); + } + } + + return res; + } + + /** + * Resets the state of a hint. + * + * @param row row number + * @param hintIndex hint position + */ + clearRowHint( row, hintIndex) { + this.completedRows[row][hintIndex] = false; + } + + /** + * Marks a hint as complete. + * + * @param row row number + * @param index hint position + */ + setCompleteRowHint( row, index) { + this.completedRows[row][index] = true; + } + + /** + * Marks a whole row as complete. + * + * @param row row number + */ + setCompleteRow( row) { + for (var i = 0; i < this.completedRows[row].length; i++) { + this.setCompleteRowHint(row, i); + } + } +} + Added: trunk/phaser/GameScene.js =================================================================== --- trunk/phaser/GameScene.js (rev 0) +++ trunk/phaser/GameScene.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,119 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + +class GameScene extends Phaser.Scene { + constructor () { + super({ key: 'game' }); + } + + preload () { + this.load.setBaseURL('http://picross.sourceforge.net/phaser/images/'); + this.load.image('checked-rollover', 'checked-rollover.png'); + this.load.image('checked', 'checked.png'); + this.load.image('crossed', 'crossed.png'); + this.load.image('crossed-rollover', 'crossed-rollover.png'); + this.load.image('empty-rollover', 'empty-rollover.png'); + this.load.image('empty', 'empty.png'); + this.load.image('hint', 'hint.png'); + } + + + create () { + //this.stage.backgroundColor = "#FFFFFF"; + +/* + + if (this.view.isInGrid(point)) { + int row = this.view.getRow(point); + int column = this.view.getColumn(point); + + this.view.setRollover(row, column); + } else { + this.view.rolloverEnded(); + } + */ + +/* + // Paints the boxes + for (var i = 0; i < 200; i=i+25) { + for (var j = 0; j < 300; j=j+25) { + this.add.image(i, j, "empty").setOrigin(0, 0); + } + } + */ + + var gridModel = new RandomPicrossModel(); + + var width = gridModel.width; + var height = gridModel.height; + + this.model = new GridMediator(width, height, gridModel.data, this); + + + //this.input.on('pointermove', function (pointer) {this.model.controller.mouseMoved(pointer)}, this); + this.input.on('pointermove', this.model.controller.mouseMoved, this.model.controller); + this.input.on('pointerdown', this.model.controller.mousePressed, this.model.controller); + this.input.on('pointerup', this.model.controller.mouseReleased, this.model.controller); + + this.model.view.paintComponent(this); + +/* +this.add.line(0, 0, 200, 200, 300, 200, 0xffaabb); + + var rect = new Phaser.GameObjects.Rectangle(this, 0,15 + + (2 * GridUI.BOX_HEIGHT), + 15, + GridUI.BOX_HEIGHT,).setOrigin(0); + rect.setFillStyle(0xff0000); + this.children.add(rect); +*/ + + + + } + + update() { + /* + for (var i = 0; i < 200; i=i+25) { + for (var j = 0; j < 300; j=j+25) { + if ((this.rolloverRow * 25) == j && (this.rolloverColumn * 25) == i) { + this.add.image(i, j, "empty-rollover").setOrigin(0, 0); + } + } + } + */ + + this.model.view.repaint(this); + } +}; \ No newline at end of file Added: trunk/phaser/GridAction.js =================================================================== --- trunk/phaser/GridAction.js (rev 0) +++ trunk/phaser/GridAction.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,48 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + class GridAction { } + /** Unrecognized action. */ + GridAction.UNKNOWN = 0; + + /** Checking a box. */ + GridAction.CHECK = 1; + + /** Crossing a box. */ + GridAction.CROSS = 2; + + /** Erasing a box. */ + GridAction.EMPTY = 3; + + Added: trunk/phaser/GridController.js =================================================================== --- trunk/phaser/GridController.js (rev 0) +++ trunk/phaser/GridController.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,254 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + class GridController { + + /** The view to which the controller is attached. */ + //private GridUI view = null; + + /** Indicates wether the erase mode is "on" or not. */ + //private boolean eraseMode; + + /*** Method overloaded from the class Controller ***/ + + constructor(mediator) { + this.mediator = mediator; + } + + doPaintCommand(row, col) { + + this.view.repaint(row, col); + + } + + + doRepaintTopHintsCommand(col) { + this.view.repaintColHints(col); + } + + doRepaintLeftHintsCommand(row) { + this.view.repaintRowHints(row); + } + + doEraseModeCommand() { + this.eraseMode = true; + } + + doGridFilledCommand() { + this.view.rolloverEnded(); + this.view.disableGrid(); + + } + + eventPerformed( e) { + /* + String cmd = e.getCommandName(); + + if (cmd.equals(GridCommands.GRID_FILLED_CMD)) { + this.view.rolloverEnded(); + this.view.disableGrid(); + + return; + } + + if (cmd.equals(GridCommands.PAINT_CMD)) { + PaintCommand command = (PaintCommand) e.getCommand(); + this.view.repaint(command.getRow(), command.getColumn()); + + return; + } + + if (cmd.equals(GridCommands.REPAINT_TOP_HINTS_CMD)) { + int col = ((RepaintTopHintsCommand) e.getCommand()).getColumn(); + this.view.repaintColHints(col); + + return; + } + + if (cmd.equals(GridCommands.REPAINT_LEFT_HINTS_CMD)) { + int row = ((RepaintLeftHintsCommand) e.getCommand()).getRow(); + this.view.repaintRowHints(row); + + return; + } + + if (cmd.equals(GridCommands.ERASE_MODE_CMD)) { + this.eraseMode = true; + return; + } + + if (cmd.equals(GridCommands.REPAINT_EVERYTHING_CMD)) { + this.view.doRepaint(); + return; + } + */ + } + + /*** Methods implanted from the interface MouseListener ***/ + mouseClicked( e) { } + +mouseEntered( e) { } + + +mouseExited( e) { + this.view.rolloverEnded(); + this.view.highlightEnded(); + } + + + mousePressed (e) { + //this.view.rolloverEnded(); + } + +mouseReleased( e) { + this.checkAndFill(e); + this.eraseMode = false; + this.mediator.doEndActionCommand(); + } + + /*** Methods implanted from the interface MouseMotionListener ***/ + /* + mouseDragged (e) { + this.checkAndFill(e); + } +*/ + + mouseMoved( e) { + // dragging + + /* + if (e.leftButtonDown() || e.rightButtonDown()) { + + this.checkAndFill(e); + + + + } else { +*/ + var point = e.position; + + if (this.view.isInGrid(point)) { + var row = this.view.getRow(point); + var column = this.view.getColumn(point); + + this.view.setRollover(row, column); + +/**/ + if (e.leftButtonDown() || e.rightButtonDown()) { + + this.checkAndFill(e); + } +/**/ + + + } else { + this.view.rolloverEnded(); + } + // } + } + + /*** Methods ***/ + + /** + * Checks if the mouse current click's location is inside the grid + * and eventually fills the corresponding box. + * + * @param e mouse event to handle + */ + checkAndFill( e) { +/* var modifiers = e.getModifiers(); + + if (modifiers != MouseEvent.BUTTON1_MASK + && modifiers != MouseEvent.BUTTON3_MASK) { +*/ +if (!e.leftButtonDown() && !e.leftButtonReleased() + && !e.rightButtonDown() && !e.rightButtonReleased()) { + return; + } + + var point = e.position; + + if (this.view.isInGrid(point)) { + var row = this.view.getRow(point); + var column = this.view.getColumn(point); + + var type; + + if (this.eraseMode) { + type = GridAction.EMPTY; + } else { + type = GridController.modifiersToType(e.event); + } + + this.view.rolloverHighlight(row, column); + + //this.fireEventPerformed(GridCommands.FILL_CMD, + this.mediator.doFillCommand(row, column, type); + } else { + this.view.highlightEnded(); + } + } + + /** + * Converts a mouse click to an action. + * + * @param modifiers mouse event modifiers + * @return corresponding action, or -1 + */ + static modifiersToType( e) { + // Chrome fix + if (e.button === 2 || e.buttons === 2) { + return GridAction.CROSS; + } + + if (e.button === 0) { + return GridAction.CHECK; + } + + return GridAction.UNKNOWN; + + } + + /*** Accessor ***/ + + /** + * Allows to set the view. + * + * @param view view to which this controller is attached + */ + setView( view) { + this.view = view; + } +} + Added: trunk/phaser/GridMediator.js =================================================================== --- trunk/phaser/GridMediator.js (rev 0) +++ trunk/phaser/GridMediator.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,114 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + +class GridMediator { + constructor(width, height, data, scene) { + this.model = new GridModel(data); + + this.controller = this.initController(); + //controller.addSimpleListener(this); + //this.addSimpleListener(controller); + + var tmpBoxes = this.model.boxes; + var boxes = []; + + for (var i = 0; i < tmpBoxes.length; i++) { + boxes[i] = []; + + for (var j = 0; j < tmpBoxes[i].length; j++) { + boxes[i][j] = UIBox.fromBox(tmpBoxes[i][j]); + } + } + + var hints = this.model.getCompletedHints(); + + var colData = this.model.colData; + var rowData = this.model.rowData; + + //this.initGrid(width, height, boxes, colData, rowData, hints, controller); + this.view = new GridUI(width, height, + boxes, + colData, + rowData, + hints, + null); + + this.controller.setView(this.view); + + this.view.init(scene); + + } + + + initController() { + return new GridController(this); + } + + + + doFillCommand(row, col, type) { + + this.model.actOnBox(row, col, type); + + // TODO what now ? check the model'state + this.view.updateBox(col, row, this.model.getBoxes()[col][row]); + + this.controller.doPaintCommand(row, col); + + this.controller.doRepaintLeftHintsCommand(row); + this.controller.doRepaintTopHintsCommand(col); + + if (this.model.checkCompleted()) { + this.congratulations(); + } else { + if (this.model.getEraseMode()) { + this.controller.doEraseModeCommand(); + } + } + + return; + } + + doEndActionCommand() { + this.model.endAction(); + } + + congratulations() { + //this.fireEventPerformed(PicrossController.MESSAGE_CMD, + // BundleHelper.getString(this, "victory")); + alert("Congratulations"); + + this.controller.doGridFilledCommand(); + } +} \ No newline at end of file Added: trunk/phaser/GridModel.js =================================================================== --- trunk/phaser/GridModel.js (rev 0) +++ trunk/phaser/GridModel.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,1017 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + +class GridModel { + constructor(cData) { + this.data = cData; + + var lineSize = this.data[0].length; + + this.boxes = []; + + for (var i = 0; i < this.data.length; i++) { + this.boxes[i] = []; + for (var j = 0; j < lineSize; j++) { + this.boxes[i][j] = new Box(); + } + } + + this.colData = GridModel.getColHints(this.data); + this.rowData = GridModel.getRowHints(this.data); + + this.completedHints = + new CompletedHints(this.data.length, this.colData[0].length, + this.data[0].length, this.rowData[0].length); + + for (var i = 0; i < this.rowData.length; i++) { + if (this.emptyRow(i)) { + this.completedHints.setCompleteRow(i); + } else { + for (var j = 0; j < this.rowData[i].length; j++) { + if (this.rowData[i][j] == GridModel.EMPTY_HINT) { + this.completedHints.setCompleteRowHint(i, j); + } + } + } + } + + for (var i = 0; i < this.colData.length; i++) { + if (this.emptyCol(i)) { + this.completedHints.setCompleteCol(i); + } else { + for (var j = 0; j < this.colData[i].length; j++) { + if (this.colData[i][j] == GridModel.EMPTY_HINT) { + this.completedHints.setCompleteColHint(i, j); + } + } + } + } + + + + + this.rowHintsTotal = GridModel.computeRowHintsTotal(cData); + this.colHintsTotal = GridModel.computeColHintsTotal(cData); + + } + + + /** + * Extracts the column hints from the grid data. + * + * @param data the grid data + * @return column hints + */ + + static getColHints(data) { + // Grid of columns hints + var colHints = []; + + // Largest number of hints for a column + var max = 0; + + for (var i = 0; i < data.length; i++) { + var col = data[i]; + var current = []; + + // Current hint + var chain = 0; + + for (var j = 0; j < col.length; j++) { + var cell = col[j]; + + if (cell) { + chain++; + } else if (chain > 0) { + // We've reached the end of a series of checked boxes + current.push(chain); + chain = 0; + } + } + + if (chain > 0) { + current.push(chain); + } else if (current.length == 0) { + // If this column is empty, we add a "0" hint + current.push(0); + } + + var currentSize = current.length; + + if (currentSize > max) { + max = currentSize; + } + + colHints.push(current); + } + + /* + * So for the hints : + * + * 1 + * 0 2 1 + * + * Which corresponds to the grid : + * + * |-----| + * |_|X|_| + * |_|_|X| + * |_|X|_| + * |_|X|_| + * |-----| + * + * We build this array : + * {{0, -1}, {2, 1}, {1, -1}} + */ + + //int[][] result = new int[data.length][max]; + //var result = new Array(data.length).fill(new Array(max).fill(0)); + var result = []; + + for (var i = 0; i < data.length; i++) { + result[i] = []; + } + + for (var i = 0; i < max; i++) { + // Minimal number of hints for the current column to be considered + var ref = max - i; + + // Current hint row + var currentRow = ref - 1; + + for (var j = 0; j < colHints.length; j++) { + var currentCol = colHints[j]; + var size = currentCol.length; + + if (size >= ref) { + result[j][currentRow] = currentCol[size - ref]; + } else { + result[j][currentRow] = GridModel.EMPTY_HINT; + } + } + } + + return result; + } + + /** + * Extracts the row hints from the grid data. + * + * @param data the grid data + * @return row hints + */ + + static getRowHints( data) { + var rowHints = []; + var max = 0; + + for (var i = 0; i < data[0].length; i++) { + var current = []; + var chain = 0; + + for (var j = 0; j < data.length; j++) { + if (data[j][i]) { + chain++; + } else if (chain > 0) { + current.push(chain); + chain = 0; + } + } + + if (chain > 0) { + current.push(chain); + } else if (current.length == 0) { + current.push(0); + } + + var currentSize = current.length; + + if (currentSize > max) { + max = currentSize; + } + + rowHints.push(current); + } + + //int[][] result = new int[data[0].length][max]; + //var result = new Array(data[0].length).fill(new Array(max).fill(0)); + var result = []; + + for (var i = 0; i < data[0].length; i++) { + result[i] = []; + } + + var nbRows = rowHints.length; + + for (var i = 0; i < max; i++) { + var ref = max - i; + + for (var j = 0; j < nbRows; j++) { + var currentRow = rowHints[j]; + var size = currentRow.length; + + if (size >= ref) { + result[j][i] = currentRow[i - Math.abs(size - max)]; + } else { + result[j][i] = GridModel.EMPTY_HINT; + } + } + } + + return result; + } + + /** + * Returns the index of the first non-empty hint. + * + * @param hints hints array + * @return index of the first non-empty hint + */ + static getFirstHintIndex( hints) { + return GridModel.getNextHintIndex(0, hints); + } + + /** + * Returns the index of the next non-empty hint. + * + * @param currentIndex start index + * @param hints hints array + * @return index of the next non-empty hint + */ + static getNextHintIndex( currentIndex, hints) { + for (var i = currentIndex; i < hints.length; i++) { + if (hints[i] != GridModel.EMPTY_HINT) { + return i; + } + } + + return GridModel.EMPTY_HINT; + } + + /** + * Returns the index of the last non-empty hint. + * + * @param hints hints array + * @return index of the last non-empty hint + */ + static getLastHintIndex( hints) { + return GridModel.getPreviousHintIndex(hints.length - 1, hints); + } + + /** + * Returns the index of the previous non-empty hint. + * + * @param currentIndex start index + * @param hints hints array + * @return index of the previous non-empty hint + */ + static getPreviousHintIndex( currentIndex, hints) { + for (var i = currentIndex; i >= 0; i--) { + if (hints[i] != GridModel.EMPTY_HINT) { + return i; + } + } + + return GridModel.EMPTY_HINT; + } + + static computeRowHintsTotal( data) { + //int[] result = new int[data[0].length]; + var result = new Array(data[0].length); + + for (var i = 0; i < data[0].length; i++) { + var total = 0; + + for (var j = 0; j < data.length; j++) { + if (data[j][i]) { + total++; + } + } + + result[i] = total; + } + + return result; + } + + static computeColHintsTotal( data) { + //int[] result = new int[data.length]; + var result = new Array(data.length); + + for (var i = 0; i < data.length; i++) { + var total = 0; + + //for (boolean cell : data[i]) { + for (var j = 0; j < data[i].length; j++) { + var cell = data[i][j]; + + if (cell) { + total++; + } + } + + result[i] = total; + } + + return result; + } + + /*** Methods ***/ + + /** + * Method called during an action. Does the action on the specified box, + * then checks for completed hints. + * + * @param row row of the box + * @param column column of the box + * @throws IllegalArgumentException if <code>row</code> or + * <code>column</code> is less than 0 + */ + actOnBox( row, column, type) { + + if (type == GridAction.UNKNOWN) { + return; + } + +/* + + console.log("actOnBox(" + row + ", " + column + ")"); + console.log("lastModified == null : " + + (this.lastModified == null)); +*/ +/* + +if (column >= this.boxes.length || row >= this.boxes[0].length) { + console.log("#############"); + debugger; +} +*/ + + //GridModel.log.debug("checkBox(" + row + ", " + column + ")"); + //GridModel.log.debug("lastModified == null : " + // + (lastModified == null)); + + /* + * If we are trying to check the last box we just checked + * (while dragging), do nothing + */ + if (this.lastModified != null + && this.lastModified == this.boxes[column][row]) { + + return; + } + + if (this.lastModified != null) { + /* + * If we are in a box which is in the same state as our aim + * (if we are in a checks serie and we are on a box which + * is already checked), do nothing + */ + + if (this.boxes[column][row] === this.lastModified) { + return; + } + } + + if (!this.boxes[column][row].isEmpty() && type == GridAction.EMPTY) { + this.boxes[column][row].empty(); + + // FIXME + //this.mediator.repaint(row, column); + } else { + + if (this.boxes[column][row].isEmpty() + && (this.lastModified == null || !this.lastModified.isEmpty())) { + + if (type == GridAction.CHECK) { + console.log("checked 1"); + this.boxes[column][row].check(); + } else { //if (type == GridAction.CROSS) { + console.log("crossed 1"); + this.boxes[column][row].cross(); + } + + // FIXME + //this.mediator.repaint(row, column); + } else if (!this.boxes[column][row].isEmpty() + && (this.lastModified == null + || this.lastModified.isEmpty())) { + + if (this.boxes[column][row].isChecked()) { + console.log("checked 2"); + + if (type == GridAction.CHECK) { + this.boxes[column][row].empty(); + this.setEraseMode(); + } else { //if (type == GridAction.CROSS) { + console.log("crossed 2"); + this.boxes[column][row].cross(); + } + } else { //if (this.boxes[column][row].isCrossed()) { + console.log("crossed 3"); + + if (type == GridAction.CROSS) { + this.boxes[column][row].empty(); + this.setEraseMode(); + } else { //if (type == GridAction.CHECK) { + console.log("checked 3"); + + this.boxes[column][row].check(); + } + } + + // FIXME + //this.mediator.repaint(row, column); + } + } + + this.lastModified = this.boxes[column][row]; + this.checkColumn(column); + this.checkRow(row); + //this.checkCompleted(); + } + + //private boolean erase; + + /** Enables the erase mode. */ + setEraseMode() { + // FIXME + //this.mediator.setEraseMode(); + this.erase = true; + } + + getEraseMode() { + var result = this.erase; + this.erase = false; + return result; + } + + /** + * Checks if a row is empty. + * + * @param row row number + * @return boolean stating wether the row is empty or not + */ + emptyRow( row) { + var index = GridModel.getFirstHintIndex(this.rowData[row]); + + return (index == GridModel.getLastHintIndex(this.rowData[row])) + && (this.rowData[row][index] == 0); + } + + /** + * Checks if a hint has been completed in a row. + * + * @param row row number to check + */ + checkRow( row) { + if (this.emptyRow(row)) { + this.completedHints.setCompleteRow(row); + return; + } + + // Contains the completed hints + var completedRowHints = []; + + var leftToRightHints = []; + + // If the first box is empty, skip left-to-right check + if (!this.boxes[0][row].isEmpty()) { + leftToRightHints = this.checkLeftToRight(row); + console.log("left-to-right for row #" + row + ": " + + leftToRightHints); + completedRowHints.push.apply(completedRowHints, leftToRightHints); + } + + var rightToLeftHints = []; + + // Same thing from right to left + if (!this.boxes[this.boxes.length - 1][row].isEmpty()) { + rightToLeftHints = this.checkRightToLeft(row); + //GridModel.log.debug("right-to-left hints for row #" + row + ": " + // + rightToLeftHints); + completedRowHints.push.apply(completedRowHints, rightToLeftHints); + } + + var rowHints = this.completedHints.getCompleteRowHints(row); + + //for (int hintIndex : rowHints) { + for (var i = 0; i < rowHints.length; i++) { + var hintIndex = rowHints[i]; + + if (!this.arrayContains(completedRowHints, hintIndex)) { + this.completedHints.clearRowHint(row, hintIndex); + } + } + + //for (int index : completedRowHints) { + for (var i = 0; i < completedRowHints.length; i++) { + var index = completedRowHints[i]; + this.completedHints.setCompleteRowHint(row, index); + } + + /**/ + var complete = true; + + for (var i = 0; i < this.rowData[row].length; i++) { + if (this.rowData[row][i] != GridModel.EMPTY_HINT && !this.arrayContains(completedRowHints, i)) { + complete = false; + } + } + + if (!complete) { + return; + } + /**/ + + //GridModel.log.debug("Row #" + row + " is complete"); + + // Let's compare number of checked boxes and the sum of all hints + var totalChecked = 0; + + for (var i = 0; i < this.boxes.length; i++) { + if (this.boxes[i][row].isChecked()) { + totalChecked++; + } + } + + /* + * If it's the same number, then we're good to go + * Otherwise, we're gonna keep the highest number of cleared hints + */ + if (totalChecked == this.rowHintsTotal[row]) { + return; + } + + //GridModel.log.debug("totalChecked = " + totalChecked); + //GridModel.log.debug("rowHintsTotal[" + row + "] = " + // + this.rowHintsTotal[row]); + + var leftToRightSize = leftToRightHints.size(); + var rightToLeftSize = rightToLeftHints.size(); + + //GridModel.log.debug("left to right = " + leftToRightSize); + //GridModel.log.debug("right to left = " + rightToLeftSize); + + if (leftToRightSize > 0 || rightToLeftSize > 0) { + if (leftToRightSize >= rightToLeftSize) { + //for (int hintIndex : rightToLeftHints) { + for (var i = 0; i < rightToLeftHints.length; i++) { + var hintIndex = rightToLeftHints[i]; + this.completedHints.clearRowHint(row, hintIndex); + } + } else { + //for (int hintIndex : leftToRightHints) { + for (var i = 0; i < leftToRightHints.length; i++) { + var hintIndex = leftToRightHints[i]; + this.completedHints.clearRowHint(row, hintIndex); + } + } + } //else { + //throw new RuntimeException("Confusion occured during " + // + "completed hints look-up"); + //} + } + + checkLeftToRight( row) { + var result = []; + + // Current hint we're looking to complete + var currentHintIndex = + GridModel.getFirstHintIndex(this.rowData[row]); + + var currentBox = 0; + + // Current chain of checked boxes + var currentChain = 0; + + while (currentBox < this.boxes.length) { + if (this.boxes[currentBox][row].isChecked()) { + currentChain++; + } else { + // We reach the end of a chain + // And it matches the current hint + if (this.rowData[row][currentHintIndex] == currentChain) { + result.push(currentHintIndex); + currentChain = 0; + + currentHintIndex = + GridModel.getNextHintIndex(currentHintIndex + 1, + this.rowData[row]); + + if (currentHintIndex == GridModel.EMPTY_HINT) { + /* + * If this is the last hint, we verify that + * there aren't any extra checked boxes + */ + for (var i = currentBox; i < this.boxes.length; i++) { + if (this.boxes[i][row].isChecked()) { + // If this is the case, we cancel everything + result.clear(); + break; + } + } + + break; + } + } + + // If there is a blank after a filled hint, we stop there + if (this.boxes[currentBox][row].isEmpty()) { + break; + } + } + + currentBox++; + } + + /* + * If we've reached the end of the row + * and there is a current chain, we mark it as completed + */ + if (currentHintIndex != -1 + && this.rowData[row][currentHintIndex] == currentChain) { + + result.push(currentHintIndex); + } + + return result; + } + + checkRightToLeft( row) { + var result = []; + + var currentHintIndex = GridModel.getLastHintIndex(this.rowData[row]); + var currentBox = this.boxes.length - 1; + var currentChain = 0; + + while (currentBox >= 0) { + if (this.boxes[currentBox][row].isChecked()) { + currentChain++; + } else { + if (this.rowData[row][currentHintIndex] == currentChain) { + result.push(currentHintIndex); + currentChain = 0; + + currentHintIndex = + GridModel.getPreviousHintIndex(currentHintIndex - 1, + this.rowData[row]); + + if (currentHintIndex == -1) { + for (var i = currentBox; i >= 0; i--) { + if (this.boxes[i][row].isChecked()) { + //result.clear(); + result = []; + } + } + + break; + } + } + + if (this.boxes[currentBox][row].isEmpty()) { + break; + } + } + + currentBox--; + } + + return result; + } + + /** + * Checks if a column is empty. + * + * @param col column number + * @return boolean stating wether the column is empty or not + */ + emptyCol( col) { + var index = GridModel.getFirstHintIndex(this.colData[col]); + + return (index == GridModel.getLastHintIndex(this.colData[col])) + && (this.colData[col][index] == 0); + } + + /** + * Checks if a hint has been completed in a column. + * + * @param column column number to check + */ + checkColumn( column) { + //GridModel.log.debug("checkColumn(" + column + ")"); + + if (this.emptyCol(column)) { + this.completedHints.setCompleteCol(column); + return; + } + + var completedColHints = [] + var topToBottomHints = []; + + if (!this.boxes[column][0].isEmpty()) { + topToBottomHints = this.checkTopToBottom(column); + + //completedColHints.addAll(topToBottomHints); + //for (var i = 0; i < topToBottomHints.length; i++) { + completedColHints.push.apply(completedColHints, topToBottomHints); + //} + } + + var bottomToTopHints = []; + + if (!this.boxes[column][this.boxes[0].length - 1].isEmpty()) { + bottomToTopHints = this.checkBottomToTop(column); + + //completedColHints.addAll(bottomToTopHints); + //for (var i = 0; i < bottomToTopHints.length; i++) { + completedColHints.push.apply(completedColHints, bottomToTopHints); + //} + } + + /**/ + var colHints = + this.completedHints.getCompleteColHints(column); + + //for (int hintIndex : colHints) { + for (var i = 0; i < colHints.length; i++) { + var hintIndex = colHints[i]; + + //if (!completedColHints.contains(hintIndex)) { + if (!this.arrayContains(completedColHints, hintIndex)) { + this.completedHints.clearColHint(column, hintIndex); + } + } + + //for (int index : completedColHints) { + for (var i = 0; i < completedColHints.length; i++) { + var index = completedColHints[i]; + this.completedHints.setCompleteColHint(column, index); + } + + /**/ + var complete = true; + + for (var i = 0; i < this.colData[column].length; i++) { + if (this.colData[column][i] != GridModel.EMPTY_HINT && !this.arrayContains(completedColHints, i)) { + complete = false; + } + } + + if (!complete) { + return; + } + /**/ + + var totalChecked = 0; + + for (var i = 0; i < this.boxes[column].length; i++) { + if (this.boxes[column][i].isChecked()) { + totalChecked++; + } + } + + if (totalChecked == this.colHintsTotal[column]) { + return; + } + + var topToBottomSize = topToBottomHints.size(); + var bottomToTopSize = bottomToTopHints.size(); + + if (topToBottomSize > 0 || bottomToTopSize > 0) { + if (topToBottomSize >= bottomToTopSize) { + //for (int hintIndex : bottomToTopHints) { + for (var i = 0; i < bottomToTopHints.length; i++) { + var hintIndex = bottomToTopHints[i]; + this.completedHints.clearColHint(column, hintIndex); + } + } else { + //for (int hintIndex : topToBottomHints) { + for (var i = 0; i < topToBottomHints.length; i++) { + var hintIndex = topToBottomHints[i]; + this.completedHints.clearColHint(column, hintIndex); + } + } + } /*else { + throw new RuntimeException("Confusion occured during " + + "completed hints look-up"); + }*/ + } + + + arrayContains(array, target) { + for (var j = 0; j < array.length; j++) { + if (array[j] == target) { + return true; + } + } + + return false; + } + + + checkTopToBottom( col) { + var result = []; + + var currentHintIndex = + GridModel.getLastHintIndex(this.colData[col]); + var currentBox = 0; + var currentChain = 0; + + while (currentBox < this.boxes[0].length) { + if (this.boxes[col][currentBox].isChecked()) { + currentChain++; + } else { + if (this.colData[col][currentHintIndex] == currentChain) { + result.push(currentHintIndex); + currentChain = 0; + + currentHintIndex = GridModel + .getPreviousHintIndex(currentHintIndex - 1, + this.colData[col]); + + if (currentHintIndex == GridModel.EMPTY_HINT) { + for (var i = currentBox; i < this.boxes[0].length; + i++) { + + if (this.boxes[col][i].isChecked()) { + //result.clear(); + result = []; + break; + } + } + + break; + } + } + + if (this.boxes[col][currentBox].isEmpty()) { + break; + } + } + + currentBox++; + } + + if (currentHintIndex != GridModel.EMPTY_HINT + && this.colData[col][currentHintIndex] == currentChain) { + + result.push(currentHintIndex); + } + + return result; + } + + checkBottomToTop( col) { + var result = []; + + var currentHintIndex = GridModel.getFirstHintIndex(this.colData[col]); + var currentBox = this.boxes[0].length - 1; + var currentChain = 0; + + while (currentBox >= 0) { + if (this.boxes[col][currentBox].isChecked()) { + currentChain++; + } else { + if (this.colData[col][currentHintIndex] == currentChain) { + result.push(currentHintIndex); + currentChain = 0; + + currentHintIndex = + GridModel.getNextHintIndex(currentHintIndex + 1, + this.colData[col]); + + if (currentHintIndex == GridModel.EMPTY_HINT) { + for (var i = currentBox; i >= 0; i--) { + if (this.boxes[col][i].isChecked()) { + //result.clear(); + result = []; + } + } + + break; + } + } + + if (this.boxes[col][currentBox].isEmpty()) { + break; + } + } + + currentBox--; + } + + return result; + } + + /** Checks wether the grid is finished. */ + checkCompleted() { + var completed = true; + + for (var i = 0; i < this.data.length; i++) { + for (var j = 0; j < this.data[i].length; j++) { + var isCurrentBoxChecked = this.boxes[i][j].isChecked(); + + if ((this.data[i][j] && !isCurrentBoxChecked) + || (!this.data[i][j] && isCurrentBoxChecked)) { + + completed = false; + break; + } + } + } + + //if (completed) { + // FIXME + //this.mediator.congratulations(); + //} + return completed; + } + + /** Indicates the current action has come to an end. */ + endAction() { + //this.lastChecked = null; + this.lastModified = null; + } + + /*** Accessors ***/ + + /** + * Returns the boxes. + * + * @return grid boxes + */ + getBoxes() { + return this.boxes; + } + + /** + * Returns the vertical hints. + * + * @return columns hints + */ + getColData() { + return this.colData; + } + + /** + * Returns the horizontal hints. + * + * @return rows hints + */ + getRowData() { + return this.rowData; + } + + /** + * Returns the completed hints. + * + * @return list of completed hints + */ + getCompletedHints() { + return this.completedHints; + } + + clearAll() { + //for (Box[] boxRow : this.boxes) { + // for (Box box : boxRow) { + for (var i = 0; i < this.boxes.length; i++) { + for (var j = 0; j < this.boxes[i].length; j++) { + this.actOnBox(j, i, GridAction.EMPTY); + } + } + } +}; + +GridModel.EMPTY_HINT = -1; Added: trunk/phaser/GridUI.js =================================================================== --- trunk/phaser/GridUI.js (rev 0) +++ trunk/phaser/GridUI.js 2020-03-14 09:39:37 UTC (rev 137) @@ -0,0 +1,708 @@ +/* Copyright Yvan Norsa (2007-2020) + * + * yva...@gm... + * + * This software is a computer program whose purpose is to [describe + * functionalities and technical features of your software]. + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redist... [truncated message content] |
From: <yva...@us...> - 2013-01-28 08:42:44
|
Revision: 136 http://sourceforge.net/p/picross/code/136 Author: yvan_norsa Date: 2013-01-28 08:42:39 +0000 (Mon, 28 Jan 2013) Log Message: ----------- add 'reset' button Modified Paths: -------------- trunk/android/src/picross/specific/game/ui/GameController.java trunk/android/src/picross/specific/game/ui/GameMediator.java trunk/android/src/picross/specific/game/ui/GameUI.java trunk/android/src/picross/specific/grid/ui/GridUI.java trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java trunk/common/src/picross/common/grid/ui/GridCommands.java trunk/common/src/picross/common/grid/ui/IGridMediator.java trunk/common/src/picross/common/ui/PicrossController.java trunk/common/src/picross/specific/grid/ui/GridUI.java trunk/engine/src/picross/engine/grid/GridModel.java trunk/properties/messages_picross.properties trunk/properties/messages_picross_fr.properties trunk/swing/src/picross/specific/game/ui/GameController.java trunk/swing/src/picross/specific/game/ui/GameMediator.java trunk/swing/src/picross/specific/game/ui/GameUI.java trunk/swing/src/picross/specific/grid/ui/GridController.java trunk/swing/src/picross/specific/grid/ui/GridUI.java Added Paths: ----------- trunk/common/src/picross/common/game/ui/AbstractGameMediator.java trunk/common/src/picross/specific/game/ui/GameController.java trunk/common/src/picross/specific/game/ui/GameUI.java Removed Paths: ------------- trunk/common/src/picross/common/game/ui/GameMediator.java Modified: trunk/android/src/picross/specific/game/ui/GameController.java =================================================================== --- trunk/android/src/picross/specific/game/ui/GameController.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/android/src/picross/specific/game/ui/GameController.java 2013-01-28 08:42:39 UTC (rev 136) @@ -57,6 +57,8 @@ public static final int QUIT_CMD_ID = PicrossController.QUIT_CMD.hashCode(); + public static final int RESET_CMD_ID = PicrossController.RESET_CMD.hashCode(); + /*** Method overloaded from the class Controller ***/ /** {@inheritDoc} */ @@ -92,6 +94,11 @@ return; } + if (itemId == GameController.RESET_CMD_ID) { + this.fireEventPerformed(PicrossController.RESET_CMD); + return; + } + super.onPicrossEvent(e); } } Modified: trunk/android/src/picross/specific/game/ui/GameMediator.java =================================================================== --- trunk/android/src/picross/specific/game/ui/GameMediator.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/android/src/picross/specific/game/ui/GameMediator.java 2013-01-28 08:42:39 UTC (rev 136) @@ -33,7 +33,6 @@ package picross.specific.game.ui; -import fr.cle.mmvcs.Mediateur; import fr.cle.mmvcs.SimpleEvent; import picross.engine.PicrossLogger; @@ -46,52 +45,21 @@ import picross.common.grid.ui.GridView; import picross.common.grid.ui.IGridMediator; +import picross.common.game.ui.AbstractGameMediator; + import picross.common.game.ui.GameView; import android.content.Context; import picross.specific.ui.MenuController; -public abstract class GameMediator extends Mediateur { - /*** Static field ***/ - - /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(GameMediator.class); - - /*** Fields ***/ - - /** The game view. */ - private GameUI view; - - /** The game grid. */ - private IGridMediator grid; - +public abstract class GameMediator extends AbstractGameMediator { protected Context context; public GameMediator(Context androidContext) { this.context = androidContext; } - /*** Abstract method ***/ - - /** - * Creates the model. - * - * @return grid model - * @throws PicrossException if there is a problem - */ - protected abstract PicrossGrid initModel() throws PicrossException; - - /*** Method overloaded from the class Mediator ***/ - - /** {@inheritDoc} */ - @Override - public void eventPerformed(SimpleEvent e) { - GameMediator.log.debug("eventPerformed(" + e + ")"); - - this.fireEventPerformed(e); - } - /*** Methods ***/ /** @@ -135,22 +103,19 @@ return new GameUI(this.context, width, height, gridView, controller); } - /** - * Initialises the controller. - * - * @return the created controller - */ + @Override + public void eventPerformed(SimpleEvent e) { + //GameMediator.log.debug("eventPerformed(" + e + ")"); - protected GameController initController() { - return new GameController(); - } + String cmd = e.getCommandName(); - /** - * Returns the game view. - * - * @return the view - */ - public final GameView getView() { - return this.view; + if (cmd.equals(picross.common.ui.PicrossController.RESET_CMD)) { + this.grid.clear(); + this.view.repaint(); + + return; + } + + this.fireEventPerformed(e); } } Modified: trunk/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- trunk/android/src/picross/specific/game/ui/GameUI.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/android/src/picross/specific/game/ui/GameUI.java 2013-01-28 08:42:39 UTC (rev 136) @@ -180,6 +180,7 @@ public void populateOptionsMenu(Menu menu) { menu.clear(); + menu.add(Menu.NONE, GameController.RESET_CMD_ID, Menu.NONE, BundleHelper.getString(this, "resetButton")); menu.add(Menu.NONE, GameController.QUIT_CMD_ID, Menu.NONE, BundleHelper.getString(this, "menuButton")); } @@ -193,4 +194,8 @@ protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) { this.setMeasuredDimension(this.grid.getWidth(), this.grid.getHeight()); } + + public void repaint() { + this.invalidate(); + } } Modified: trunk/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- trunk/android/src/picross/specific/grid/ui/GridUI.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/android/src/picross/specific/grid/ui/GridUI.java 2013-01-28 08:42:39 UTC (rev 136) @@ -711,6 +711,20 @@ this.boxes[row][col].updateState(box); } + public void clearAll() { + for (UIBox[] boxRow : this.boxes) { + for (UIBox box : boxRow) { + box.updateState(GridUI.EMPTY_BOX); + } + } + } + + private static final Box EMPTY_BOX = new Box(); + + public void doRepaint() { + //this.repaint(); + } + @Override public boolean onTouch(View view, MotionEvent event) { this.controller.onTouch(null, event); Copied: trunk/common/src/picross/common/game/ui/AbstractGameMediator.java (from rev 134, trunk/common/src/picross/common/game/ui/GameMediator.java) =================================================================== --- trunk/common/src/picross/common/game/ui/AbstractGameMediator.java (rev 0) +++ trunk/common/src/picross/common/game/ui/AbstractGameMediator.java 2013-01-28 08:42:39 UTC (rev 136) @@ -0,0 +1,124 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2013 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.common.game.ui; + +import fr.cle.mmvcs.Mediateur; + +import picross.engine.PicrossException; +import picross.engine.grid.PicrossGrid; + +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + +import picross.specific.game.ui.GameUI; +import picross.specific.game.ui.GameController; + +import picross.common.grid.ui.IGridMediator; +import picross.common.grid.ui.GridView; + +import picross.common.ui.PicrossController; + +import fr.cle.mmvcs.SimpleEvent; + +public abstract class AbstractGameMediator extends Mediateur { + /*** Static field ***/ + + /** The class' logger. */ + private static PicrossLogger log = PicrossLogHelper.getLogger(AbstractGameMediator.class); + + /*** Fields ***/ + + /** The game view. */ + protected GameUI view; + + /** The game grid. */ + protected IGridMediator grid; + + /*** Abstrac method ***/ + + /** + * Creates the model. + * + * @return grid model + * @throws PicrossException if there is a problem + */ + protected abstract PicrossGrid initModel() throws PicrossException; + + /*** Method overloaded from the class Mediator ***/ + + /** {@inheritDoc} */ + @Override + public void eventPerformed(SimpleEvent e) { + //GameMediator.log.debug("eventPerformed(" + e + ")"); + + String cmd = e.getCommandName(); + + if (cmd.equals(PicrossController.RESET_CMD)) { + this.grid.clear(); + return; + } + + this.fireEventPerformed(e); + } + + /*** Methods ***/ + + /** + * Inits the game. + * + * @throws PicrossException if there is a problem loading the grid model + * or building the view + */ + public abstract void init() throws PicrossException; + + /** + * Initialises the controller. + * + * @return the created controller + */ + protected GameController initController() { + return new GameController(); + } + + /** + * Returns the game view. + * + * @return the view + */ + public final GameView getView() { + return this.view; + } + +} + Deleted: trunk/common/src/picross/common/game/ui/GameMediator.java =================================================================== --- trunk/common/src/picross/common/game/ui/GameMediator.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/common/src/picross/common/game/ui/GameMediator.java 2013-01-28 08:42:39 UTC (rev 136) @@ -1,45 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2007-2013 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package picross.common.game.ui; - -import fr.cle.mmvcs.IMediateur; - -import picross.engine.PicrossException; -import picross.engine.grid.PicrossGrid; - -public interface GameMediator extends IMediateur { - PicrossGrid initModel() throws PicrossException; - void init() throws PicrossException; -} - Modified: trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java =================================================================== --- trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-28 08:42:39 UTC (rev 136) @@ -217,6 +217,12 @@ this.fireEventPerformed(GridCommands.ERASE_MODE_CMD); } + public void clear() { + this.model.clearAll(); + this.view.clearAll(); + this.fireEventPerformed(GridCommands.REPAINT_EVERYTHING_CMD); + } + /*** Accessor ***/ /** Modified: trunk/common/src/picross/common/grid/ui/GridCommands.java =================================================================== --- trunk/common/src/picross/common/grid/ui/GridCommands.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/common/src/picross/common/grid/ui/GridCommands.java 2013-01-28 08:42:39 UTC (rev 136) @@ -60,5 +60,7 @@ /** Command asking to enable the Erase mode. */ public static final String ERASE_MODE_CMD = "ERASE_MODE_CMD"; + public static final String REPAINT_EVERYTHING_CMD = "REPAINT_EVERYTHING_CMD"; + private GridCommands() { } } Modified: trunk/common/src/picross/common/grid/ui/IGridMediator.java =================================================================== --- trunk/common/src/picross/common/grid/ui/IGridMediator.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/common/src/picross/common/grid/ui/IGridMediator.java 2013-01-28 08:42:39 UTC (rev 136) @@ -61,6 +61,8 @@ /** Enables the erase mode. */ void setEraseMode(); + void clear(); + /** * Returns the grid view. * Modified: trunk/common/src/picross/common/ui/PicrossController.java =================================================================== --- trunk/common/src/picross/common/ui/PicrossController.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/common/src/picross/common/ui/PicrossController.java 2013-01-28 08:42:39 UTC (rev 136) @@ -56,6 +56,8 @@ /** Command used to quit a game. */ public static final String QUIT_CMD = "QUIT_CMD"; + public static final String RESET_CMD = "RESET_CMD"; + /*** Field ***/ /** The view to which this controller is attached. */ Added: trunk/common/src/picross/specific/game/ui/GameController.java =================================================================== --- trunk/common/src/picross/specific/game/ui/GameController.java (rev 0) +++ trunk/common/src/picross/specific/game/ui/GameController.java 2013-01-28 08:42:39 UTC (rev 136) @@ -0,0 +1,43 @@ +/* + * $Id$ + * + * Copyright (c) 2008-2013 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.game.ui; + +import fr.cle.mmvcs.Controller; +import fr.cle.mmvcs.SimpleEvent; + +public class GameController extends Controller { + public void eventPerformed(SimpleEvent event) { } +} + + Property changes on: trunk/common/src/picross/specific/game/ui/GameController.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: trunk/common/src/picross/specific/game/ui/GameUI.java =================================================================== --- trunk/common/src/picross/specific/game/ui/GameUI.java (rev 0) +++ trunk/common/src/picross/specific/game/ui/GameUI.java 2013-01-28 08:42:39 UTC (rev 136) @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2013 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.game.ui; + +import picross.common.game.ui.GameView; + +public class GameUI implements GameView { } + Property changes on: trunk/common/src/picross/specific/game/ui/GameUI.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/common/src/picross/specific/grid/ui/GridUI.java =================================================================== --- trunk/common/src/picross/specific/grid/ui/GridUI.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/common/src/picross/specific/grid/ui/GridUI.java 2013-01-28 08:42:39 UTC (rev 136) @@ -50,4 +50,5 @@ public void init() throws FileNotFoundException { } public void updateBox(int row, int col, Box box) { } + public void clearAll() { } } Modified: trunk/engine/src/picross/engine/grid/GridModel.java =================================================================== --- trunk/engine/src/picross/engine/grid/GridModel.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/engine/src/picross/engine/grid/GridModel.java 2013-01-28 08:42:39 UTC (rev 136) @@ -117,8 +117,8 @@ this.rowData = GridModel.getRowHints(this.data); this.completedHints = - new CompletedHints(data.length, this.colData[0].length, - data[0].length, this.rowData[0].length); + new CompletedHints(this.data.length, this.colData[0].length, + this.data[0].length, this.rowData[0].length); /* * Marks the empty rows and columns as completed @@ -1036,5 +1036,15 @@ public CompletedHints getCompletedHints() { return this.completedHints; } + + public void clearAll() { + //for (Box[] boxRow : this.boxes) { + // for (Box box : boxRow) { + for (int i = 0; i < this.boxes.length; i++) { + for (int j = 0; j < this.boxes[i].length; j++) { + this.actOnBox(j, i, GridAction.EMPTY); + } + } + } } Modified: trunk/properties/messages_picross.properties =================================================================== --- trunk/properties/messages_picross.properties 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/properties/messages_picross.properties 2013-01-28 08:42:39 UTC (rev 136) @@ -4,6 +4,7 @@ # picross.game.GameUI gridSize = Size menuButton = Back to menu +resetButton = Reset # picross.game.random.RandomGameUI anotherGrid = Another grid Modified: trunk/properties/messages_picross_fr.properties =================================================================== --- trunk/properties/messages_picross_fr.properties 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/properties/messages_picross_fr.properties 2013-01-28 08:42:39 UTC (rev 136) @@ -4,6 +4,7 @@ # picross.game.GameUI gridSize = Taille menuButton = Retour au menu +resetButton = Recommencer # picross.game.random.RandomGameUI anotherGrid = Une autre grille Modified: trunk/swing/src/picross/specific/game/ui/GameController.java =================================================================== --- trunk/swing/src/picross/specific/game/ui/GameController.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/swing/src/picross/specific/game/ui/GameController.java 2013-01-28 08:42:39 UTC (rev 136) @@ -74,6 +74,11 @@ this.fireEventPerformed(cmd); return; } + + if (cmd.equals(PicrossController.RESET_CMD)) { + this.fireEventPerformed(cmd); + return; + } } } Modified: trunk/swing/src/picross/specific/game/ui/GameMediator.java =================================================================== --- trunk/swing/src/picross/specific/game/ui/GameMediator.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/swing/src/picross/specific/game/ui/GameMediator.java 2013-01-28 08:42:39 UTC (rev 136) @@ -33,7 +33,6 @@ package picross.specific.game.ui; -import fr.cle.mmvcs.Mediateur; import fr.cle.mmvcs.SimpleEvent; import java.awt.event.ActionListener; @@ -50,6 +49,7 @@ import picross.common.grid.ui.GridView; import picross.common.grid.ui.IGridMediator; +import picross.common.game.ui.AbstractGameMediator; import picross.common.game.ui.GameView; /** @@ -57,40 +57,7 @@ * * @author Y. Norsa */ -public abstract class GameMediator extends Mediateur { - /*** Static field ***/ - - /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(GameMediator.class); - - /*** Fields ***/ - - /** The game view. */ - private GameUI view; - - /** The game grid. */ - private IGridMediator grid; - - /*** Abstrac method ***/ - - /** - * Creates the model. - * - * @return grid model - * @throws PicrossException if there is a problem - */ - protected abstract PicrossGrid initModel() throws PicrossException; - - /*** Method overloaded from the class Mediator ***/ - - /** {@inheritDoc} */ - @Override - public void eventPerformed(SimpleEvent e) { - //GameMediator.log.debug("eventPerformed(" + e + ")"); - - this.fireEventPerformed(e); - } - +public abstract class GameMediator extends AbstractGameMediator { /*** Methods ***/ /** @@ -137,22 +104,4 @@ ActionListener controller) { return new GameUI(width, height, gridView, controller); } - - /** - * Initialises the controller. - * - * @return the created controller - */ - protected GameController initController() { - return new GameController(); - } - - /** - * Returns the game view. - * - * @return the view - */ - public final GameView getView() { - return this.view; - } } Modified: trunk/swing/src/picross/specific/game/ui/GameUI.java =================================================================== --- trunk/swing/src/picross/specific/game/ui/GameUI.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/swing/src/picross/specific/game/ui/GameUI.java 2013-01-28 08:42:39 UTC (rev 136) @@ -109,6 +109,11 @@ this.buttonsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); this.buttonsPanel.setBackground(Color.WHITE); + JButton resetButton = new JButton(BundleHelper.getString(this, "resetButton")); + resetButton.addActionListener(listener); + resetButton.setActionCommand(PicrossController.RESET_CMD); + this.buttonsPanel.add(resetButton); + JButton menuButton = new JButton(BundleHelper.getString(this, "menuButton")); menuButton.addActionListener(listener); Modified: trunk/swing/src/picross/specific/grid/ui/GridController.java =================================================================== --- trunk/swing/src/picross/specific/grid/ui/GridController.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/swing/src/picross/specific/grid/ui/GridController.java 2013-01-28 08:42:39 UTC (rev 136) @@ -106,6 +106,11 @@ this.eraseMode = true; return; } + + if (cmd.equals(GridCommands.REPAINT_EVERYTHING_CMD)) { + this.view.doRepaint(); + return; + } } /*** Methods implanted from the interface MouseListener ***/ Modified: trunk/swing/src/picross/specific/grid/ui/GridUI.java =================================================================== --- trunk/swing/src/picross/specific/grid/ui/GridUI.java 2013-01-23 11:32:35 UTC (rev 135) +++ trunk/swing/src/picross/specific/grid/ui/GridUI.java 2013-01-28 08:42:39 UTC (rev 136) @@ -732,4 +732,18 @@ public void updateBox(int row, int col, Box box) { this.boxes[row][col].updateState(box); } + + public void clearAll() { + for (UIBox[] boxRow : this.boxes) { + for (UIBox box : boxRow) { + box.updateState(GridUI.EMPTY_BOX); + } + } + } + + private static final Box EMPTY_BOX = new Box(); + + public void doRepaint() { + this.repaint(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-23 11:32:37
|
Revision: 135 http://sourceforge.net/p/picross/code/135 Author: yvan_norsa Date: 2013-01-23 11:32:35 +0000 (Wed, 23 Jan 2013) Log Message: ----------- added config files Added Paths: ----------- trunk/android/local.sample.properties trunk/android/project.properties Added: trunk/android/local.sample.properties =================================================================== --- trunk/android/local.sample.properties (rev 0) +++ trunk/android/local.sample.properties 2013-01-23 11:32:35 UTC (rev 135) @@ -0,0 +1,4 @@ +# location of the SDK. This is only used by Ant +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=/home/dev/android-sdk-linux Added: trunk/android/project.properties =================================================================== --- trunk/android/project.properties (rev 0) +++ trunk/android/project.properties 2013-01-23 11:32:35 UTC (rev 135) @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-17 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-23 08:35:53
|
Revision: 134 http://sourceforge.net/p/picross/code/134 Author: yvan_norsa Date: 2013-01-23 08:35:48 +0000 (Wed, 23 Jan 2013) Log Message: ----------- updated copyright Modified Paths: -------------- trunk/android/src/picross/specific/activities/MainMenuActivityUI.java trunk/android/src/picross/specific/activities/PicrossActivityUI.java trunk/android/src/picross/specific/activities/PicrossMainActivity.java trunk/android/src/picross/specific/game/random/ui/RandomGameController.java trunk/android/src/picross/specific/game/random/ui/RandomGameMediator.java trunk/android/src/picross/specific/game/random/ui/RandomGameModeUI.java trunk/android/src/picross/specific/game/random/ui/RandomGameUI.java trunk/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java trunk/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java trunk/android/src/picross/specific/game/simple/ui/LevelMenuUI.java trunk/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java trunk/android/src/picross/specific/game/ui/GameController.java trunk/android/src/picross/specific/game/ui/GameMediator.java trunk/android/src/picross/specific/game/ui/GameUI.java trunk/android/src/picross/specific/game/ui/UIGameMode.java trunk/android/src/picross/specific/grid/ui/GridController.java trunk/android/src/picross/specific/grid/ui/GridMediator.java trunk/android/src/picross/specific/grid/ui/GridUI.java trunk/android/src/picross/specific/grid/ui/HintBoxInfos.java trunk/android/src/picross/specific/grid/ui/Point.java trunk/android/src/picross/specific/grid/ui/UIBox.java trunk/android/src/picross/specific/ui/AbstractAndroidView.java trunk/android/src/picross/specific/ui/GameMenuMediator.java trunk/android/src/picross/specific/ui/GameMenuUI.java trunk/android/src/picross/specific/ui/MainMenuMediator.java trunk/android/src/picross/specific/ui/MainMenuUI.java trunk/android/src/picross/specific/ui/MenuController.java trunk/android/src/picross/specific/ui/MenuUI.java trunk/android/src/picross/specific/ui/PicrossAndroidLogger.java trunk/android/src/picross/specific/ui/PicrossButton.java trunk/android/src/picross/specific/ui/PicrossEvent.java trunk/android/src/picross/specific/ui/PicrossLabel.java trunk/android/src/picross/specific/ui/PicrossMediator.java trunk/android/src/picross/specific/ui/PicrossUIHelper.java trunk/android/src/picross/specific/ui/WaitMenuMediator.java trunk/android/src/picross/specific/ui/WaitMenuUI.java trunk/common/src/picross/common/game/simple/ui/LevelMenuController.java trunk/common/src/picross/common/game/simple/ui/LevelMenuMediator.java trunk/common/src/picross/common/game/simple/ui/LevelMenuModel.java trunk/common/src/picross/common/game/simple/ui/LevelsListCommand.java trunk/common/src/picross/common/game/simple/ui/SelectSizeCommand.java trunk/common/src/picross/common/game/simple/ui/SimpleGameMediator.java trunk/common/src/picross/common/game/simple/ui/SizesListCommand.java trunk/common/src/picross/common/game/ui/GameCommand.java trunk/common/src/picross/common/game/ui/GameMediator.java trunk/common/src/picross/common/game/ui/GameView.java trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java trunk/common/src/picross/common/grid/ui/FillCommand.java trunk/common/src/picross/common/grid/ui/GridCommands.java trunk/common/src/picross/common/grid/ui/GridView.java trunk/common/src/picross/common/grid/ui/IGridMediator.java trunk/common/src/picross/common/grid/ui/PaintCommand.java trunk/common/src/picross/common/grid/ui/RepaintLeftHintsCommand.java trunk/common/src/picross/common/grid/ui/RepaintTopHintsCommand.java trunk/common/src/picross/common/ui/AbstractMenuController.java trunk/common/src/picross/common/ui/AbstractPicrossMediator.java trunk/common/src/picross/common/ui/AbstractWaitMenuMediator.java trunk/common/src/picross/common/ui/GameMenuModel.java trunk/common/src/picross/common/ui/MainMenuUI.java trunk/common/src/picross/common/ui/MenuCommand.java trunk/common/src/picross/common/ui/MenuMediator.java trunk/common/src/picross/common/ui/MissingImageException.java trunk/common/src/picross/common/ui/PicrossController.java trunk/common/src/picross/common/ui/PicrossUI.java trunk/common/src/picross/common/ui/PicrossView.java trunk/engine/src/picross/engine/AbstractPicrossLogger.java trunk/engine/src/picross/engine/Picross.java trunk/engine/src/picross/engine/PicrossException.java trunk/engine/src/picross/engine/PicrossLogHelper.java trunk/engine/src/picross/engine/PicrossLogger.java trunk/engine/src/picross/engine/game/AbstractPicrossModel.java trunk/engine/src/picross/engine/game/GameMode.java trunk/engine/src/picross/engine/game/random/RandomGameMode.java trunk/engine/src/picross/engine/game/random/RandomPicrossModel.java trunk/engine/src/picross/engine/game/simple/Dimensions.java trunk/engine/src/picross/engine/game/simple/FileInfos.java trunk/engine/src/picross/engine/game/simple/LevelInfos.java trunk/engine/src/picross/engine/game/simple/SimpleGameMode.java trunk/engine/src/picross/engine/game/simple/XBMException.java trunk/engine/src/picross/engine/game/simple/XBMModel.java trunk/engine/src/picross/engine/grid/Box.java trunk/engine/src/picross/engine/grid/CompletedHints.java trunk/engine/src/picross/engine/grid/GridAction.java trunk/engine/src/picross/engine/grid/GridModel.java trunk/engine/src/picross/engine/grid/PicrossGrid.java trunk/swing/src/picross/specific/game/random/ui/RandomGameController.java trunk/swing/src/picross/specific/game/random/ui/RandomGameMediator.java trunk/swing/src/picross/specific/game/random/ui/RandomGameModeUI.java trunk/swing/src/picross/specific/game/random/ui/RandomGameUI.java trunk/swing/src/picross/specific/game/simple/ui/LevelMenuUI.java trunk/swing/src/picross/specific/game/simple/ui/SimpleGameModeUI.java trunk/swing/src/picross/specific/game/ui/GameController.java trunk/swing/src/picross/specific/game/ui/GameMediator.java trunk/swing/src/picross/specific/game/ui/GameUI.java trunk/swing/src/picross/specific/game/ui/UIGameMode.java trunk/swing/src/picross/specific/grid/ui/GridController.java trunk/swing/src/picross/specific/grid/ui/GridMediator.java trunk/swing/src/picross/specific/grid/ui/GridUI.java trunk/swing/src/picross/specific/grid/ui/HintBoxInfos.java trunk/swing/src/picross/specific/grid/ui/UIBox.java trunk/swing/src/picross/specific/ui/GameMenuMediator.java trunk/swing/src/picross/specific/ui/GameMenuUI.java trunk/swing/src/picross/specific/ui/MainMenuMediator.java trunk/swing/src/picross/specific/ui/MenuController.java trunk/swing/src/picross/specific/ui/MenuUI.java trunk/swing/src/picross/specific/ui/PicrossButton.java trunk/swing/src/picross/specific/ui/PicrossLog4jLogger.java trunk/swing/src/picross/specific/ui/PicrossMediator.java trunk/swing/src/picross/specific/ui/PicrossUIHelper.java trunk/swing/src/picross/specific/ui/WaitMenuMediator.java trunk/swing/src/picross/specific/ui/WaitMenuUI.java Property Changed: ---------------- trunk/common/src/picross/common/game/simple/ui/LevelMenuMediator.java Modified: trunk/android/src/picross/specific/activities/MainMenuActivityUI.java =================================================================== --- trunk/android/src/picross/specific/activities/MainMenuActivityUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/activities/MainMenuActivityUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/activities/PicrossActivityUI.java =================================================================== --- trunk/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/activities/PicrossMainActivity.java =================================================================== --- trunk/android/src/picross/specific/activities/PicrossMainActivity.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/activities/PicrossMainActivity.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/random/ui/RandomGameController.java =================================================================== --- trunk/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/random/ui/RandomGameMediator.java =================================================================== --- trunk/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/random/ui/RandomGameModeUI.java =================================================================== --- trunk/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/random/ui/RandomGameUI.java =================================================================== --- trunk/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java =================================================================== --- trunk/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java =================================================================== --- trunk/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/simple/ui/LevelMenuUI.java =================================================================== --- trunk/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java =================================================================== --- trunk/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/ui/GameController.java =================================================================== --- trunk/android/src/picross/specific/game/ui/GameController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/ui/GameController.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/ui/GameMediator.java =================================================================== --- trunk/android/src/picross/specific/game/ui/GameMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/ui/GameMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- trunk/android/src/picross/specific/game/ui/GameUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/ui/GameUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/game/ui/UIGameMode.java =================================================================== --- trunk/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/grid/ui/GridController.java =================================================================== --- trunk/android/src/picross/specific/grid/ui/GridController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/grid/ui/GridController.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/grid/ui/GridMediator.java =================================================================== --- trunk/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- trunk/android/src/picross/specific/grid/ui/GridUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/grid/ui/GridUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/grid/ui/HintBoxInfos.java =================================================================== --- trunk/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/grid/ui/Point.java =================================================================== --- trunk/android/src/picross/specific/grid/ui/Point.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/grid/ui/Point.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/grid/ui/UIBox.java =================================================================== --- trunk/android/src/picross/specific/grid/ui/UIBox.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/grid/ui/UIBox.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/AbstractAndroidView.java =================================================================== --- trunk/android/src/picross/specific/ui/AbstractAndroidView.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/AbstractAndroidView.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,5 +1,33 @@ /* * $Id$ + * + * Copyright (c) 2008-2013 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. */ Modified: trunk/android/src/picross/specific/ui/GameMenuMediator.java =================================================================== --- trunk/android/src/picross/specific/ui/GameMenuMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/GameMenuMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/GameMenuUI.java =================================================================== --- trunk/android/src/picross/specific/ui/GameMenuUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/GameMenuUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/MainMenuMediator.java =================================================================== --- trunk/android/src/picross/specific/ui/MainMenuMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/MainMenuMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/MainMenuUI.java =================================================================== --- trunk/android/src/picross/specific/ui/MainMenuUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/MainMenuUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/MenuController.java =================================================================== --- trunk/android/src/picross/specific/ui/MenuController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/MenuController.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/MenuUI.java =================================================================== --- trunk/android/src/picross/specific/ui/MenuUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/MenuUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/PicrossAndroidLogger.java =================================================================== --- trunk/android/src/picross/specific/ui/PicrossAndroidLogger.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/PicrossAndroidLogger.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/PicrossButton.java =================================================================== --- trunk/android/src/picross/specific/ui/PicrossButton.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/PicrossButton.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/PicrossEvent.java =================================================================== --- trunk/android/src/picross/specific/ui/PicrossEvent.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/PicrossEvent.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/PicrossLabel.java =================================================================== --- trunk/android/src/picross/specific/ui/PicrossLabel.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/PicrossLabel.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/PicrossMediator.java =================================================================== --- trunk/android/src/picross/specific/ui/PicrossMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/PicrossMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/PicrossUIHelper.java =================================================================== --- trunk/android/src/picross/specific/ui/PicrossUIHelper.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/PicrossUIHelper.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2001 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/WaitMenuMediator.java =================================================================== --- trunk/android/src/picross/specific/ui/WaitMenuMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/WaitMenuMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/android/src/picross/specific/ui/WaitMenuUI.java =================================================================== --- trunk/android/src/picross/specific/ui/WaitMenuUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/android/src/picross/specific/ui/WaitMenuUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/simple/ui/LevelMenuController.java =================================================================== --- trunk/common/src/picross/common/game/simple/ui/LevelMenuController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/simple/ui/LevelMenuController.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/simple/ui/LevelMenuMediator.java =================================================================== --- trunk/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Property changes on: trunk/common/src/picross/common/game/simple/ui/LevelMenuMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: trunk/common/src/picross/common/game/simple/ui/LevelMenuModel.java =================================================================== --- trunk/common/src/picross/common/game/simple/ui/LevelMenuModel.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/simple/ui/LevelMenuModel.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/simple/ui/LevelsListCommand.java =================================================================== --- trunk/common/src/picross/common/game/simple/ui/LevelsListCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/simple/ui/LevelsListCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/simple/ui/SelectSizeCommand.java =================================================================== --- trunk/common/src/picross/common/game/simple/ui/SelectSizeCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/simple/ui/SelectSizeCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/simple/ui/SimpleGameMediator.java =================================================================== --- trunk/common/src/picross/common/game/simple/ui/SimpleGameMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/simple/ui/SimpleGameMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/simple/ui/SizesListCommand.java =================================================================== --- trunk/common/src/picross/common/game/simple/ui/SizesListCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/simple/ui/SizesListCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/ui/GameCommand.java =================================================================== --- trunk/common/src/picross/common/game/ui/GameCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/ui/GameCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/ui/GameMediator.java =================================================================== --- trunk/common/src/picross/common/game/ui/GameMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/ui/GameMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/game/ui/GameView.java =================================================================== --- trunk/common/src/picross/common/game/ui/GameView.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/game/ui/GameView.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java =================================================================== --- trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/grid/ui/FillCommand.java =================================================================== --- trunk/common/src/picross/common/grid/ui/FillCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/FillCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/grid/ui/GridCommands.java =================================================================== --- trunk/common/src/picross/common/grid/ui/GridCommands.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/GridCommands.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,5 +1,33 @@ /* * $Id$ + + * Copyright (c) 2011-2013 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. */ Modified: trunk/common/src/picross/common/grid/ui/GridView.java =================================================================== --- trunk/common/src/picross/common/grid/ui/GridView.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/GridView.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2011 + * Copyright (c) 2011-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/grid/ui/IGridMediator.java =================================================================== --- trunk/common/src/picross/common/grid/ui/IGridMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/IGridMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/grid/ui/PaintCommand.java =================================================================== --- trunk/common/src/picross/common/grid/ui/PaintCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/PaintCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/grid/ui/RepaintLeftHintsCommand.java =================================================================== --- trunk/common/src/picross/common/grid/ui/RepaintLeftHintsCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/RepaintLeftHintsCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/grid/ui/RepaintTopHintsCommand.java =================================================================== --- trunk/common/src/picross/common/grid/ui/RepaintTopHintsCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/grid/ui/RepaintTopHintsCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/AbstractMenuController.java =================================================================== --- trunk/common/src/picross/common/ui/AbstractMenuController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/AbstractMenuController.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/AbstractPicrossMediator.java =================================================================== --- trunk/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/AbstractWaitMenuMediator.java =================================================================== --- trunk/common/src/picross/common/ui/AbstractWaitMenuMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/AbstractWaitMenuMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/GameMenuModel.java =================================================================== --- trunk/common/src/picross/common/ui/GameMenuModel.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/GameMenuModel.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/MainMenuUI.java =================================================================== --- trunk/common/src/picross/common/ui/MainMenuUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/MainMenuUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/MenuCommand.java =================================================================== --- trunk/common/src/picross/common/ui/MenuCommand.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/MenuCommand.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/MenuMediator.java =================================================================== --- trunk/common/src/picross/common/ui/MenuMediator.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/MenuMediator.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/MissingImageException.java =================================================================== --- trunk/common/src/picross/common/ui/MissingImageException.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/MissingImageException.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2001 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/PicrossController.java =================================================================== --- trunk/common/src/picross/common/ui/PicrossController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/PicrossController.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/PicrossUI.java =================================================================== --- trunk/common/src/picross/common/ui/PicrossUI.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/PicrossUI.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/common/src/picross/common/ui/PicrossView.java =================================================================== --- trunk/common/src/picross/common/ui/PicrossView.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/common/src/picross/common/ui/PicrossView.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008-2011 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/AbstractPicrossLogger.java =================================================================== --- trunk/engine/src/picross/engine/AbstractPicrossLogger.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/AbstractPicrossLogger.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,5 +1,33 @@ /* * $Id$ + * + * Copyright (c) 2007-2013 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. */ Modified: trunk/engine/src/picross/engine/Picross.java =================================================================== --- trunk/engine/src/picross/engine/Picross.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/Picross.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/PicrossException.java =================================================================== --- trunk/engine/src/picross/engine/PicrossException.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/PicrossException.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/PicrossLogHelper.java =================================================================== --- trunk/engine/src/picross/engine/PicrossLogHelper.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/PicrossLogHelper.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/PicrossLogger.java =================================================================== --- trunk/engine/src/picross/engine/PicrossLogger.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/PicrossLogger.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/AbstractPicrossModel.java =================================================================== --- trunk/engine/src/picross/engine/game/AbstractPicrossModel.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/AbstractPicrossModel.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/GameMode.java =================================================================== --- trunk/engine/src/picross/engine/game/GameMode.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/GameMode.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/random/RandomGameMode.java =================================================================== --- trunk/engine/src/picross/engine/game/random/RandomGameMode.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/random/RandomGameMode.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/random/RandomPicrossModel.java =================================================================== --- trunk/engine/src/picross/engine/game/random/RandomPicrossModel.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/random/RandomPicrossModel.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/simple/Dimensions.java =================================================================== --- trunk/engine/src/picross/engine/game/simple/Dimensions.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/simple/Dimensions.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/simple/FileInfos.java =================================================================== --- trunk/engine/src/picross/engine/game/simple/FileInfos.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/simple/FileInfos.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/simple/LevelInfos.java =================================================================== --- trunk/engine/src/picross/engine/game/simple/LevelInfos.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/simple/LevelInfos.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/simple/SimpleGameMode.java =================================================================== --- trunk/engine/src/picross/engine/game/simple/SimpleGameMode.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/simple/SimpleGameMode.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2008 + * Copyright (c) 2008-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/simple/XBMException.java =================================================================== --- trunk/engine/src/picross/engine/game/simple/XBMException.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/simple/XBMException.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/game/simple/XBMModel.java =================================================================== --- trunk/engine/src/picross/engine/game/simple/XBMModel.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/game/simple/XBMModel.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/grid/Box.java =================================================================== --- trunk/engine/src/picross/engine/grid/Box.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/grid/Box.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2011 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/grid/CompletedHints.java =================================================================== --- trunk/engine/src/picross/engine/grid/CompletedHints.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/grid/CompletedHints.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/grid/GridAction.java =================================================================== --- trunk/engine/src/picross/engine/grid/GridAction.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/grid/GridAction.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/grid/GridModel.java =================================================================== --- trunk/engine/src/picross/engine/grid/GridModel.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/grid/GridModel.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007-2008 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/engine/src/picross/engine/grid/PicrossGrid.java =================================================================== --- trunk/engine/src/picross/engine/grid/PicrossGrid.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/engine/src/picross/engine/grid/PicrossGrid.java 2013-01-23 08:35:48 UTC (rev 134) @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2007 + * Copyright (c) 2007-2013 * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, Modified: trunk/swing/src/picross/specific/game/random/ui/RandomGameController.java =================================================================== --- trunk/swing/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-23 08:22:42 UTC (rev 133) +++ trunk/swing/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-2... [truncated message content] |
From: <yva...@us...> - 2013-01-23 08:22:45
|
Revision: 133 http://sourceforge.net/p/picross/code/133 Author: yvan_norsa Date: 2013-01-23 08:22:42 +0000 (Wed, 23 Jan 2013) Log Message: ----------- suppression branche obsolete Removed Paths: ------------- branches/picross-web/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-23 08:22:15
|
Revision: 132 http://sourceforge.net/p/picross/code/132 Author: yvan_norsa Date: 2013-01-23 08:22:11 +0000 (Wed, 23 Jan 2013) Log Message: ----------- suppression branche obsolete Removed Paths: ------------- branches/engine_split/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-23 08:21:31
|
Revision: 131 http://sourceforge.net/p/picross/code/131 Author: yvan_norsa Date: 2013-01-23 08:21:27 +0000 (Wed, 23 Jan 2013) Log Message: ----------- reintegration branche separation moteur/etc Modified Paths: -------------- trunk/applet/picross.jnlp trunk/build.xml trunk/log4j.properties trunk/src/picross/app/PicrossApp.java trunk/src/picross/app/PicrossAppUI.java trunk/src/picross/applet/MainMenuAppletUI.java trunk/src/picross/applet/PicrossApplet.java Added Paths: ----------- trunk/android/ trunk/common/ trunk/engine/ trunk/images/empty_button.png trunk/images/en/button_back.png trunk/images/en/button_exit.png trunk/images/en/button_play.png trunk/images/en/button_random.png trunk/images/en/button_select.png trunk/images/en/label_wait.png trunk/images/fr/button_back.png trunk/images/fr/button_exit.png trunk/images/fr/button_play.png trunk/images/fr/button_random.png trunk/images/fr/button_select.png trunk/images/fr/label_wait.png trunk/properties/ trunk/services/picross.engine.game.GameMode trunk/src/picross/app/MainMenuAppUI.java trunk/swing/ Removed Paths: ------------- trunk/images/empty-button.png trunk/images/en/button-back.png trunk/images/en/button-exit.png trunk/images/en/button-play.png trunk/images/en/button-random.png trunk/images/en/button-select.png trunk/images/en/label-wait.png trunk/images/fr/button-back.png trunk/images/fr/button-exit.png trunk/images/fr/button-play.png trunk/images/fr/button-random.png trunk/images/fr/button-select.png trunk/images/fr/label-wait.png trunk/services/picross.game.GameMode trunk/src/picross/Picross.java trunk/src/picross/PicrossException.java trunk/src/picross/app/MainMenuAppUI.java trunk/src/picross/game/ trunk/src/picross/grid/ trunk/src/picross/properties/ trunk/src/picross/ui/ trunk/test/ Property Changed: ---------------- trunk/ Index: trunk =================================================================== --- trunk 2013-01-18 07:47:31 UTC (rev 130) +++ trunk 2013-01-23 08:21:27 UTC (rev 131) Property changes on: trunk ___________________________________________________________________ Added: svn:mergeinfo ## -0,0 +1 ## +/branches/engine_split:101-130 \ No newline at end of property Modified: trunk/applet/picross.jnlp =================================================================== --- trunk/applet/picross.jnlp 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/applet/picross.jnlp 2013-01-23 08:21:27 UTC (rev 131) @@ -13,6 +13,7 @@ <resources> <j2se version="1.6+" /> + <jar href="picross-engine.jar" /> <jar href="picross.jar" /> <jar href="bundleHelper.jar" /> <jar href="log4j.jar" /> @@ -24,4 +25,4 @@ name="Picross" width="900" height="900" /> -</jnlp> \ No newline at end of file +</jnlp> Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/build.xml 2013-01-23 08:21:27 UTC (rev 131) @@ -3,28 +3,50 @@ <project name="picross" default="dist"> - <property name="build.dir" - value="build" /> + <property name="swing.build.dir" + value="swing/build" /> + <property name="common.build.dir" + value="common/build" /> + <property name="engine.build.dir" + value="engine/build" /> + <property name="game.build.dir" + value="build/game" /> <property name="dist.dir" value="dist" /> <property name="doc.dir" value="doc" /> <property name="lib.dir" value="lib" /> - <property name="src.dir" + <property name="swing.src.dir" + value="swing/src" /> + <property name="common.src.dir" + value="common/src" /> + <property name="engine.src.dir" + value="engine/src" /> + <property name="game.src.dir" value="src" /> - <property name="test.dir" - value="test" /> + <property name="engine.test.dir" + value="engine/test" /> + <property name="common.test.dir" + value="common/test" /> + <property name="swing.test.dir" + value="swing/test" /> - <property name="jar.name" + <property name="swing.jar.name" + value="${dist.dir}/${ant.project.name}-swing.jar" /> + <property name="common.jar.name" + value="${dist.dir}/${ant.project.name}-common.jar" /> + <property name="engine.jar.name" + value="${dist.dir}/${ant.project.name}-engine.jar" /> + <property name="game.jar.name" value="${dist.dir}/${ant.project.name}.jar" /> <property name="bundleHelper.jar" value="${lib.dir}/bundleHelper.jar" /> <property name="debug.jar" value="${lib.dir}/debug.jar" /> - <property name="easymock.jar" - value="${lib.dir}/easymock.jar" /> + <property name="easymock.jar" + value="${lib.dir}/easymock.jar" /> <property name="junit.jar" value="${lib.dir}/junit.jar" /> <property name="log4j.jar" @@ -36,7 +58,10 @@ <target name="-init" depends="-setmode"> - <mkdir dir="${build.dir}" /> + <mkdir dir="${swing.build.dir}" /> + <mkdir dir="${common.build.dir}" /> + <mkdir dir="${engine.build.dir}" /> + <mkdir dir="${game.build.dir}" /> <mkdir dir="${dist.dir}" /> <mkdir dir="${doc.dir}" /> </target> @@ -62,20 +87,36 @@ </target> <path id="classpath"> - <pathelement location="${build.dir}" /> + <pathelement location="${game.build.dir}" /> + <pathelement location="${engine.build.dir}" /> + <pathelement location="${common.build.dir}" /> + <pathelement location="${swing.build.dir}" /> <pathelement location="${bundleHelper.jar}" /> - <pathelement location="${easymock.jar}" /> + <pathelement location="${easymock.jar}" /> <pathelement location="${junit.jar}" /> <pathelement location="${log4j.jar}" /> <pathelement location="${mmvcs.jar}" /> <pathelement location="${simpleButton.jar}" /> </path> - <target name="compile" + <path id="game-classpath"> + <pathelement location="${game.build.dir}" /> + <pathelement location="${swing.jar.name}" /> + <pathelement location="${common.jar.name}" /> + <pathelement location="${engine.jar.name}" /> + <pathelement location="${bundleHelper.jar}" /> + <pathelement location="${easymock.jar}" /> + <pathelement location="${junit.jar}" /> + <pathelement location="${log4j.jar}" /> + <pathelement location="${mmvcs.jar}" /> + <pathelement location="${simpleButton.jar}" /> + </path> + + <target name="swing-compile" depends="-init"> - <javac srcdir="${src.dir}" - destdir="${build.dir}" + <javac srcdir="${swing.src.dir}" + destdir="${swing.build.dir}" deprecation="on" debug="${javac.debug}" optimize="${javac.optimize}"> @@ -85,11 +126,48 @@ </javac> </target> - <target name="compile-test" - depends="compile"> - <javac srcdir="${test.dir}" - destdir="${build.dir}" + <target name="common-compile" + depends="-init,engine-dist"> + <javac srcdir="${common.src.dir}" + destdir="${common.build.dir}" deprecation="on" + debug="${javac.debug}" + optimize="${javac.optimize}"> + <compilerarg value="-Xlint:all" /> + + <classpath refid="classpath" /> + </javac> + </target> + + <target name="engine-compile" + depends="-init"> + <javac srcdir="${engine.src.dir}" + destdir="${engine.build.dir}" + deprecation="on" + debug="${javac.debug}" + optimize="${javac.optimize}"> + <compilerarg value="-Xlint:all" /> + </javac> + </target> + + <target name="game-compile" + depends="swing-dist,-init"> + <javac srcdir="${game.src.dir}" + destdir="${game.build.dir}" + deprecation="on" + debug="${javac.debug}" + optimize="${javac.optimize}"> + <compilerarg value="-Xlint:all" /> + + <classpath refid="game-classpath" /> + </javac> + </target> + + <target name="engine-compile-test" + depends="engine-compile"> + <javac srcdir="${engine.test.dir}" + destdir="${engine.build.dir}" + deprecation="on" debug="on" optimize="off"> <compilerarg value="-Xlint:all" /> @@ -98,27 +176,76 @@ </javac> </target> + <target name="common-compile-test" + depends="common-compile"> + <javac srcdir="${common.test.dir}" + destdir="${common.build.dir}" + deprecation="on" + debug="on" + optimize="off"> + <compilerarg value="-Xlint:all" /> + + <classpath refid="classpath" /> + </javac> + </target> + + <target name="swing-compile-test" + depends="swing-compile"> + <javac srcdir="${swing.test.dir}" + destdir="${swing.build.dir}" + deprecation="on" + debug="on" + optimize="off"> + <compilerarg value="-Xlint:all" /> + + <classpath refid="classpath" /> + </javac> + </target> + + <target name="engine-dist" + depends="engine-compile"> + <jar destfile="${engine.jar.name}" + basedir="${engine.build.dir}" /> + </target> + + <target name="swing-dist" + depends="engine-dist,common-dist,swing-compile"> + <jar destfile="${swing.jar.name}" + basedir="${swing.build.dir}" /> + </target> + + <target name="common-dist" + depends="engine-dist,common-compile"> + <jar destfile="${common.jar.name}" + basedir="${common.build.dir}" + excludes="picross/specific/**" /> + </target> + <target name="dist" - depends="compile"> - <copy todir="${build.dir}/picross/properties" + depends="engine-dist,common-dist,game-compile"> + <copy todir="${game.build.dir}/picross/properties" failonerror="false"> - <fileset dir="${src.dir}/picross/properties" /> + <fileset dir="${game.src.dir}/picross/properties" /> </copy> - <copy todir="${build.dir}/picross/images"> + <copy todir="${game.build.dir}/picross/images"> <fileset dir="images" /> </copy> - <copy todir="${build.dir}/picross/data"> + <copy todir="${game.build.dir}/picross/data"> <fileset dir="data" /> </copy> - <copy todir="${build.dir}/META-INF/services"> + <copy todir="${game.build.dir}/picross/properties"> + <fileset dir="properties" /> + </copy> + + <copy todir="${game.build.dir}/META-INF/services"> <fileset dir="services" /> </copy> - <jar destfile="${jar.name}" - basedir="${build.dir}" /> + <jar destfile="${game.jar.name}" + basedir="${game.build.dir}" /> </target> <target name="run" @@ -128,7 +255,10 @@ fork="true" dir="."> <classpath> - <pathelement location="${jar.name}" /> + <pathelement location="${swing.jar.name}" /> + <pathelement location="${common.jar.name}" /> + <pathelement location="${engine.jar.name}" /> + <pathelement location="${game.jar.name}" /> <pathelement location="${bundleHelper.jar}" /> <pathelement location="${log4j.jar}" /> <pathelement location="${mmvcs.jar}" /> @@ -144,18 +274,24 @@ fork="true" dir="."> <classpath> - <pathelement location="${jar.name}" /> + <pathelement location="${swing.jar.name}" /> + <pathelement location="${common.jar.name}" /> + <pathelement location="${engine.jar.name}" /> + <pathelement location="${game.jar.name}" /> <pathelement location="${bundleHelper.jar}" /> <pathelement location="${log4j.jar}" /> <pathelement location="${mmvcs.jar}" /> <pathelement location="${debug.jar}" /> - <pathelement location="${simpleButton.jar}" /> + <pathelement location="${simpleButton.jar}" /> </classpath> </java> </target> <target name="test" - depends="dist,compile-test"> + depends="engine-test,common-test,swing-test" /> + + <target name="engine-test" + depends="dist,engine-compile-test"> <junit filtertrace="off" showoutput="on" printsummary="withOutAndErr"> @@ -164,7 +300,7 @@ <batchtest fork="yes" filtertrace="on"> - <fileset dir="${test.dir}"> + <fileset dir="${engine.test.dir}"> <include name="**/*Test.java" /> <exclude name="**/Abstract*Test.java" /> </fileset> @@ -174,26 +310,93 @@ </junit> </target> + <target name="common-test" + depends="dist,common-compile-test"> + <junit filtertrace="off" + showoutput="on" + printsummary="withOutAndErr"> + <formatter type="plain" + usefile="false" /> + + <batchtest fork="yes" + filtertrace="on"> + <fileset dir="${common.test.dir}"> + <include name="**/*Test.java" /> + <exclude name="**/Abstract*Test.java" /> + </fileset> + </batchtest> + + <classpath refid="classpath" /> + </junit> + </target> + + <target name="swing-test" + depends="dist,swing-compile-test"> + <junit filtertrace="off" + showoutput="on" + printsummary="withOutAndErr"> + <formatter type="plain" + usefile="false" /> + + <batchtest fork="yes" + filtertrace="on"> + <fileset dir="${swing.test.dir}"> + <include name="**/*Test.java" /> + <exclude name="**/Abstract*Test.java" /> + </fileset> + </batchtest> + + <classpath refid="classpath" /> + </junit> + </target> + <target name="clean"> - <delete dir="${build.dir}" /> + <delete dir="${swing.build.dir}" /> + <delete dir="${common.build.dir}" /> + <delete dir="${engine.build.dir}" /> + <delete dir="${game.build.dir}" /> <delete dir="${dist.dir}" /> <delete dir="${doc.dir}" /> + <delete dir="${android.dir}/src/picross/data" /> + <delete dir="${android.dir}/src/picross/properties" /> <delete> + <fileset dir="${android.dir}/res/drawable/" + defaultexcludes="no" + includes="*.png" /> + </delete> + + <delete> + <fileset dir="${android.dir}/libs/" + defaultexcludes="no" + includes="*.png" /> + </delete> + + <delete> + <fileset dir="${android.dir}/extraData/gameModes/" + defaultexcludes="no" + includes="*" /> + </delete> + + <delete> <fileset dir="." defaultexcludes="no" includes="**/*~" /> </delete> + + <ant antfile="build.xml" + dir="${android.dir}" + target="clean" /> </target> <target name="rebuild" depends="clean, dist" /> <target name="doc" - depends="compile"> + depends="game-compile"> <javadoc destdir="${doc.dir}" - link="http://download.oracle.com/javase/6/docs/api/"> - <packageset dir="${src.dir}" + link="http://download.oracle.com/javase/6/docs/api/"> + <packageset dir="${game.src.dir}" defaultexcludes="yes" /> <classpath refid="classpath" /> @@ -220,7 +423,7 @@ <formatter type="xml" tofile="checkstyle.xml" /> - <fileset dir="${src.dir}" + <fileset dir="${game.src.dir}" includes="**/*.java" /> </checkstyle> @@ -261,11 +464,52 @@ projectName="${ant.project.name}" output="html" outputFile="findbugs.html"> - <class location="${build.dir}" /> + <class location="${game.build.dir}" /> <auxclasspath refid="classpath" /> - <sourcePath path="${src.dir}" /> + <sourcePath path="${game.src.dir}" /> </findbugs> </target> -</project> \ No newline at end of file + + <!-- Android stuff --> + + <property name="android.dir" + value="android" /> + + <target name="android-dist" + depends="common-dist"> + <copy todir="${android.dir}/extraData/gameModes/META-INF/services"> + <fileset dir="services" /> + </copy> + + <copy todir="${android.dir}/src/picross/properties"> + <fileset dir="properties" /> + </copy> + + <copy todir="${android.dir}/libs" + file="${common.jar.name}" /> + <copy todir="${android.dir}/libs" + file="${engine.jar.name}" /> + <copy todir="${android.dir}/libs" + file="${bundleHelper.jar}" /> + <copy todir="${android.dir}/libs" + file="${mmvcs.jar}" /> + + <copy todir="${android.dir}/res/drawable"> + <fileset dir="images" + includes="*.png" + excludes="*rollover*.png" /> + <fileset dir="images/en/" + includes="*.png" /> + </copy> + + <copy todir="${android.dir}/src/picross/data"> + <fileset dir="data" /> + </copy> + + <ant antfile="build.xml" + dir="${android.dir}" + target="debug" /> + </target> +</project> Deleted: trunk/images/empty-button.png =================================================================== (Binary files differ) Copied: trunk/images/empty_button.png (from rev 130, branches/engine_split/images/empty_button.png) =================================================================== (Binary files differ) Deleted: trunk/images/en/button-back.png =================================================================== (Binary files differ) Deleted: trunk/images/en/button-exit.png =================================================================== (Binary files differ) Deleted: trunk/images/en/button-play.png =================================================================== (Binary files differ) Deleted: trunk/images/en/button-random.png =================================================================== (Binary files differ) Deleted: trunk/images/en/button-select.png =================================================================== (Binary files differ) Copied: trunk/images/en/button_back.png (from rev 130, branches/engine_split/images/en/button_back.png) =================================================================== (Binary files differ) Copied: trunk/images/en/button_exit.png (from rev 130, branches/engine_split/images/en/button_exit.png) =================================================================== (Binary files differ) Copied: trunk/images/en/button_play.png (from rev 130, branches/engine_split/images/en/button_play.png) =================================================================== (Binary files differ) Copied: trunk/images/en/button_random.png (from rev 130, branches/engine_split/images/en/button_random.png) =================================================================== (Binary files differ) Copied: trunk/images/en/button_select.png (from rev 130, branches/engine_split/images/en/button_select.png) =================================================================== (Binary files differ) Deleted: trunk/images/en/label-wait.png =================================================================== (Binary files differ) Copied: trunk/images/en/label_wait.png (from rev 130, branches/engine_split/images/en/label_wait.png) =================================================================== (Binary files differ) Deleted: trunk/images/fr/button-back.png =================================================================== (Binary files differ) Deleted: trunk/images/fr/button-exit.png =================================================================== (Binary files differ) Deleted: trunk/images/fr/button-play.png =================================================================== (Binary files differ) Deleted: trunk/images/fr/button-random.png =================================================================== (Binary files differ) Deleted: trunk/images/fr/button-select.png =================================================================== (Binary files differ) Copied: trunk/images/fr/button_back.png (from rev 130, branches/engine_split/images/fr/button_back.png) =================================================================== (Binary files differ) Copied: trunk/images/fr/button_exit.png (from rev 130, branches/engine_split/images/fr/button_exit.png) =================================================================== (Binary files differ) Copied: trunk/images/fr/button_play.png (from rev 130, branches/engine_split/images/fr/button_play.png) =================================================================== (Binary files differ) Copied: trunk/images/fr/button_random.png (from rev 130, branches/engine_split/images/fr/button_random.png) =================================================================== (Binary files differ) Copied: trunk/images/fr/button_select.png (from rev 130, branches/engine_split/images/fr/button_select.png) =================================================================== (Binary files differ) Deleted: trunk/images/fr/label-wait.png =================================================================== (Binary files differ) Copied: trunk/images/fr/label_wait.png (from rev 130, branches/engine_split/images/fr/label_wait.png) =================================================================== (Binary files differ) Modified: trunk/log4j.properties =================================================================== --- trunk/log4j.properties 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/log4j.properties 2013-01-23 08:21:27 UTC (rev 131) @@ -1,4 +1,4 @@ log4j.rootCategory=debug, stdout, log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L) - %m%n +log4j.appender.stdout.layout.ConversionPattern=%5p - %m%n Copied: trunk/services/picross.engine.game.GameMode (from rev 130, branches/engine_split/services/picross.engine.game.GameMode) =================================================================== --- trunk/services/picross.engine.game.GameMode (rev 0) +++ trunk/services/picross.engine.game.GameMode 2013-01-23 08:21:27 UTC (rev 131) @@ -0,0 +1,2 @@ +picross.specific.game.random.ui.RandomGameModeUI +picross.specific.game.simple.ui.SimpleGameModeUI Deleted: trunk/services/picross.game.GameMode =================================================================== --- trunk/services/picross.game.GameMode 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/services/picross.game.GameMode 2013-01-23 08:21:27 UTC (rev 131) @@ -1,2 +0,0 @@ -picross.game.random.ui.RandomGameModeUI -picross.game.simple.ui.SimpleGameModeUI Deleted: trunk/src/picross/Picross.java =================================================================== --- trunk/src/picross/Picross.java 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/src/picross/Picross.java 2013-01-23 08:21:27 UTC (rev 131) @@ -1,104 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2007-2008 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package picross; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -import java.net.URL; - -import java.util.Locale; - -//import org.apache.log4j.Logger; - -/** - * Helper class. - * - * @author Y. Norsa - */ -public final class Picross { - /*** Constant ***/ - - /** Data directory. */ - private static final String DATA_DIR = "/picross/data/"; - - /*** Static field ***/ - - /** The class' logger. */ - //private static Logger log = Logger.getLogger(Picross.class); - - /*** Constructor ***/ - - /** Fake constructor. */ - private Picross() { } - - /*** Static methods ***/ - - /** - * Loads a file. - * - * @param path file path - * @return URL of the file - * @throws FileNotFoundException if the file can't be found - */ - public static URL getFile(String path) throws FileNotFoundException { - URL fileUrl = Picross.class.getResource(path); - - if (fileUrl == null) { - throw new FileNotFoundException("\"" + path + "\" can't be found"); - } - - return fileUrl; - } - - /** - * Loads a data file. - * - * @param name filename - * @return a stream containing the loaded file - * @throws IllegalArgumentException if <code>name</code> - * is <code>null</code> or empty - * @throws IOException if there is a problem while opening the file - */ - public static InputStream loadDataFile(String name) throws IOException { - - if (name == null || name.equals("")) { - throw new IllegalArgumentException("name can't be null or empty"); - } - - return Picross.getFile(Picross.DATA_DIR + name).openStream(); - } -} - Deleted: trunk/src/picross/PicrossException.java =================================================================== --- trunk/src/picross/PicrossException.java 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/src/picross/PicrossException.java 2013-01-23 08:21:27 UTC (rev 131) @@ -1,67 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2007 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package picross; - -/** - * General exception. - * - * @author Y. Norsa - */ -public class PicrossException extends Exception { - /*** Constant ***/ - - /** Serialisation ID. */ - private static final long serialVersionUID = 1716838910721477345L; - - /*** Constructors ***/ - - /** - * Constructor. - * - * @param cause parent exception - */ - public PicrossException(Throwable cause) { - super(cause); - } - - /** - * Constructor. - * - * @param msg message describing the exception - */ - public PicrossException(String msg) { - super(msg); - } -} - Deleted: trunk/src/picross/app/MainMenuAppUI.java =================================================================== --- trunk/src/picross/app/MainMenuAppUI.java 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/src/picross/app/MainMenuAppUI.java 2013-01-23 08:21:27 UTC (rev 131) @@ -1,94 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2007-2008 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package picross.app; - -import java.awt.event.ActionListener; - -import picross.ui.MainMenuUI; -import picross.ui.PicrossController; - -/** - * Main menu for the application version. - * - * @author Y. Norsa - */ -public final class MainMenuAppUI extends MainMenuUI { - /*** Constants ***/ - - /** Serialisation ID. */ - private static final long serialVersionUID = 8153436550520127667L; - - /** "Play" button X coordinate. */ - private static final int PLAY_BUTTON_X = 50; - - /** "Play" button Y coordinate. */ - private static final int PLAY_BUTTON_Y = 225; - - /** Image for the "exit" button. */ - private static final String EXIT_BUTTON_IMAGE = "button-exit.png"; - - /** "Exit" button X coordinate. */ - private static final int EXIT_BUTTON_X = 250; - - /** "Exit" button Y coordinate. */ - private static final int EXIT_BUTTON_Y = 225; - - /*** Methods overloaded from the class MainMenuUI ***/ - - /** {@inheritDoc} */ - @Override - protected void init(ActionListener controller) { - super.init(controller); - - this.addButton(MainMenuAppUI.EXIT_BUTTON_IMAGE, - PicrossController.EXIT_CMD, - controller, - MainMenuAppUI.EXIT_BUTTON_X, - MainMenuAppUI.EXIT_BUTTON_Y); - } - - /** {@inheritDoc} */ - @Override - protected int getPlayButtonX() { - return MainMenuAppUI.PLAY_BUTTON_X; - } - - /** {@inheritDoc} */ - @Override - protected int getPlayButtonY() { - return MainMenuAppUI.PLAY_BUTTON_Y; - } -} - - Copied: trunk/src/picross/app/MainMenuAppUI.java (from rev 130, branches/engine_split/src/picross/app/MainMenuAppUI.java) =================================================================== --- trunk/src/picross/app/MainMenuAppUI.java (rev 0) +++ trunk/src/picross/app/MainMenuAppUI.java 2013-01-23 08:21:27 UTC (rev 131) @@ -0,0 +1,96 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.app; + +import java.awt.event.ActionListener; + +import picross.common.ui.MainMenuUI; +import picross.common.ui.PicrossController; + +import picross.specific.ui.MenuController; + +/** + * Main menu for the application version. + * + * @author Y. Norsa + */ +public final class MainMenuAppUI extends MainMenuUI { + /*** Constants ***/ + + /** Serialisation ID. */ + private static final long serialVersionUID = 8153436550520127667L; + + /** "Play" button X coordinate. */ + private static final int PLAY_BUTTON_X = 50; + + /** "Play" button Y coordinate. */ + private static final int PLAY_BUTTON_Y = 225; + + /** Image for the "exit" button. */ + private static final String EXIT_BUTTON_IMAGE = "button_exit.png"; + + /** "Exit" button X coordinate. */ + private static final int EXIT_BUTTON_X = 250; + + /** "Exit" button Y coordinate. */ + private static final int EXIT_BUTTON_Y = 225; + + /*** Methods overloaded from the class MainMenuUI ***/ + + /** {@inheritDoc} */ + @Override + public void init(/*ActionListener*/MenuController controller) { + super.init(controller); + + this.addButton(MainMenuAppUI.EXIT_BUTTON_IMAGE, + PicrossController.EXIT_CMD, + controller, + MainMenuAppUI.EXIT_BUTTON_X, + MainMenuAppUI.EXIT_BUTTON_Y); + } + + /** {@inheritDoc} */ + @Override + protected int getPlayButtonX() { + return MainMenuAppUI.PLAY_BUTTON_X; + } + + /** {@inheritDoc} */ + @Override + protected int getPlayButtonY() { + return MainMenuAppUI.PLAY_BUTTON_Y; + } +} + + Modified: trunk/src/picross/app/PicrossApp.java =================================================================== --- trunk/src/picross/app/PicrossApp.java 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/src/picross/app/PicrossApp.java 2013-01-23 08:21:27 UTC (rev 131) @@ -37,7 +37,7 @@ import org.apache.log4j.PropertyConfigurator; -import picross.ui.PicrossMediator; +import picross.specific.ui.PicrossMediator; /** * Main class of the application version. Modified: trunk/src/picross/app/PicrossAppUI.java =================================================================== --- trunk/src/picross/app/PicrossAppUI.java 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/src/picross/app/PicrossAppUI.java 2013-01-23 08:21:27 UTC (rev 131) @@ -38,8 +38,8 @@ import javax.swing.JFrame; import javax.swing.JOptionPane; -import picross.ui.PicrossUI; -import picross.ui.PicrossView; +import picross.common.ui.PicrossUI; +import picross.common.ui.PicrossView; /** * Main window of the application version. Modified: trunk/src/picross/applet/MainMenuAppletUI.java =================================================================== --- trunk/src/picross/applet/MainMenuAppletUI.java 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/src/picross/applet/MainMenuAppletUI.java 2013-01-23 08:21:27 UTC (rev 131) @@ -37,8 +37,10 @@ import java.awt.event.ActionListener; -import picross.ui.MainMenuUI; +import picross.common.ui.MainMenuUI; +import picross.specific.ui.MenuController; + /** * Main menu for the applet version. * @@ -60,7 +62,7 @@ /** {@inheritDoc} */ @Override - protected void init(ActionListener controller) { + public void init(/*ActionListener*/MenuController controller) { super.init(controller); this.setBackground(Color.WHITE); Modified: trunk/src/picross/applet/PicrossApplet.java =================================================================== --- trunk/src/picross/applet/PicrossApplet.java 2013-01-18 07:47:31 UTC (rev 130) +++ trunk/src/picross/applet/PicrossApplet.java 2013-01-23 08:21:27 UTC (rev 131) @@ -39,9 +39,9 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; -import picross.ui.PicrossMediator; -import picross.ui.PicrossUI; -import picross.ui.PicrossView; +import picross.specific.ui.PicrossMediator; +import picross.common.ui.PicrossUI; +import picross.common.ui.PicrossView; /** * Main class of the applet version. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-18 07:47:34
|
Revision: 130 http://sourceforge.net/p/picross/code/130 Author: yvan_norsa Date: 2013-01-18 07:47:31 +0000 (Fri, 18 Jan 2013) Log Message: ----------- cleaning Modified Paths: -------------- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java branches/engine_split/build.xml Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-18 07:36:06 UTC (rev 129) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-18 07:47:31 UTC (rev 130) @@ -33,8 +33,6 @@ package picross.specific.game.random.ui; -import fr.cle.core.gui.SimpleButton; - import fr.cle.mmvcs.SimpleEvent; import picross.engine.game.random.RandomGameMode; Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-18 07:36:06 UTC (rev 129) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-18 07:47:31 UTC (rev 130) @@ -33,8 +33,6 @@ package picross.specific.game.simple.ui; -import fr.cle.core.gui.SimpleButton; - import fr.cle.mmvcs.SimpleEvent; import picross.engine.game.GameMode; Modified: branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-18 07:36:06 UTC (rev 129) +++ branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-18 07:47:31 UTC (rev 130) @@ -33,10 +33,6 @@ package picross.specific.game.ui; -import fr.cle.core.gui.SimpleButton; - -//import javax.swing.JButton; - import picross.engine.game.GameMode; import picross.specific.ui.PicrossButton; @@ -54,7 +50,6 @@ * * @return a button that can be added to a menu */ - //SimpleButton<JButton> getButton(); PicrossButton getButton(Context context); } Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-18 07:36:06 UTC (rev 129) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-18 07:47:31 UTC (rev 130) @@ -33,8 +33,6 @@ package picross.specific.ui; -import fr.cle.core.gui.SimpleButton; - import fr.cle.mmvcs.SimpleEvent; import fr.cle.mmvcs.SimpleListener; Modified: branches/engine_split/build.xml =================================================================== --- branches/engine_split/build.xml 2013-01-18 07:36:06 UTC (rev 129) +++ branches/engine_split/build.xml 2013-01-18 07:47:31 UTC (rev 130) @@ -357,8 +357,28 @@ <delete dir="${game.build.dir}" /> <delete dir="${dist.dir}" /> <delete dir="${doc.dir}" /> + <delete dir="${android.dir}/src/picross/data" /> + <delete dir="${android.dir}/src/picross/properties" /> <delete> + <fileset dir="${android.dir}/res/drawable/" + defaultexcludes="no" + includes="*.png" /> + </delete> + + <delete> + <fileset dir="${android.dir}/libs/" + defaultexcludes="no" + includes="*.png" /> + </delete> + + <delete> + <fileset dir="${android.dir}/extraData/gameModes/" + defaultexcludes="no" + includes="*" /> + </delete> + + <delete> <fileset dir="." defaultexcludes="no" includes="**/*~" /> @@ -475,8 +495,6 @@ file="${bundleHelper.jar}" /> <copy todir="${android.dir}/libs" file="${mmvcs.jar}" /> - <copy todir="${android.dir}/libs" - file="${simpleButton.jar}" /> <copy todir="${android.dir}/res/drawable"> <fileset dir="images" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-18 07:36:09
|
Revision: 129 http://sourceforge.net/p/picross/code/129 Author: yvan_norsa Date: 2013-01-18 07:36:06 +0000 (Fri, 18 Jan 2013) Log Message: ----------- used lint Modified Paths: -------------- branches/engine_split/android/AndroidManifest.xml branches/engine_split/android/src/picross/specific/ui/MenuUI.java Removed Paths: ------------- branches/engine_split/android/res/layout/ Modified: branches/engine_split/android/AndroidManifest.xml =================================================================== --- branches/engine_split/android/AndroidManifest.xml 2013-01-17 15:13:54 UTC (rev 128) +++ branches/engine_split/android/AndroidManifest.xml 2013-01-18 07:36:06 UTC (rev 129) @@ -3,7 +3,12 @@ package="picross.specific.activities" android:versionCode="1" android:versionName="1.0"> - <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> + <uses-sdk + android:minSdkVersion="17" + android:targetSdkVersion="17" /> + + <application android:label="@string/app_name" android:icon="@drawable/ic_launcher" + android:allowBackup="false"> <activity android:name="PicrossMainActivity" android:label="@string/app_name"> <intent-filter> Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-17 15:13:54 UTC (rev 128) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-18 07:36:06 UTC (rev 129) @@ -101,6 +101,10 @@ private List<PicrossLabel> buttons; + private Paint buttonPaint; + private Rect textBounds; + + /*** Constructor ***/ /** Constructor. */ @@ -122,6 +126,12 @@ //this.surface.addCallback(this); this.buttons = new ArrayList<PicrossLabel>(); + + this.buttonPaint = new Paint(); + this.buttonPaint.setColor(Color.WHITE); + this.buttonPaint.setTextSize(20); + + this.textBounds = new Rect(); } @Override @@ -132,10 +142,6 @@ return; } - Paint paint = new Paint(); - paint.setColor(Color.WHITE); - paint.setTextSize(20); - canvas.drawBitmap(this.image, 0, 0, null); //for (PicrossLabel button : this.buttons) { @@ -145,13 +151,12 @@ canvas.drawBitmap(button.getIcon(), button.getX(), button.getY(), null); if (button instanceof PicrossButton && ((PicrossButton) button).getText() != null) { - Rect textBounds = new Rect(); - paint.getTextBounds(((PicrossButton) button).getText(), 0, ((PicrossButton) button).getText().length(), textBounds); - int textWidth = (int) textBounds.width(); - int textHeight = (int) textBounds.height(); + this.buttonPaint.getTextBounds(((PicrossButton) button).getText(), 0, ((PicrossButton) button).getText().length(), this.textBounds); + int textWidth = (int) this.textBounds.width(); + int textHeight = (int) this.textBounds.height(); canvas.drawText(((PicrossButton) button).getText(), button.getX() + (button.getWidth() / 2) - (textWidth / 2), button.getY() - + (button.getHeight() / 2) + (textHeight / 2), paint); + + (button.getHeight() / 2) + (textHeight / 2), this.buttonPaint); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-17 15:13:59
|
Revision: 128 http://sourceforge.net/p/picross/code/128 Author: yvan_norsa Date: 2013-01-17 15:13:54 +0000 (Thu, 17 Jan 2013) Log Message: ----------- added basic scrolling Modified Paths: -------------- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java branches/engine_split/android/src/picross/specific/game/ui/GameUI.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java Modified: branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-17 09:03:17 UTC (rev 127) +++ branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-17 15:13:54 UTC (rev 128) @@ -43,6 +43,11 @@ import picross.common.ui.PicrossUI; import picross.common.ui.PicrossView; +import android.widget.ScrollView; +import android.view.ViewGroup; +import android.widget.HorizontalScrollView; +import android.widget.LinearLayout; + /** * Main window of the application version. * @@ -69,7 +74,20 @@ @Override public void setContent(PicrossView content) { PicrossActivityUI.log.debug("setContent(" + content + ")"); - this.activity.setContentView((picross.specific.ui.AbstractAndroidView) content); + + //this.activity.setContentView((picross.specific.ui.AbstractAndroidView) content); + + ScrollView sv = new ScrollView(this.activity); + sv.addView((picross.specific.ui.AbstractAndroidView) content, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT ) ); + + HorizontalScrollView hv = new HorizontalScrollView(this.activity); + hv.addView(sv, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT ) ); + + +LinearLayout linearLayout = new LinearLayout(this.activity); +linearLayout.addView(hv, new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT ) ); + +this.activity.setContentView(linearLayout); } /** {@inheritDoc} */ Modified: branches/engine_split/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-17 09:03:17 UTC (rev 127) +++ branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-17 15:13:54 UTC (rev 128) @@ -187,4 +187,10 @@ this.controller.onPicrossEvent(new PicrossEvent(item.getItemId())); return true; } + + + @Override + protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) { + this.setMeasuredDimension(this.grid.getWidth(), this.grid.getHeight()); + } } Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-17 09:03:17 UTC (rev 127) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-17 15:13:54 UTC (rev 128) @@ -411,6 +411,17 @@ */ } + public int getWidth() { +return this.rightBoundary + + GridUI.RIGHT_SPACE; + } + + public int getHeight() { + return this.bottomBoundary + + GridUI.BOTTOM_SPACE; + + } + /** Precomputes the blocks lines. */ private void initBlocks() { this.blocksLines = new ArrayList<Line2D>(); Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-17 09:03:17 UTC (rev 127) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-17 15:13:54 UTC (rev 128) @@ -405,4 +405,9 @@ PicrossLabel label = new PicrossLabel(icon, x, y, icon.getWidth(), icon.getHeight()); this.add(label); } + + @Override + protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) { + this.setMeasuredDimension(MenuUI.DEFAULT_WIDTH, MenuUI.DEFAULT_HEIGHT); + } } Modified: branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-17 09:03:17 UTC (rev 127) +++ branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-17 15:13:54 UTC (rev 128) @@ -109,7 +109,9 @@ //new Thread() { // public void run() { - PicrossMediator.this.view.setContent(game.getView()); + + + PicrossMediator.this.view.setContent(game.getView()); // } //}.start(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-17 09:03:23
|
Revision: 127 http://sourceforge.net/p/picross/code/127 Author: yvan_norsa Date: 2013-01-17 09:03:17 +0000 (Thu, 17 Jan 2013) Log Message: ----------- better menus Modified Paths: -------------- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java branches/engine_split/android/src/picross/specific/game/ui/GameController.java branches/engine_split/android/src/picross/specific/game/ui/GameUI.java branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-16 13:19:28 UTC (rev 126) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-17 09:03:17 UTC (rev 127) @@ -37,6 +37,9 @@ import picross.specific.ui.PicrossEvent; +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + /** * Controller for the random game UI. * @@ -52,6 +55,8 @@ /** Random game command. */ static final String RANDOM_GAME_CMD = "RANDOM_GAME_CMD"; + private static PicrossLogger log = PicrossLogHelper.getLogger(RandomGameController.class); + /*** Method overloaded from the class Controller ***/ /** {@inheritDoc} */ @@ -73,6 +78,8 @@ @Override public void onPicrossEvent(PicrossEvent e) { + RandomGameController.log.debug("onPicrossEvent(" + e + ")"); + int itemId = e.getItemId(); if (itemId == RandomGameController.NEXT_CMD_ID) { Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-16 13:19:28 UTC (rev 126) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-17 09:03:17 UTC (rev 127) @@ -84,10 +84,6 @@ public void populateOptionsMenu(Menu menu) { super.populateOptionsMenu(menu); - if (menu.findItem(RandomGameController.NEXT_CMD_ID) != null) { - return; - } - menu.add(Menu.NONE, RandomGameController.NEXT_CMD_ID, Menu.NONE, BundleHelper.getString(this, "anotherGrid")); } } Modified: branches/engine_split/android/src/picross/specific/game/ui/GameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameController.java 2013-01-16 13:19:28 UTC (rev 126) +++ branches/engine_split/android/src/picross/specific/game/ui/GameController.java 2013-01-17 09:03:17 UTC (rev 127) @@ -42,6 +42,7 @@ import picross.common.ui.PicrossController; import picross.specific.ui.MenuController; +import picross.specific.ui.PicrossEvent; /** * Controller for the game. @@ -54,6 +55,8 @@ /** The class' logger. */ private static PicrossLogger log = PicrossLogHelper.getLogger(GameController.class); + public static final int QUIT_CMD_ID = PicrossController.QUIT_CMD.hashCode(); + /*** Method overloaded from the class Controller ***/ /** {@inheritDoc} */ @@ -77,5 +80,19 @@ } } */ + + @Override + public void onPicrossEvent(PicrossEvent e) { + GameController.log.debug("onPicrossEvent(" + e + ")"); + + int itemId = e.getItemId(); + + if (itemId == GameController.QUIT_CMD_ID) { + this.fireEventPerformed(PicrossController.QUIT_CMD); + return; + } + + super.onPicrossEvent(e); + } } Modified: branches/engine_split/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-16 13:19:28 UTC (rev 126) +++ branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-17 09:03:17 UTC (rev 127) @@ -178,7 +178,9 @@ } public void populateOptionsMenu(Menu menu) { - GameUI.log.debug("TODO options menu"); + menu.clear(); + + menu.add(Menu.NONE, GameController.QUIT_CMD_ID, Menu.NONE, BundleHelper.getString(this, "menuButton")); } public boolean onOptionsItemSelected(MenuItem item) { Modified: branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java 2013-01-16 13:19:28 UTC (rev 126) +++ branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java 2013-01-17 09:03:17 UTC (rev 127) @@ -52,5 +52,10 @@ public int getItemId() { return this.itemId; } + + @Override + public String toString() { + return "[PicrossEvent: actionCommand=\"" + this.actionCommand + "\", itemId=\"" + this.itemId + "\"]"; + } } Modified: branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-16 13:19:28 UTC (rev 126) +++ branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-17 09:03:17 UTC (rev 127) @@ -118,6 +118,12 @@ private GameUI gameView; + @Override + protected void quitGame() { + this.gameView = null; + super.quitGame(); + } + /** * Method launching a game. * @@ -143,6 +149,7 @@ public boolean populateOptionsMenu(Menu menu) { if (this.gameView == null) { + menu.clear(); return false; } Modified: branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-16 13:19:28 UTC (rev 126) +++ branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-17 09:03:17 UTC (rev 127) @@ -153,11 +153,15 @@ } if (cmd.equals(PicrossController.QUIT_CMD)) { - this.displayGameMenu(); + this.quitGame(); return; } } + protected void quitGame() { + this.displayGameMenu(); + } + /*** Methods ***/ /** Exits the application. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-16 13:19:32
|
Revision: 126 http://sourceforge.net/p/picross/code/126 Author: yvan_norsa Date: 2013-01-16 13:19:28 +0000 (Wed, 16 Jan 2013) Log Message: ----------- input handling Modified Paths: -------------- branches/engine_split/android/src/picross/specific/grid/ui/GridController.java branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridController.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-16 11:56:03 UTC (rev 125) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-16 13:19:28 UTC (rev 126) @@ -47,15 +47,23 @@ import android.view.View; import android.view.MotionEvent; +import android.view.GestureDetector; +import android.content.Context; + +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + /** * Grid controller. * * @author Y. Norsa */ public final class GridController extends Controller -implements View.OnTouchListener { + implements View.OnTouchListener { + private static PicrossLogger log = PicrossLogHelper.getLogger(GridController.class); + /*** Fields ***/ /** The view to which the controller is attached. */ @@ -64,6 +72,13 @@ /** Indicates wether the erase mode is "on" or not. */ private boolean eraseMode; + private GestureDetector gestureDetector; + + public GridController(Context context) { + this.gestureDetector = new GestureDetector(context, new GridGestureListener()); + } + + /*** Method overloaded from the class Controller ***/ /** {@inheritDoc} */ @@ -106,6 +121,8 @@ @Override public boolean onTouch(View view, MotionEvent event) { + return this.gestureDetector.onTouchEvent(event); + /* if (event.getAction() != MotionEvent.ACTION_DOWN) { return false; } @@ -116,6 +133,7 @@ // FIXME return true; + */ } @@ -137,17 +155,7 @@ * @param e mouse event to handle */ - private void checkAndFill(MotionEvent e) { - // FIXME - /* - int modifiers = e.getModifiers(); - - if (modifiers != MouseEvent.BUTTON1_MASK - && modifiers != MouseEvent.BUTTON3_MASK) { - - return; - } - */ + private void checkAndFill(MotionEvent e, boolean doubleTap) { Point point = new Point(e.getX(), e.getY()); if (this.view.isInGrid(point)) { @@ -159,9 +167,11 @@ if (this.eraseMode) { type = GridAction.EMPTY; } else { - // FIXME - //type = GridController.modifiersToType(modifiers); - type = GridAction.CHECK; + if (!doubleTap) { + type = GridAction.CHECK; + } else { + type = GridAction.CROSS; + } } this.fireEventPerformed(GridCommands.FILL_CMD, @@ -169,27 +179,6 @@ } } - /** - * Converts a mouse click to an action. - * - * @param modifiers mouse event modifiers - * @return corresponding action, or -1 - */ - // FIXME - /* - private static GridAction modifiersToType(int modifiers) { - switch (modifiers) { - case MouseEvent.BUTTON1_MASK: - return GridAction.CHECK; - - case MouseEvent.BUTTON3_MASK: - return GridAction.CROSS; - - default: - return GridAction.UNKNOWN; - } - } - */ /*** Accessor ***/ /** @@ -200,5 +189,46 @@ public void setView(GridUI view) { this.view = view; } + + private class GridGestureListener extends GestureDetector.SimpleOnGestureListener { + @Override + public boolean onSingleTapConfirmed(MotionEvent event) { + GridController.log.debug("onSingleTapConfirmed()"); + + GridController.this.checkAndFill(event, false); + GridController.this.eraseMode = false; + GridController.this.fireEventPerformed(GridCommands.END_ACTION_CMD); + + return true; + } + + @Override + public boolean onDoubleTap(MotionEvent event) { + GridController.log.debug("onDoubleTap()"); + + GridController.this.checkAndFill(event, true); + GridController.this.eraseMode = false; + GridController.this.fireEventPerformed(GridCommands.END_ACTION_CMD); + + return true; + } + /* + @Override + public boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + GridController.log.debug("onScroll()"); + GridController.this.checkAndFill(e2, false); + return true; + } + + @Override + public boolean onDoubleTapEvent(MotionEvent e) { + GridController.log.debug("onDoubleTapEvent()"); + GridController.this.checkAndFill(e, true); + GridController.this.eraseMode = false; + GridController.this.fireEventPerformed(GridCommands.END_ACTION_CMD); + return true; + } + */ + } } Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-16 11:56:03 UTC (rev 125) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-16 13:19:28 UTC (rev 126) @@ -57,6 +57,11 @@ this.doInit(width, height); } +@Override + protected GridController initController() { + return new GridController(this.context); + } + @Override protected void initGrid(final int width, final int height, final UIBox[][] boxes, final int[][] colData, final int[][] rowData, final CompletedHints hints, final GridController controller) { //new Thread() { Modified: branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-16 11:56:03 UTC (rev 125) +++ branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-16 13:19:28 UTC (rev 126) @@ -105,7 +105,6 @@ @Override protected void gameLoaded(final GameMediator game) { - this.view.displayMessage("TODO gameLoaded()"); game.addSimpleListener(this); //new Thread() { Modified: branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-16 11:56:03 UTC (rev 125) +++ branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-16 13:19:28 UTC (rev 126) @@ -97,8 +97,12 @@ } } + protected GridController initController() { + return new GridController(); + } + protected void doInit(final int width, final int height) throws PicrossException { - final GridController controller = new GridController(); + final GridController controller = this.initController(); controller.addSimpleListener(this); this.addSimpleListener(controller); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-16 11:56:07
|
Revision: 125 http://sourceforge.net/p/picross/code/125 Author: yvan_norsa Date: 2013-01-16 11:56:03 +0000 (Wed, 16 Jan 2013) Log Message: ----------- alert dialog; options menu Modified Paths: -------------- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java branches/engine_split/android/src/picross/specific/game/ui/GameUI.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/ui/MenuController.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java Added Paths: ----------- branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java branches/engine_split/common/src/picross/common/game/ui/GameMediator.java Modified: branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-16 11:56:03 UTC (rev 125) @@ -74,16 +74,18 @@ /** {@inheritDoc} */ @Override - public void displayMessage(String msg) { + public void displayMessage(final String msg) { PicrossActivityUI.log.debug("displayMessage(" + msg + ")"); - // FIXME - /* - AlertDialog.Builder builder = new AlertDialog.Builder(this.activity); + this.activity.runOnUiThread(new Runnable() { + public void run() { + AlertDialog.Builder builder = new AlertDialog.Builder(PicrossActivityUI.this.activity); builder.setMessage(msg) .setTitle("Picross"); AlertDialog dialog = builder.create(); - */ + dialog.show(); + } + }); } /** {@inheritDoc} */ Modified: branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java 2013-01-16 11:56:03 UTC (rev 125) @@ -37,11 +37,16 @@ import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + import picross.specific.ui.PicrossMediator; import picross.specific.ui.PicrossAndroidLogger; import picross.engine.PicrossLogHelper; public class PicrossMainActivity extends Activity { + private PicrossMediator mediator; + static { PicrossLogHelper.setLoggerClass(PicrossAndroidLogger.class); } @@ -50,6 +55,16 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - new PicrossMediator(this, new PicrossActivityUI(this)); + this.mediator = new PicrossMediator(this, new PicrossActivityUI(this)); } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) { + return this.mediator.populateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + return this.mediator.onOptionsItemSelected(item); + } } Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-16 11:56:03 UTC (rev 125) @@ -35,6 +35,8 @@ import picross.specific.game.ui.GameController; +import picross.specific.ui.PicrossEvent; + /** * Controller for the random game UI. * @@ -45,6 +47,7 @@ /** Command asking to create another grid. */ static final String NEXT_CMD = "NEXT_CMD"; + static final int NEXT_CMD_ID = RandomGameController.NEXT_CMD.hashCode(); /** Random game command. */ static final String RANDOM_GAME_CMD = "RANDOM_GAME_CMD"; @@ -67,4 +70,16 @@ super.actionPerformed(e); } */ + + @Override + public void onPicrossEvent(PicrossEvent e) { + int itemId = e.getItemId(); + + if (itemId == RandomGameController.NEXT_CMD_ID) { + this.fireEventPerformed(RandomGameController.NEXT_CMD); + return; + } + + super.onPicrossEvent(e); + } } Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-16 11:56:03 UTC (rev 125) @@ -42,6 +42,7 @@ import picross.specific.ui.MenuController; import android.content.Context; +import android.view.Menu; /** * Custom UI for a random game. @@ -78,4 +79,15 @@ this.addButton(nextButton); */ } + + @Override + public void populateOptionsMenu(Menu menu) { + super.populateOptionsMenu(menu); + + if (menu.findItem(RandomGameController.NEXT_CMD_ID) != null) { + return; + } + + menu.add(Menu.NONE, RandomGameController.NEXT_CMD_ID, Menu.NONE, BundleHelper.getString(this, "anotherGrid")); + } } Modified: branches/engine_split/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-16 11:56:03 UTC (rev 125) @@ -55,7 +55,11 @@ import picross.specific.grid.ui.UIBox; import android.view.MotionEvent; +import android.view.Menu; +import android.view.MenuItem; +import picross.specific.ui.PicrossEvent; + /** * The game UI. * @@ -75,6 +79,9 @@ private GridUI grid; + private MenuController controller; + + /*** Constructor ***/ /** @@ -95,6 +102,8 @@ // HACK should not be here UIBox.staticInit(context.getResources()); + this.controller = listener; + // FIXME /* this.setLayout(new BorderLayout()); @@ -167,4 +176,13 @@ // FIXME //this.buttonsPanel.add(button); } + + public void populateOptionsMenu(Menu menu) { + GameUI.log.debug("TODO options menu"); + } + + public boolean onOptionsItemSelected(MenuItem item) { + this.controller.onPicrossEvent(new PicrossEvent(item.getItemId())); + return true; + } } Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-16 11:56:03 UTC (rev 125) @@ -264,6 +264,8 @@ Rect currentRect = this.boxes[i][j].getRect(); if (currentRect.intersect(clipRect)) { + + c.drawBitmap(this.boxes[i][j].getIcon(), currentRect.left, currentRect.top, null); Modified: branches/engine_split/android/src/picross/specific/ui/MenuController.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuController.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/ui/MenuController.java 2013-01-16 11:56:03 UTC (rev 125) @@ -62,7 +62,7 @@ return false; }*/ - public void onPicrossEvent(MenuUI.PicrossEvent e) { + public void onPicrossEvent(PicrossEvent e) { this.fireEventPerformed(e.getActionCommand()); } } Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 11:56:03 UTC (rev 125) @@ -405,16 +405,4 @@ PicrossLabel label = new PicrossLabel(icon, x, y, icon.getWidth(), icon.getHeight()); this.add(label); } - - public static class PicrossEvent { - private String actionCommand; - - private PicrossEvent(String command) { - this.actionCommand = command; - } - - public String getActionCommand() { - return this.actionCommand; - } - } } Added: branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java (rev 0) +++ branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java 2013-01-16 11:56:03 UTC (rev 125) @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * Copyright (c) 2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.ui; + +public final class PicrossEvent { + private String actionCommand; + private int itemId; + + public PicrossEvent(String command) { + this.actionCommand = command; + } + + public PicrossEvent(int id) { + this.itemId = id; + } + + public String getActionCommand() { + return this.actionCommand; + } + + public int getItemId() { + return this.itemId; + } +} + Property changes on: branches/engine_split/android/src/picross/specific/ui/PicrossEvent.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-16 10:16:31 UTC (rev 124) +++ branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-16 11:56:03 UTC (rev 125) @@ -49,6 +49,11 @@ import picross.engine.PicrossLogger; import picross.engine.PicrossLogHelper; +import android.view.Menu; +import android.view.MenuItem; + +import picross.specific.game.ui.GameUI; + public final class PicrossMediator extends AbstractPicrossMediator { private static PicrossLogger log = PicrossLogHelper.getLogger(PicrossMediator.class); @@ -108,8 +113,12 @@ PicrossMediator.this.view.setContent(game.getView()); // } //}.start(); + + this.gameView = (GameUI) game.getView(); } + private GameUI gameView; + /** * Method launching a game. * @@ -132,4 +141,21 @@ // worker.start(); } + + public boolean populateOptionsMenu(Menu menu) { + if (this.gameView == null) { + return false; + } + + this.gameView.populateOptionsMenu(menu); + return true; + } + + public boolean onOptionsItemSelected(MenuItem item) { + if (this.gameView == null) { + return false; + } + + return this.gameView.onOptionsItemSelected(item); + } } Added: branches/engine_split/common/src/picross/common/game/ui/GameMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/game/ui/GameMediator.java (rev 0) +++ branches/engine_split/common/src/picross/common/game/ui/GameMediator.java 2013-01-16 11:56:03 UTC (rev 125) @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.common.game.ui; + +import fr.cle.mmvcs.IMediateur; + +import picross.engine.PicrossException; +import picross.engine.grid.PicrossGrid; + +public interface GameMediator extends IMediateur { + PicrossGrid initModel() throws PicrossException; + void init() throws PicrossException; +} + Property changes on: branches/engine_split/common/src/picross/common/game/ui/GameMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-16 10:16:34
|
Revision: 124 http://sourceforge.net/p/picross/code/124 Author: yvan_norsa Date: 2013-01-16 10:16:31 +0000 (Wed, 16 Jan 2013) Log Message: ----------- UI stuff Modified Paths: -------------- branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 09:37:19 UTC (rev 123) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 10:16:31 UTC (rev 124) @@ -82,8 +82,7 @@ * @param sizes grid sizes */ public void displaySizes(MenuController listener, List<Dimensions> sizes) { - // FIXME - //this.removeAll(); + this.removeAllButtons(); int x = 150; int y = 150; @@ -108,6 +107,7 @@ // FIXME //this.repaint(); + this.invalidate(); } /** @@ -117,7 +117,6 @@ * @param levels levels to display */ public void displayLevels(MenuController listener, List<String> levels) { - // FIXME this.removeAllButtons(); // FIXME @@ -145,7 +144,8 @@ .getButton()); */ - this.add(this.createSimpleButton(level, event, listener));//, x, y);//); + //this.add(this.createSimpleButton(level, event, listener)); + this.addSimpleButton(level, event, listener, x, y); /* if (i != (nbLevels - 1)) { panel.add(Box.createRigidArea(new Dimension(0, 20))); @@ -172,6 +172,8 @@ this.revalidate(); this.repaint(); */ + + this.invalidate(); } /** Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 09:37:19 UTC (rev 123) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 10:16:31 UTC (rev 124) @@ -64,6 +64,7 @@ import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Rect; /** * Base class for menus. @@ -137,12 +138,20 @@ canvas.drawBitmap(this.image, 0, 0, null); - for (PicrossLabel button : this.buttons) { + //for (PicrossLabel button : this.buttons) { + for (int i = 0; i < this.buttons.size(); i++) { + PicrossLabel button = this.buttons.get(i); + canvas.drawBitmap(button.getIcon(), button.getX(), button.getY(), null); if (button instanceof PicrossButton && ((PicrossButton) button).getText() != null) { - canvas.drawText(((PicrossButton) button).getText(), button.getX() + (button.getWidth() / 2), button.getY() - + (button.getHeight() / 2), paint); + Rect textBounds = new Rect(); + paint.getTextBounds(((PicrossButton) button).getText(), 0, ((PicrossButton) button).getText().length(), textBounds); + int textWidth = (int) textBounds.width(); + int textHeight = (int) textBounds.height(); + + canvas.drawText(((PicrossButton) button).getText(), button.getX() + (button.getWidth() / 2) - (textWidth / 2), button.getY() + + (button.getHeight() / 2) + (textHeight / 2), paint); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-16 09:37:24
|
Revision: 123 http://sourceforge.net/p/picross/code/123 Author: yvan_norsa Date: 2013-01-16 09:37:19 +0000 (Wed, 16 Jan 2013) Log Message: ----------- better logging Modified Paths: -------------- branches/engine_split/android/src/picross/specific/activities/MainMenuActivityUI.java branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java branches/engine_split/android/src/picross/specific/game/ui/GameController.java branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java branches/engine_split/android/src/picross/specific/ui/GameMenuMediator.java branches/engine_split/android/src/picross/specific/ui/GameMenuUI.java branches/engine_split/android/src/picross/specific/ui/MainMenuMediator.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java branches/engine_split/android/src/picross/specific/ui/PicrossAndroidLogger.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuController.java branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java branches/engine_split/common/src/picross/common/ui/AbstractMenuController.java branches/engine_split/common/src/picross/common/ui/MenuMediator.java branches/engine_split/engine/src/picross/engine/AbstractPicrossLogger.java branches/engine_split/engine/src/picross/engine/PicrossLogHelper.java branches/engine_split/engine/src/picross/engine/game/random/RandomPicrossModel.java branches/engine_split/engine/src/picross/engine/game/simple/XBMModel.java branches/engine_split/engine/src/picross/engine/grid/GridModel.java branches/engine_split/log4j.properties branches/engine_split/swing/src/picross/specific/game/simple/ui/LevelMenuUI.java branches/engine_split/swing/src/picross/specific/game/ui/GameController.java branches/engine_split/swing/src/picross/specific/game/ui/GameMediator.java branches/engine_split/swing/src/picross/specific/ui/GameMenuUI.java branches/engine_split/swing/src/picross/specific/ui/MenuUI.java branches/engine_split/swing/src/picross/specific/ui/PicrossLog4jLogger.java branches/engine_split/swing/src/picross/specific/ui/PicrossMediator.java Modified: branches/engine_split/android/src/picross/specific/activities/MainMenuActivityUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/MainMenuActivityUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/activities/MainMenuActivityUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -33,6 +33,9 @@ package picross.specific.activities; +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + import picross.specific.ui.MainMenuUI; import android.content.Context; @@ -54,10 +57,12 @@ /** "Play" button Y coordinate. */ private static final int PLAY_BUTTON_Y = 225; + private static PicrossLogger log = PicrossLogHelper.getLogger(MainMenuActivityUI.class); + public MainMenuActivityUI(Context androidContext) { super(androidContext); - picross.engine.PicrossLogHelper.getLogger().debug("MainMenuActivityUI(" + androidContext + ")"); + MainMenuActivityUI.log.debug("MainMenuActivityUI(" + androidContext + ")"); } /** {@inheritDoc} */ Modified: branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -34,6 +34,7 @@ package picross.specific.activities; import picross.engine.PicrossLogHelper; +import picross.engine.PicrossLogger; import android.app.Activity; @@ -53,10 +54,12 @@ /** Main menu class. */ private static final String MAIN_MENU_CLASS = "picross.specific.activities.MainMenuActivityUI"; + private static PicrossLogger log = PicrossLogHelper.getLogger(PicrossActivityUI.class); + private Activity activity; PicrossActivityUI(Activity picrossActivity) { - PicrossLogHelper.getLogger().debug("PicrossActivityUI(" + picrossActivity + ")"); + PicrossActivityUI.log.debug("PicrossActivityUI(" + picrossActivity + ")"); this.activity = picrossActivity; } @@ -65,14 +68,14 @@ /** {@inheritDoc} */ @Override public void setContent(PicrossView content) { - PicrossLogHelper.getLogger().debug("setContent(" + content + ")"); + PicrossActivityUI.log.debug("setContent(" + content + ")"); this.activity.setContentView((picross.specific.ui.AbstractAndroidView) content); } /** {@inheritDoc} */ @Override public void displayMessage(String msg) { - PicrossLogHelper.getLogger().debug("displayMessage(" + msg + ")"); + PicrossActivityUI.log.debug("displayMessage(" + msg + ")"); // FIXME /* @@ -97,7 +100,7 @@ /** {@inheritDoc} */ @Override public void showUI() { - PicrossLogHelper.getLogger().debug("TODO showUI()"); + PicrossActivityUI.log.debug("TODO showUI()"); //this.setVisible(true); } Modified: branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/activities/PicrossMainActivity.java 2013-01-16 09:37:19 UTC (rev 123) @@ -42,13 +42,14 @@ import picross.engine.PicrossLogHelper; public class PicrossMainActivity extends Activity { + static { + PicrossLogHelper.setLoggerClass(PicrossAndroidLogger.class); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - PicrossLogHelper.setLogger(new PicrossAndroidLogger()); - PicrossLogHelper.getLogger().debug("TEST ##################"); - new PicrossMediator(this, new PicrossActivityUI(this)); } } Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -52,7 +52,6 @@ this.context = context; } - @Override protected GameCommand newSimpleGameCommand(String selectedLevel) { return new @@ -60,13 +59,12 @@ AndroidSimpleGameMediator(this.context, selectedLevel)); } - /** {@inheritDoc} */ @Override protected MenuUI initView(PicrossUI ui, MenuController controller) throws PicrossException { - LevelMenuMediator.log.debug("initView()"); + LevelMenuMediator.log.debug("initView(" + ui + ", " + controller + ")"); this.model = new LevelMenuModel(); Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -81,7 +81,7 @@ * @param listener listener for the buttons * @param sizes grid sizes */ - void displaySizes(MenuController listener, List<Dimensions> sizes) { + public void displaySizes(MenuController listener, List<Dimensions> sizes) { // FIXME //this.removeAll(); @@ -127,6 +127,11 @@ panel.setOpaque(false); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); */ + + int x = 150; + int y = 150; + + int nbLevels = levels.size(); for (int i = 0; i < nbLevels; i++) { @@ -140,11 +145,14 @@ .getButton()); */ - this.add(this.createSimpleButton(level, event, listener)); + this.add(this.createSimpleButton(level, event, listener));//, x, y);//); /* if (i != (nbLevels - 1)) { panel.add(Box.createRigidArea(new Dimension(0, 20))); }*/ + + + y += 75; } // FIXME /* Modified: branches/engine_split/android/src/picross/specific/game/ui/GameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameController.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/game/ui/GameController.java 2013-01-16 09:37:19 UTC (rev 123) @@ -52,7 +52,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GameController.class); /*** Method overloaded from the class Controller ***/ Modified: branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -56,7 +56,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GameMediator.class); /*** Fields ***/ Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -118,7 +118,7 @@ /** A block height. */ private static final int BLOCK_HEIGHT = 5; - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GridUI.class); /*** Fields ***/ Modified: branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java 2013-01-16 09:37:19 UTC (rev 123) @@ -18,7 +18,7 @@ import picross.engine.PicrossLogHelper; public abstract class AbstractAndroidView extends SurfaceView implements PicrossView, SurfaceHolder.Callback, Runnable { - protected static PicrossLogger log = PicrossLogHelper.getLogger(); + protected static PicrossLogger log = PicrossLogHelper.getLogger(AbstractAndroidView.class); private SurfaceHolder surface; private boolean running; Modified: branches/engine_split/android/src/picross/specific/ui/GameMenuMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/GameMenuMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/ui/GameMenuMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -35,6 +35,9 @@ import picross.engine.PicrossException; +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + import picross.common.ui.MenuMediator; import picross.common.ui.PicrossUI; import picross.common.ui.GameMenuModel; @@ -47,10 +50,12 @@ * @author Y. Norsa */ public final class GameMenuMediator extends MenuMediator { + private static PicrossLogger log = PicrossLogHelper.getLogger(GameMenuMediator.class); + private Context context; public GameMenuMediator(Context androidContext) { - picross.engine.PicrossLogHelper.getLogger().debug("GameMenuMediator(" + androidContext + ")"); + GameMenuMediator.log.debug("GameMenuMediator(" + androidContext + ")"); if (androidContext == null) { throw new IllegalArgumentException("\"androidContext\" cannot be null"); Modified: branches/engine_split/android/src/picross/specific/ui/GameMenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/GameMenuUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/ui/GameMenuUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -58,7 +58,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GameMenuUI.class); /*** Constructor ***/ Modified: branches/engine_split/android/src/picross/specific/ui/MainMenuMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MainMenuMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/ui/MainMenuMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -43,16 +43,21 @@ import android.content.Context; +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + /** * Mediator for the main menu. * * @author Y. Norsa */ public final class MainMenuMediator extends MenuMediator { + private static PicrossLogger log = PicrossLogHelper.getLogger(MainMenuMediator.class); + private Context context; public MainMenuMediator(Context androidContext) { - picross.engine.PicrossLogHelper.getLogger().debug("MainMenuMediator(" + androidContext + ")"); + MainMenuMediator.log.debug("MainMenuMediator(" + androidContext + ")"); if (androidContext == null) { throw new IllegalArgumentException("\"androidContext\" cannot be null"); @@ -68,7 +73,7 @@ protected MenuUI initView(PicrossUI ui, MenuController controller) throws PicrossException { - picross.engine.PicrossLogHelper.getLogger().debug("initView(" + ui + ", " + controller + ")"); + MainMenuMediator.log.debug("initView(" + ui + ", " + controller + ")"); MainMenuUI view = null; Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -351,10 +351,10 @@ } PicrossButton button = (PicrossButton) label; - + /* MenuUI.log.debug("Testing with X between " + button.getX() + " and " + (button.getX() + button.getWidth()) + ", and Y between " + button.getY() + " and " + (button.getY() + button.getHeight())); - /* + MenuUI.log.debug(x >= button.x); MenuUI.log.debug(x <= (button.x + button.width)); MenuUI.log.debug(y >= button.y); Modified: branches/engine_split/android/src/picross/specific/ui/PicrossAndroidLogger.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossAndroidLogger.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/ui/PicrossAndroidLogger.java 2013-01-16 09:37:19 UTC (rev 123) @@ -38,17 +38,26 @@ import picross.engine.AbstractPicrossLogger; public final class PicrossAndroidLogger extends AbstractPicrossLogger { - private static final String TAG = "PicrossAndroid"; + private String tag; + public PicrossAndroidLogger(Class<?> clazz) { + super(clazz); + + this.tag = clazz.getSimpleName(); + } + + @Override public void debug(String msg) { - Log.d(PicrossAndroidLogger.TAG, msg); + Log.d(this.tag, msg); } + @Override public void info(String msg) { - Log.i(PicrossAndroidLogger.TAG, msg); + Log.i(this.tag, msg); } + @Override public void error(String msg) { - Log.e(PicrossAndroidLogger.TAG, msg); + Log.e(this.tag, msg); } } Modified: branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -46,13 +46,18 @@ import java.lang.reflect.InvocationTargetException; +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + public final class PicrossMediator extends AbstractPicrossMediator { + private static PicrossLogger log = PicrossLogHelper.getLogger(PicrossMediator.class); + private Context context; public PicrossMediator(Context androidContext, PicrossUI view) { super(view, false); - picross.engine.PicrossLogHelper.getLogger().debug("PicrossMediator(" + androidContext + ", " + view + ")"); + PicrossMediator.log.debug("PicrossMediator(" + androidContext + ", " + view + ")"); this.context = androidContext; this.init(); @@ -60,8 +65,8 @@ @Override protected void displayMenu(Class<? extends MenuMediator> menuClass) { - picross.engine.PicrossLogHelper.getLogger().debug("displayMenu(" + menuClass + ")"); - picross.engine.PicrossLogHelper.getLogger().debug("this.context: " + this.context); + PicrossMediator.log.debug("displayMenu(" + menuClass + ")"); + PicrossMediator.log.debug("this.context: " + this.context); MenuMediator menu = null; Modified: branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuController.java =================================================================== --- branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuController.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuController.java 2013-01-16 09:37:19 UTC (rev 123) @@ -66,7 +66,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(LevelMenuController.class); /*** Method overloaded from the class LevelMenuController ***/ Modified: branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -60,7 +60,7 @@ /*** Static field ***/ /** The class' logger. */ - protected static PicrossLogger log = PicrossLogHelper.getLogger(); + protected static PicrossLogger log = PicrossLogHelper.getLogger(LevelMenuMediator.class); /*** Field ***/ @@ -83,7 +83,7 @@ protected MenuUI initView(PicrossUI ui, MenuController controller) throws PicrossException { - LevelMenuMediator.log.debug("initView()"); + LevelMenuMediator.log.debug("initView(" + ui + ", " + controller + ")"); this.model = new LevelMenuModel(); Modified: branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java =================================================================== --- branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java 2013-01-16 09:37:19 UTC (rev 123) @@ -44,6 +44,7 @@ import picross.engine.Picross; import picross.engine.PicrossException; +import picross.engine.PicrossLogger; import picross.engine.PicrossLogHelper; import picross.engine.game.simple.Dimensions; @@ -61,6 +62,8 @@ /** File containing the data files list. */ private static final String DATA_LIST = "contents.txt"; + private static PicrossLogger log = PicrossLogHelper.getLogger(LevelMenuModel.class); + /*** Field ***/ /** Levels list. */ @@ -120,7 +123,7 @@ String line = null; while ((line = in.readLine()) != null) { - PicrossLogHelper.getLogger().debug("read line: \"" + line + "\""); + LevelMenuModel.log.debug("read line: \"" + line + "\""); list.add(FileInfos.readFileInfos(line)); } } catch (IOException ioEx) { Modified: branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -61,7 +61,7 @@ /*** Static field ***/ /** Class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(AbstractGridMediator.class); /*** Fields ***/ Modified: branches/engine_split/common/src/picross/common/ui/AbstractMenuController.java =================================================================== --- branches/engine_split/common/src/picross/common/ui/AbstractMenuController.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/common/src/picross/common/ui/AbstractMenuController.java 2013-01-16 09:37:19 UTC (rev 123) @@ -55,7 +55,7 @@ /*** Static field ***/ /** The class' logger. */ - protected static PicrossLogger log = PicrossLogHelper.getLogger(); + protected static PicrossLogger log = PicrossLogHelper.getLogger(AbstractMenuController.class); /*** Field ***/ Modified: branches/engine_split/common/src/picross/common/ui/MenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/ui/MenuMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/common/src/picross/common/ui/MenuMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -52,7 +52,7 @@ /*** Static field ***/ /** This class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(MenuMediator.class); /*** Field ***/ @@ -91,6 +91,8 @@ * @throws PicrossException if the instantiation of the view fails */ public final void init(PicrossUI ui) throws PicrossException { + MenuMediator.log.debug("init(" + ui + ")"); + MenuController controller = this.initController(); controller.addSimpleListener(this); Modified: branches/engine_split/engine/src/picross/engine/AbstractPicrossLogger.java =================================================================== --- branches/engine_split/engine/src/picross/engine/AbstractPicrossLogger.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/engine/src/picross/engine/AbstractPicrossLogger.java 2013-01-16 09:37:19 UTC (rev 123) @@ -6,6 +6,12 @@ package picross.engine; public abstract class AbstractPicrossLogger implements PicrossLogger { + protected Class<?> clazz; + + protected AbstractPicrossLogger(Class<?> clazz) { + this.clazz = clazz; + } + @Override public final void debug(Object msg) { this.debug(msg.toString()); Modified: branches/engine_split/engine/src/picross/engine/PicrossLogHelper.java =================================================================== --- branches/engine_split/engine/src/picross/engine/PicrossLogHelper.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/engine/src/picross/engine/PicrossLogHelper.java 2013-01-16 09:37:19 UTC (rev 123) @@ -33,33 +33,58 @@ package picross.engine; +import java.util.HashMap; +import java.util.Map; + public final class PicrossLogHelper { - private static PicrossLogger logger = new DefaultPicrossLogger(); + private static Class<? extends PicrossLogger> loggerClass = null; + private static Map<Class<?>, PicrossLogger> loggers = new HashMap<Class<?>, PicrossLogger>(); - public static PicrossLogger getLogger() { - return PicrossLogHelper.logger; + public static PicrossLogger getLogger(Class<?> clazz) { + PicrossLogger logger = PicrossLogHelper.loggers.get(clazz); + + if (logger == null) { + try { + if (loggerClass == null) { + return DefaultPicrossLogger.class.getConstructor(Class.class).newInstance(clazz); + } + + logger = PicrossLogHelper.loggerClass.getConstructor(Class.class).newInstance(clazz); + // FIXME + } catch (Exception ex) { + ex.printStackTrace(); + } + + PicrossLogHelper.loggers.put(clazz, logger); + } + + return logger; } - public static void setLogger(PicrossLogger picrossLogger) { - PicrossLogHelper.logger = picrossLogger; + public static void setLoggerClass(Class<? extends PicrossLogger> picrossLoggerClass) { + PicrossLogHelper.loggerClass = picrossLoggerClass; } private PicrossLogHelper() { } private static final class DefaultPicrossLogger extends AbstractPicrossLogger { + public DefaultPicrossLogger(Class<?> clazz) { + super(clazz); + } + @Override public void debug(String msg) { - System.out.println("DEBUG " + msg); + System.out.println(this.clazz + " - DEBUG " + msg); } @Override public void info(String msg) { - System.out.println("INFO " + msg); + System.out.println(this.clazz + " - INFO " + msg); } @Override public void error(String msg) { - System.out.println("ERROR " + msg); + System.out.println(this.clazz + " - ERROR " + msg); } } } Modified: branches/engine_split/engine/src/picross/engine/game/random/RandomPicrossModel.java =================================================================== --- branches/engine_split/engine/src/picross/engine/game/random/RandomPicrossModel.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/engine/src/picross/engine/game/random/RandomPicrossModel.java 2013-01-16 09:37:19 UTC (rev 123) @@ -49,7 +49,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(RandomPicrossModel.class); /*** Constructor ***/ Modified: branches/engine_split/engine/src/picross/engine/game/simple/XBMModel.java =================================================================== --- branches/engine_split/engine/src/picross/engine/game/simple/XBMModel.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/engine/src/picross/engine/game/simple/XBMModel.java 2013-01-16 09:37:19 UTC (rev 123) @@ -93,7 +93,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(XBMModel.class); /*** Constructor ***/ Modified: branches/engine_split/engine/src/picross/engine/grid/GridModel.java =================================================================== --- branches/engine_split/engine/src/picross/engine/grid/GridModel.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/engine/src/picross/engine/grid/GridModel.java 2013-01-16 09:37:19 UTC (rev 123) @@ -53,7 +53,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GridModel.class); /*** Fields ***/ Modified: branches/engine_split/log4j.properties =================================================================== --- branches/engine_split/log4j.properties 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/log4j.properties 2013-01-16 09:37:19 UTC (rev 123) @@ -1,4 +1,4 @@ log4j.rootCategory=debug, stdout, log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%5p (%F:%L) - %m%n +log4j.appender.stdout.layout.ConversionPattern=%5p - %m%n Modified: branches/engine_split/swing/src/picross/specific/game/simple/ui/LevelMenuUI.java =================================================================== --- branches/engine_split/swing/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/swing/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -92,7 +92,7 @@ * @param listener listener for the buttons * @param sizes grid sizes */ - void displaySizes(MenuController listener, List<Dimensions> sizes) { + public void displaySizes(MenuController listener, List<Dimensions> sizes) { this.removeAll(); int x = 150; Modified: branches/engine_split/swing/src/picross/specific/game/ui/GameController.java =================================================================== --- branches/engine_split/swing/src/picross/specific/game/ui/GameController.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/swing/src/picross/specific/game/ui/GameController.java 2013-01-16 09:37:19 UTC (rev 123) @@ -53,7 +53,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GameController.class); /*** Method overloaded from the class Controller ***/ Modified: branches/engine_split/swing/src/picross/specific/game/ui/GameMediator.java =================================================================== --- branches/engine_split/swing/src/picross/specific/game/ui/GameMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/swing/src/picross/specific/game/ui/GameMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -61,7 +61,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GameMediator.class); /*** Fields ***/ Modified: branches/engine_split/swing/src/picross/specific/ui/GameMenuUI.java =================================================================== --- branches/engine_split/swing/src/picross/specific/ui/GameMenuUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/swing/src/picross/specific/ui/GameMenuUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -56,7 +56,7 @@ /*** Static field ***/ /** The class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(GameMenuUI.class); /*** Constructor ***/ Modified: branches/engine_split/swing/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/swing/src/picross/specific/ui/MenuUI.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/swing/src/picross/specific/ui/MenuUI.java 2013-01-16 09:37:19 UTC (rev 123) @@ -82,7 +82,7 @@ /*** Static field ***/ /** This class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + private static PicrossLogger log = PicrossLogHelper.getLogger(MenuUI.class); /*** Field ***/ Modified: branches/engine_split/swing/src/picross/specific/ui/PicrossLog4jLogger.java =================================================================== --- branches/engine_split/swing/src/picross/specific/ui/PicrossLog4jLogger.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/swing/src/picross/specific/ui/PicrossLog4jLogger.java 2013-01-16 09:37:19 UTC (rev 123) @@ -38,17 +38,26 @@ import picross.engine.AbstractPicrossLogger; public final class PicrossLog4jLogger extends AbstractPicrossLogger { - private static Logger log = Logger.getLogger(PicrossLog4jLogger.class); + private Logger log; + public PicrossLog4jLogger(Class<?> clazz) { + super(clazz); + + this.log = Logger.getLogger(this.clazz); + } + + @Override public void debug(String msg) { - PicrossLog4jLogger.log.debug(msg); + this.log.debug(this.clazz.getSimpleName() + " - " + msg); } + @Override public void info(String msg) { - PicrossLog4jLogger.log.info(msg); + this.log.info(this.clazz.getSimpleName() + " - " + msg); } + @Override public void error(String msg) { - PicrossLog4jLogger.log.error(msg); + this.log.error(this.clazz.getSimpleName() + " - " + msg); } } Modified: branches/engine_split/swing/src/picross/specific/ui/PicrossMediator.java =================================================================== --- branches/engine_split/swing/src/picross/specific/ui/PicrossMediator.java 2013-01-16 08:29:03 UTC (rev 122) +++ branches/engine_split/swing/src/picross/specific/ui/PicrossMediator.java 2013-01-16 09:37:19 UTC (rev 123) @@ -44,10 +44,12 @@ import picross.specific.game.ui.GameMediator; public final class PicrossMediator extends AbstractPicrossMediator { + static { + PicrossLogHelper.setLoggerClass(PicrossLog4jLogger.class); + } + public PicrossMediator(PicrossUI view) { super(view); - - PicrossLogHelper.setLogger(new PicrossLog4jLogger()); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-16 08:29:07
|
Revision: 122 http://sourceforge.net/p/picross/code/122 Author: yvan_norsa Date: 2013-01-16 08:29:03 +0000 (Wed, 16 Jan 2013) Log Message: ----------- cleaning Removed Paths: ------------- branches/engine_split/common/src/picross/specific/ui/GameMenuUI.java branches/engine_split/common/src/picross/specific/ui/MainMenuUI.java Deleted: branches/engine_split/common/src/picross/specific/ui/GameMenuUI.java =================================================================== --- branches/engine_split/common/src/picross/specific/ui/GameMenuUI.java 2013-01-15 15:27:28 UTC (rev 121) +++ branches/engine_split/common/src/picross/specific/ui/GameMenuUI.java 2013-01-16 08:29:03 UTC (rev 122) @@ -1,44 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2008 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package picross.specific.ui; - -import java.util.ServiceLoader; - -import picross.engine.game.GameMode; - -public final class GameMenuUI extends MenuUI { - public GameMenuUI(MenuController listener, ServiceLoader<GameMode> modes) { } -} - - Deleted: branches/engine_split/common/src/picross/specific/ui/MainMenuUI.java =================================================================== --- branches/engine_split/common/src/picross/specific/ui/MainMenuUI.java 2013-01-15 15:27:28 UTC (rev 121) +++ branches/engine_split/common/src/picross/specific/ui/MainMenuUI.java 2013-01-16 08:29:03 UTC (rev 122) @@ -1,47 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2007-2008 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package picross.specific.ui; - -public class MainMenuUI extends MenuUI { - public void init(MenuController controller) { } - - protected int getPlayButtonX() { - return -1; - } - - protected int getPlayButtonY() { - return -1; - } -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-15 15:27:31
|
Revision: 121 http://sourceforge.net/p/picross/code/121 Author: yvan_norsa Date: 2013-01-15 15:27:28 +0000 (Tue, 15 Jan 2013) Log Message: ----------- touch events Modified Paths: -------------- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java branches/engine_split/android/src/picross/specific/grid/ui/GridController.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java Added Paths: ----------- branches/engine_split/android/src/picross/specific/grid/ui/Point.java Modified: branches/engine_split/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-15 14:39:40 UTC (rev 120) +++ branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-15 15:27:28 UTC (rev 121) @@ -50,6 +50,12 @@ import android.graphics.Canvas; +import picross.specific.grid.ui.GridUI; + +import picross.specific.grid.ui.UIBox; + +import android.view.MotionEvent; + /** * The game UI. * @@ -67,7 +73,7 @@ /** Panel holding the buttons. */ //private JPanel buttonsPanel; - private GridView grid; + private GridUI grid; /*** Constructor ***/ @@ -84,9 +90,10 @@ MenuController listener) { super(context); - this.grid = gridView; + this.grid = (GridUI) gridView; - picross.specific.grid.ui.UIBox.staticInit(context.getResources()); + // HACK should not be here + UIBox.staticInit(context.getResources()); // FIXME /* @@ -137,9 +144,17 @@ } //GameUI.log.debug("onDraw(" + canvas + ")"); - ((picross.specific.grid.ui.GridUI) this.grid).draw(canvas); + this.grid.draw(canvas); } + @Override + public boolean onTouchEvent (MotionEvent event) { + this.grid.onTouch(null, event); + + // FIXME + return true; + } + /*** Method ***/ /** Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridController.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-15 14:39:40 UTC (rev 120) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-15 15:27:28 UTC (rev 121) @@ -45,14 +45,16 @@ import picross.common.grid.ui.GridCommands; +import android.view.View; +import android.view.MotionEvent; + /** * Grid controller. * * @author Y. Norsa */ public final class GridController extends Controller - // FIXME -{//implements MouseListener, MouseMotionListener { +implements View.OnTouchListener { /*** Fields ***/ @@ -102,45 +104,21 @@ } } - /*** Methods implanted from the interface MouseListener ***/ + @Override + public boolean onTouch(View view, MotionEvent event) { + if (event.getAction() != MotionEvent.ACTION_DOWN) { + return false; + } - /** {@inheritDoc} */ - /* - @Override - public void mouseClicked(MouseEvent e) { } - */ - /** {@inheritDoc} */ - /* - @Override - public void mouseEntered(MouseEvent e) { } - */ - /** {@inheritDoc} */ - /* - @Override - public void mouseExited(MouseEvent e) { - this.view.rolloverEnded(); - this.view.highlightEnded(); - } - */ - /** {@inheritDoc} */ - /* - @Override - public void mousePressed(MouseEvent e) { - this.view.rolloverEnded(); - } - */ - /** {@inheritDoc} */ - // FIXME - /* - @Override - public void mouseReleased(MouseEvent e) { - this.checkAndFill(e); + this.checkAndFill(event); this.eraseMode = false; this.fireEventPerformed(GridCommands.END_ACTION_CMD); + + // FIXME + return true; } - */ - /*** Methods implanted from the interface MouseMotionListener ***/ + /** {@inheritDoc} */ // FIXME /* @@ -149,23 +127,7 @@ this.checkAndFill(e); } */ - /** {@inheritDoc} */ - // FIXME - /* - @Override - public void mouseMoved(MouseEvent e) { - Point point = e.getPoint(); - if (this.view.isInGrid(point)) { - int row = this.view.getRow(point); - int column = this.view.getColumn(point); - - this.view.setRollover(row, column); - } else { - this.view.rolloverEnded(); - } - } - */ /*** Methods ***/ /** @@ -175,9 +137,9 @@ * @param e mouse event to handle */ - // FIXME - /* - private void checkAndFill(MouseEvent e) { + private void checkAndFill(MotionEvent e) { + // FIXME + /* int modifiers = e.getModifiers(); if (modifiers != MouseEvent.BUTTON1_MASK @@ -185,30 +147,28 @@ return; } + */ + Point point = new Point(e.getX(), e.getY()); - Point point = e.getPoint(); - if (this.view.isInGrid(point)) { int row = this.view.getRow(point); -- int column = this.view.getColumn(point); + int column = this.view.getColumn(point); GridAction type; if (this.eraseMode) { type = GridAction.EMPTY; } else { - type = GridController.modifiersToType(modifiers); + // FIXME + //type = GridController.modifiersToType(modifiers); + type = GridAction.CHECK; } - this.view.rolloverHighlight(row, column); - this.fireEventPerformed(GridCommands.FILL_CMD, new FillCommand(row, column, type)); - } else { - this.view.highlightEnded(); } } - */ + /** * Converts a mouse click to an action. * Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-15 14:39:40 UTC (rev 120) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-15 15:27:28 UTC (rev 121) @@ -59,12 +59,15 @@ import picross.engine.PicrossLogger; import picross.engine.PicrossLogHelper; +import android.view.MotionEvent; +import android.view.View; + /** * Grid UI. * * @author Y. Norsa */ -public final class GridUI /*extends JPanel*/ implements GridView { +public final class GridUI /*extends JPanel*/ implements GridView, View.OnTouchListener { /*** Constants ***/ /** Space left before the top hints. */ @@ -614,8 +617,6 @@ * @param point point to be tested * @return boolean telling if the point is inside the grid */ - // FIXME - /* boolean isInGrid(Point point) { double x = point.getX(); double y = point.getY(); @@ -623,21 +624,19 @@ return (x >= this.leftBoundary && x < this.rightBoundary && y >= this.topBoundary && y < this.bottomBoundary); } - */ + /** * Allows to get the row number corresponding to a point inside the grid. * * @param point a point inside the grid * @return the row corresponding to the point */ - // FIXME - /* int getRow(Point point) { double y = point.getY() - this.topBoundary; return (int) (y / GridUI.BOX_HEIGHT); } - */ + /** * Allows to get the column number corresponding to a point * inside the grid. @@ -645,14 +644,12 @@ * @param point a point inside the grid * @return the column corresponding to the point */ - // FIXME - /* int getColumn(Point point) { double x = point.getX() - this.leftBoundary; return (int) (x / GridUI.BOX_WIDTH); } - */ + /** Removes the listeners to disable the grid. */ void disableGrid() { // FIXME @@ -701,6 +698,14 @@ this.boxes[row][col].updateState(box); } + @Override + public boolean onTouch(View view, MotionEvent event) { + this.controller.onTouch(null, event); + + // FIXME + return true; + } + private static class Line2D { private int x1; private int y1; Added: branches/engine_split/android/src/picross/specific/grid/ui/Point.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/Point.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/Point.java 2013-01-15 15:27:28 UTC (rev 121) @@ -0,0 +1,52 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.grid.ui; + +class Point { + private float x; + private float y; + + Point(float x, float y) { + this.x = x; + this.y = y; + } + + double getX() { + return this.x; + } + + double getY() { + return this.y; + } +} Property changes on: branches/engine_split/android/src/picross/specific/grid/ui/Point.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-15 14:39:40 UTC (rev 120) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-15 15:27:28 UTC (rev 121) @@ -335,6 +335,11 @@ @Override public boolean onTouchEvent (MotionEvent event) { + if (event.getAction() != MotionEvent.ACTION_DOWN) { + MenuUI.log.debug("ignoring action with value " + event.getAction()); + return false; + } + float x = event.getX(); float y = event.getY(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-15 14:39:44
|
Revision: 120 http://sourceforge.net/p/picross/code/120 Author: yvan_norsa Date: 2013-01-15 14:39:40 +0000 (Tue, 15 Jan 2013) Log Message: ----------- grid rendering Modified Paths: -------------- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-15 14:25:07 UTC (rev 119) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-15 14:39:40 UTC (rev 120) @@ -206,11 +206,9 @@ int[][] rowData, CompletedHints completedHints, GridController controller) { - // FIXME - //super(true); + GridUI.log.debug("GridUI(" + androidContext + ", " + width + ", " + height + + ", boxes, colData, rowData, completedhints, controller)"); - GridUI.log.debug("GridUI(" + androidContext + ", " + width + ", " + height + ", boxes, colData, rowData, completedhints, controller)"); - if (androidContext == null) { throw new IllegalArgumentException("\"androidContext\" cannot be null"); } @@ -243,18 +241,18 @@ public void draw(Canvas c) { c.drawColor(Color.WHITE); - //Rectangle clipRect = newG.getClipBounds(); + Rect clipRect = c.getClipBounds(); for (int i = 0; i < this.topHints.length; i++) { - //if (this.topHints[i].intersects(clipRect)) { + if (this.topHints[i].intersect(clipRect)) { this.drawTopHints(c, i); - //} + } } for (int i = 0; i < this.leftHints.length; i++) { - //if (this.leftHints[i].intersects(clipRect)) { + if (this.leftHints[i].intersect(clipRect)) { this.drawLeftHints(c, i); - //} + } } // Paints the boxes @@ -262,11 +260,11 @@ for (int j = 0; j < this.height; j++) { Rect currentRect = this.boxes[i][j].getRect(); - //if (currentRect.intersects(clipRect)) { + if (currentRect.intersect(clipRect)) { c.drawBitmap(this.boxes[i][j].getIcon(), currentRect.left, currentRect.top, null); - //} + } } } @@ -290,31 +288,7 @@ public void init() throws FileNotFoundException { GridUI.log.debug("init()"); - // FIXME - /* // Computes the size of a hint - FontRenderContext frc = new FontRenderContext(null, true, true); - - // High hint (> 10) - Rectangle2D textBounds = - GridUI.HINT_FONT.getStringBounds(GridUI.HIGH_SAMPLE_HINT, frc); - int hintHeight = (int) textBounds.getHeight(); - int highHintWidth = (int) textBounds.getWidth(); - - // Low hint - textBounds = GridUI.HINT_FONT.getStringBounds(GridUI.LOW_SAMPLE_HINT, - frc); - int lowHintWidth = (int) textBounds.getWidth(); - */ - - /* - Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); - //paint.setStyle(Paint.Style.FILL); - //paint.setColor(color); - paint.setTextAlign(Paint.Align.CENTER); - paint.setTextSize(10); - paint.setTypeface(GridUI.HINT_FONT); - */ Paint paint = GridUI.getHintPaint(); Rect textBounds = new Rect(); @@ -327,14 +301,11 @@ GridUI.log.debug("highHintWidth = " + highHintWidth); // Low hint - //textBounds = new Rect(); paint.getTextBounds(GridUI.LOW_SAMPLE_HINT, 0, 1, textBounds); int lowHintWidth = (int) textBounds.width(); GridUI.log.debug("lowHintWidth = " + lowHintWidth); - // FIXME - //this.hintBoxIcon = PicrossUIHelper.getImage(GridUI.HINT_BOX_ICON); this.hintBoxIcon = PicrossUIHelper.getImage(this.context.getResources(), R.drawable.hint); int hintBoxWidth = this.hintBoxIcon.getWidth(); @@ -363,20 +334,11 @@ for (int i = 0; i < this.topHints.length; i++) { this.topHints[i] = new HintBoxInfos(); - /* this.topHints[i].setRect(new Rect(this.leftBoundary + (i * GridUI.BOX_WIDTH), 0, - GridUI.BOX_WIDTH, - this.topBoundary)); - */ - - this.topHints[i].setRect(new Rect(this.leftBoundary - + (i * GridUI.BOX_WIDTH), 0, this.leftBoundary + (i * GridUI.BOX_WIDTH) + GridUI.BOX_WIDTH, this.topBoundary)); - - //GridUI.log.debug("this.topHints[" + i + "].setRect(" + this.topHints[i].getRect() + ")"); } this.leftHints = new HintBoxInfos[this.height]; @@ -384,16 +346,10 @@ for (int i = 0; i < this.leftHints.length; i++) { this.leftHints[i] = new HintBoxInfos(); - /* this.leftHints[i].setRect(new Rect(0, this.topBoundary + (i * GridUI.BOX_HEIGHT), this.leftBoundary, - GridUI.BOX_HEIGHT)); - */ - this.leftHints[i].setRect(new Rect(0, this.topBoundary - + (i * GridUI.BOX_HEIGHT), - this.leftBoundary, -this.topBoundary + this.topBoundary + (i * GridUI.BOX_HEIGHT) + GridUI.BOX_HEIGHT)); } @@ -420,22 +376,13 @@ * so we'll be able * to redraw only what is needed */ - /* this.boxes[i][j] .setRect(new Rect(this.leftBoundary + (i * GridUI.BOX_WIDTH), this.topBoundary + (j * GridUI.BOX_WIDTH), - GridUI.BOX_WIDTH, - GridUI.BOX_HEIGHT)); - */ - this.boxes[i][j] - .setRect(new Rect(this.leftBoundary - + (i * GridUI.BOX_WIDTH), - this.topBoundary - + (j * GridUI.BOX_WIDTH), -this.leftBoundary + this.leftBoundary + (i * GridUI.BOX_WIDTH)+ GridUI.BOX_WIDTH, @@ -517,25 +464,10 @@ * @param topHintsStart coordinate where the boxes begin */ private void initTopHints(int topHintsStart) { - // FIXME for (int k = 0; k < this.topHints.length; k++) { - /* - this.topHints[k].setBox( - new BufferedImage(GridUI.BOX_WIDTH, this.topBoundary, - BufferedImage.TYPE_INT_RGB)); - */ - //Bitmap b = Bitmap.createBitmap(GridUI.BOX_WIDTH, this.topBoundary, Bitmap.Config.ARGB_8888); Picture b = new Picture(); - //this.topHints[k].setBox(b); + Canvas g2d = b.beginRecording(GridUI.BOX_WIDTH, this.topBoundary); - //Canvas g2d = this.topHints[k].createBoxGraphics(); - Canvas g2d = b.beginRecording(GridUI.BOX_WIDTH, this.topBoundary); - //g2d.drawColor(Color.WHITE); - /* - g2d.fillRect(0, 0, - this.topHints[k].getWidth(), - this.topHints[k].getHeight()); - */ Paint paint = new Paint(); paint.setStyle(Paint.Style.FILL); paint.setColor(Color.WHITE); @@ -548,7 +480,6 @@ // Column hints are in reverse order for (int i = (this.colData[0].length - 1); i >= 0; i--) { if (this.colData[k][i] != GridModel.EMPTY_HINT) { - //this.hintBoxIcon.paintIcon(this, g2d, topHintsStart, y); g2d.drawBitmap(this.hintBoxIcon, topHintsStart, y, null); } @@ -568,16 +499,9 @@ */ private void initLeftHints(int leftHintsStart) { for (int k = 0; k < this.leftHints.length; k++) { - /* - this.leftHints[k].setBox( - new BufferedImage(this.leftBoundary, GridUI.BOX_HEIGHT, - BufferedImage.TYPE_INT_RGB)); - */ Picture b = new Picture(); Canvas g2d = b.beginRecording(this.leftBoundary, GridUI.BOX_HEIGHT); - //Graphics2D g2d = this.leftHints[k].createBoxGraphics(); - //g2d.setColor(Color.WHITE); Paint paint = new Paint(); paint.setStyle(Paint.Style.FILL); paint.setColor(Color.WHITE); @@ -590,7 +514,6 @@ for (int j = 0; j < this.rowData[k].length; j++) { if (this.rowData[k][j] != GridModel.EMPTY_HINT) { - //this.hintBoxIcon.paintIcon(this, g2d, x, leftHintsStart); g2d.drawBitmap(this.hintBoxIcon, x, leftHintsStart, null); } @@ -609,18 +532,8 @@ * @param g the graphics context */ private void drawTopHints(Canvas c, int col) { - /* - g.drawImage(this.topHints[col].getBox(), - this.topHints[col].getX(), this.topHints[col].getY(), - null); - */ - - //this.topHints[col].getBox().draw(c); c.drawPicture(this.topHints[col].getBox(), this.topHints[col].getRect()); - // FIXME - //g.setFont(GridUI.HINT_FONT); - int x = this.topHintsX + (col * GridUI.BOX_WIDTH); int y = 0; @@ -640,16 +553,8 @@ * @param g the graphics context */ private void drawLeftHints(Canvas c, int row) { - /* - g.drawImage(this.leftHints[row].getBox(), - this.leftHints[row].getX(), this.leftHints[row].getY(), - null); - */ c.drawPicture(this.leftHints[row].getBox(), this.leftHints[row].getRect()); - //FIXME - //g.setFont(GridUI.HINT_FONT); - int y = this.leftHintsY + (row * GridUI.BOX_HEIGHT); int x = 0; @@ -675,19 +580,14 @@ boolean complete) { //GridUI.log.debug("drawHint(c, " + value + ", " + x + ", " + y + ", " + complete + ")"); - //Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); Paint paint = GridUI.getHintPaint(); - if (complete) { - paint.setColor(GridUI.COMPLETED_HINT_COLOR); - } else { - paint.setColor(GridUI.HINT_TEXT_COLOR); - } - /* - paint.setTypeface(GridUI.HINT_FONT); - paint.setTextAlign(Paint.Align.CENTER); -paint.setTextSize(10); - */ + if (complete) { + paint.setColor(GridUI.COMPLETED_HINT_COLOR); + } else { + paint.setColor(GridUI.HINT_TEXT_COLOR); + } + y += this.centerHintHeight; if (value < 10) { @@ -702,7 +602,7 @@ private static Paint getHintPaint() { Paint paint = new Paint(/*Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG*/); paint.setTypeface(GridUI.HINT_FONT); - paint.setTextAlign(Paint.Align.CENTER); + //paint.setTextAlign(Paint.Align.CENTER); paint.setTextSize(10); return paint; Modified: branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-15 14:25:07 UTC (rev 119) +++ branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-15 14:39:40 UTC (rev 120) @@ -49,7 +49,6 @@ private Rect rect = null; /** Pre-rendered image of the box. */ - //private BufferedImage box = null; private Picture box = null; /*** Methods ***/ @@ -60,22 +59,11 @@ * @param rectangle the rectangle to test * @return boolean indicating wether the two rectangles intersect * with each other - *//* boolean intersects(Rectangle rectangle) { - return this.rect.intersects(rectangle); - }*/ + */ boolean intersect(Rect rectangle) { + return this.rect.intersect(rectangle); + } /** - * Creates and return a <code>Graphics2D</code> object corresponding - * to the box. - * - * @return graphical object corresponding to the box - */ - /* - Canvas createBoxGraphics() { - return new Canvas(this.box); - } - */ - /** * Returns the rectangle's width. * * @return width of the box's rectangle Modified: branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java 2013-01-15 14:25:07 UTC (rev 119) +++ branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java 2013-01-15 14:39:40 UTC (rev 120) @@ -59,9 +59,6 @@ public final class UIBox extends Box { /*** Constants ***/ - /** Index of the normal icon. */ - //private static final int ICON_INDEX = 0; - /** Images files extension. */ private static final String IMAGES_EXT = ".png"; @@ -73,7 +70,6 @@ /*** Field ***/ /** Rectangle occupied by the box. */ - //private Rectangle rect; private Rect rect; /*** Static block ***/ @@ -88,17 +84,6 @@ UIBox.images = new HashMap<BoxState, Bitmap>(4); try { - /* - for (BoxState state : BoxState.values()) { - ImageIcon[] img = new ImageIcon[1]; - - String stateImageName = state.toString().toLowerCase(); - img[UIBox.ICON_INDEX] = - PicrossUIHelper.getImage(stateImageName + UIBox.IMAGES_EXT); - UIBox.images.put(state, img); - } - */ - UIBox.images.put(BoxState.EMPTY, PicrossUIHelper.getImage(res, R.drawable.empty)); UIBox.images.put(BoxState.CHECKED, PicrossUIHelper.getImage(res, R.drawable.checked)); UIBox.images.put(BoxState.CROSSED, PicrossUIHelper.getImage(res, R.drawable.crossed)); @@ -141,12 +126,6 @@ * * @return icon of the state of the box */ - /* - ImageIcon getIcon() { - return UIBox.images.get(this.state)[UIBox.ICON_INDEX]; - } - */ - Bitmap getIcon() { return UIBox.images.get(this.state); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-15 14:25:12
|
Revision: 119 http://sourceforge.net/p/picross/code/119 Author: yvan_norsa Date: 2013-01-15 14:25:07 +0000 (Tue, 15 Jan 2013) Log Message: ----------- android version Modified Paths: -------------- branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java branches/engine_split/android/src/picross/specific/grid/ui/GridController.java branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java Added Paths: ----------- branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidLevelMenuMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -42,6 +42,7 @@ import picross.common.ui.PicrossUI; import picross.engine.PicrossException; import picross.common.game.simple.ui.LevelMenuModel; +import picross.common.game.ui.GameCommand; public final class AndroidLevelMenuMediator extends LevelMenuMediator { private Context context; @@ -51,6 +52,15 @@ this.context = context; } + + @Override + protected GameCommand newSimpleGameCommand(String selectedLevel) { + return new + GameCommand(new + AndroidSimpleGameMediator(this.context, selectedLevel)); + } + + /** {@inheritDoc} */ @Override protected MenuUI initView(PicrossUI ui, MenuController controller) Added: branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java (rev 0) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -0,0 +1,85 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.game.simple.ui; + +import java.io.IOException; + +import picross.engine.Picross; +import picross.engine.PicrossException; + +import picross.engine.game.simple.XBMModel; + +import picross.specific.game.ui.GameMediator; + +import picross.engine.grid.PicrossGrid; + +import android.content.Context; + +/** + * Mediator for a classic game. + * + * @author Y. Norsa + */ +public final class AndroidSimpleGameMediator extends GameMediator { + /*** Field ***/ + + /** Level to load. */ + private String level; + + /*** Constructor ***/ + + /** + * Constructor. + * + * @param levelName name of the level + */ + public AndroidSimpleGameMediator(Context context, String levelName) { + super(context); + + this.level = levelName; + } + + /*** Method overloaded from the class GameMediator ***/ + + /** {@inheritDoc} */ + @Override + protected PicrossGrid initModel() throws PicrossException { + try { + return new XBMModel(Picross.loadDataFile(this.level)); + } catch (IOException ioEx) { + throw new PicrossException(ioEx); + } + } +} + Property changes on: branches/engine_split/android/src/picross/specific/game/simple/ui/AndroidSimpleGameMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridController.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-15 14:25:07 UTC (rev 119) @@ -70,7 +70,6 @@ String cmd = e.getCommandName(); if (cmd.equals(GridCommands.GRID_FILLED_CMD)) { - this.view.rolloverEnded(); this.view.disableGrid(); return; Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -49,17 +49,19 @@ public final class GridMediator extends AbstractGridMediator { private Context context; - public GridMediator(Context context, final int width, final int height, boolean[][] data) throws PicrossException { - super(width, height, data); + public GridMediator(Context androidContext, final int width, final int height, boolean[][] data) throws PicrossException { + super(width, height, data, false); - this.context = context; + this.context = androidContext; + + this.doInit(width, height); } @Override protected void initGrid(final int width, final int height, final UIBox[][] boxes, final int[][] colData, final int[][] rowData, final CompletedHints hints, final GridController controller) { //new Thread() { // public void run() { - GridMediator.this.view = new GridUI(width, height, + GridMediator.this.view = new GridUI(this.context, width, height, boxes, colData, rowData, Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-15 14:25:07 UTC (rev 119) @@ -47,8 +47,18 @@ import picross.engine.grid.GridModel; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Rect; +import android.graphics.Bitmap; +import android.content.Context; +import picross.specific.activities.R; +import android.graphics.Typeface; +import android.graphics.Paint; +import android.graphics.Picture; +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + /** * Grid UI. * @@ -64,16 +74,14 @@ private static final int LEFT_HINTS = 10; /** Color of the hints text. */ - //private static final Color HINT_TEXT_COLOR = new Color(233, 246, 255); + private static final int HINT_TEXT_COLOR = Color.rgb(233, 246, 255); /** Color of a completed hint text. */ - //private static final Color COMPLETED_HINT_COLOR = new Color(208, 215, 217); + private static final int COMPLETED_HINT_COLOR = Color.rgb(208, 215, 217); /** Font used for the hints. */ - /* - private static final Font HINT_FONT = - new Font("Sans Serif", Font.BOLD, 10); - */ + private static final Typeface HINT_FONT = Typeface.create("Sans Serif", Typeface.BOLD); + /** A box width. */ private static final int BOX_WIDTH = 25; @@ -99,7 +107,7 @@ private static final int HINTS_SPACE = 2; /** Boxes blocks color. */ - //private static final Color BLOCKS_COLOR = new Color(131, 155, 200); + private static final int BLOCKS_COLOR = Color.rgb(131, 155, 200); /** A block width. */ private static final int BLOCK_WIDTH = 5; @@ -107,6 +115,8 @@ /** A block height. */ private static final int BLOCK_HEIGHT = 5; + private static PicrossLogger log = PicrossLogHelper.getLogger(); + /*** Fields ***/ /** Grid width. */ @@ -142,14 +152,11 @@ /** Current state of the grid. */ private transient UIBox[][] boxes; - /** Current rolled-over box. */ - private transient UIBox rollover; - /** Controller attached to this view. */ private transient GridController controller; /** Hint box icon. */ - //private ImageIcon hintBoxIcon; + private Bitmap hintBoxIcon; /** X coordinate of the beginning of a top hints row. */ private int topHintsX; @@ -173,17 +180,13 @@ private int centerHighHintWidth; /** Boxes blocks. */ - //private List<Line2D> blocksLines; + private List<Line2D> blocksLines; /** List of completed hints. */ private transient CompletedHints completedHints; - /** Index of the currently highlighted row. */ - private int rolloverRow = -1; + private Context context; - /** Index of the currently highlighted column. */ - private int rolloverColumn = -1; - /*** Constructor ***/ /** @@ -197,7 +200,7 @@ * @param completedHints list of completed hints * @param controller controller for the grid */ - public GridUI(int width, int height, + public GridUI(Context androidContext, int width, int height, UIBox[][] boxes, int[][] colData, int[][] rowData, @@ -206,6 +209,13 @@ // FIXME //super(true); + GridUI.log.debug("GridUI(" + androidContext + ", " + width + ", " + height + ", boxes, colData, rowData, completedhints, controller)"); + + if (androidContext == null) { + throw new IllegalArgumentException("\"androidContext\" cannot be null"); + } + + this.context = androidContext; this.controller = controller; // FIXME @@ -231,21 +241,22 @@ /*** Method overloaded from JPanel ***/ public void draw(Canvas c) { - /* - Rectangle clipRect = newG.getClipBounds(); + c.drawColor(Color.WHITE); + //Rectangle clipRect = newG.getClipBounds(); + for (int i = 0; i < this.topHints.length; i++) { - if (this.topHints[i].intersects(clipRect)) { - this.drawTopHints(newG, i); - } + //if (this.topHints[i].intersects(clipRect)) { + this.drawTopHints(c, i); + //} } for (int i = 0; i < this.leftHints.length; i++) { - if (this.leftHints[i].intersects(clipRect)) { - this.drawLeftHints(newG, i); - } + //if (this.leftHints[i].intersects(clipRect)) { + this.drawLeftHints(c, i); + //} } - */ + // Paints the boxes for (int i = 0; i < this.width; i++) { for (int j = 0; j < this.height; j++) { @@ -260,13 +271,13 @@ } // Draws the blocks - /* - newG.setColor(GridUI.BLOCKS_COLOR); + Paint paint = new Paint(); + paint.setColor(GridUI.BLOCKS_COLOR); + for (Line2D line : this.blocksLines) { - newG.draw(line); + c.drawLines(line.getPoints(), paint); } - */ } /*** Methods ***/ @@ -277,6 +288,8 @@ * @throws FileNotFoundException if an image is missing */ public void init() throws FileNotFoundException { + GridUI.log.debug("init()"); + // FIXME /* // Computes the size of a hint @@ -292,12 +305,41 @@ textBounds = GridUI.HINT_FONT.getStringBounds(GridUI.LOW_SAMPLE_HINT, frc); int lowHintWidth = (int) textBounds.getWidth(); + */ - this.hintBoxIcon = PicrossUIHelper.getImage(GridUI.HINT_BOX_ICON); + /* + Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); + //paint.setStyle(Paint.Style.FILL); + //paint.setColor(color); + paint.setTextAlign(Paint.Align.CENTER); + paint.setTextSize(10); + paint.setTypeface(GridUI.HINT_FONT); + */ + Paint paint = GridUI.getHintPaint(); - int hintBoxWidth = this.hintBoxIcon.getIconWidth(); - int hintBoxHeight = this.hintBoxIcon.getIconHeight(); + Rect textBounds = new Rect(); + // High hint (> 10) + paint.getTextBounds(GridUI.HIGH_SAMPLE_HINT, 0, 2, textBounds); + int hintHeight = (int) textBounds.height(); + int highHintWidth = (int) textBounds.width(); + + GridUI.log.debug("highHintWidth = " + highHintWidth); + + // Low hint + //textBounds = new Rect(); + paint.getTextBounds(GridUI.LOW_SAMPLE_HINT, 0, 1, textBounds); + int lowHintWidth = (int) textBounds.width(); + + GridUI.log.debug("lowHintWidth = " + lowHintWidth); + + // FIXME + //this.hintBoxIcon = PicrossUIHelper.getImage(GridUI.HINT_BOX_ICON); + this.hintBoxIcon = PicrossUIHelper.getImage(this.context.getResources(), R.drawable.hint); + + int hintBoxWidth = this.hintBoxIcon.getWidth(); + int hintBoxHeight = this.hintBoxIcon.getHeight(); + this.leftHintsDecal = hintBoxWidth + GridUI.HINTS_SPACE; this.topHintsDecal = hintBoxHeight + GridUI.HINTS_SPACE; @@ -321,10 +363,20 @@ for (int i = 0; i < this.topHints.length; i++) { this.topHints[i] = new HintBoxInfos(); - this.topHints[i].setRect(new Rectangle(this.leftBoundary + /* + this.topHints[i].setRect(new Rect(this.leftBoundary + (i * GridUI.BOX_WIDTH), 0, GridUI.BOX_WIDTH, this.topBoundary)); + */ + + this.topHints[i].setRect(new Rect(this.leftBoundary + + (i * GridUI.BOX_WIDTH), 0, + this.leftBoundary + + (i * GridUI.BOX_WIDTH) + GridUI.BOX_WIDTH, + this.topBoundary)); + + //GridUI.log.debug("this.topHints[" + i + "].setRect(" + this.topHints[i].getRect() + ")"); } this.leftHints = new HintBoxInfos[this.height]; @@ -332,10 +384,18 @@ for (int i = 0; i < this.leftHints.length; i++) { this.leftHints[i] = new HintBoxInfos(); - this.leftHints[i].setRect(new Rectangle(0, this.topBoundary + /* + this.leftHints[i].setRect(new Rect(0, this.topBoundary + (i * GridUI.BOX_HEIGHT), this.leftBoundary, GridUI.BOX_HEIGHT)); + */ + this.leftHints[i].setRect(new Rect(0, this.topBoundary + + (i * GridUI.BOX_HEIGHT), + this.leftBoundary, +this.topBoundary + + (i * GridUI.BOX_HEIGHT) + + GridUI.BOX_HEIGHT)); } this.topHintsX = this.leftBoundary @@ -348,9 +408,11 @@ (hintBoxHeight / 2) + (hintHeight / 2); this.centerLowHintWidth = (hintBoxWidth / 2) - (lowHintWidth / 2); + GridUI.log.debug("centerLowHintWidth = " + centerLowHintWidth); this.centerHighHintWidth = (hintBoxWidth / 2) - (highHintWidth / 2); - */ + GridUI.log.debug("centerHighHintWidth = " + centerHighHintWidth); + for (int i = 0; i < this.width; i++) { for (int j = 0; j < this.height; j++) { /* @@ -358,6 +420,7 @@ * so we'll be able * to redraw only what is needed */ + /* this.boxes[i][j] .setRect(new Rect(this.leftBoundary + (i * GridUI.BOX_WIDTH), @@ -365,16 +428,30 @@ + (j * GridUI.BOX_WIDTH), GridUI.BOX_WIDTH, GridUI.BOX_HEIGHT)); + */ + this.boxes[i][j] + .setRect(new Rect(this.leftBoundary + + (i * GridUI.BOX_WIDTH), + this.topBoundary + + (j * GridUI.BOX_WIDTH), + +this.leftBoundary + + (i * GridUI.BOX_WIDTH)+ + + GridUI.BOX_WIDTH, + + this.topBoundary + + (j * GridUI.BOX_WIDTH)+ + GridUI.BOX_HEIGHT)); } } - // FIXME - /* this.initBlocks(); this.initTopHints((GridUI.BOX_WIDTH / 2) - (hintBoxWidth / 2)); this.initLeftHints((GridUI.BOX_HEIGHT / 2) - (hintBoxHeight / 2)); - + // FIXME + /* this.setPreferredSize(new Dimension(this.rightBoundary + GridUI.RIGHT_SPACE, this.bottomBoundary @@ -384,23 +461,21 @@ /** Precomputes the blocks lines. */ private void initBlocks() { - // FIXME - /* this.blocksLines = new ArrayList<Line2D>(); - this.blocksLines.add(new Line2D.Double(this.leftBoundary, + this.blocksLines.add(new Line2D(this.leftBoundary, this.topBoundary, this.leftBoundary, this.bottomBoundary)); - this.blocksLines.add(new Line2D.Double(this.leftBoundary, + this.blocksLines.add(new Line2D(this.leftBoundary, this.topBoundary, this.rightBoundary, this.topBoundary)); - this.blocksLines.add(new Line2D.Double(this.rightBoundary, + this.blocksLines.add(new Line2D(this.rightBoundary, this.bottomBoundary, this.leftBoundary, this.bottomBoundary)); - this.blocksLines.add(new Line2D.Double(this.rightBoundary, + this.blocksLines.add(new Line2D(this.rightBoundary, this.bottomBoundary, this.rightBoundary, this.topBoundary)); @@ -412,7 +487,7 @@ int currentY = this.topBoundary + boxHeight; while ((i + GridUI.BLOCK_HEIGHT) <= this.height) { - this.blocksLines.add(new Line2D.Double(this.leftBoundary, + this.blocksLines.add(new Line2D(this.leftBoundary, currentY, this.rightBoundary, currentY)); @@ -425,7 +500,7 @@ int currentX = this.leftBoundary + boxWidth; while ((i + GridUI.BLOCK_WIDTH) <= this.width) { - this.blocksLines.add(new Line2D.Double(currentX, + this.blocksLines.add(new Line2D(currentX, this.topBoundary, currentX, this.bottomBoundary)); @@ -433,7 +508,7 @@ currentX += boxWidth; i += GridUI.BLOCK_WIDTH; } - */ + } /** @@ -443,29 +518,47 @@ */ private void initTopHints(int topHintsStart) { // FIXME - /* for (int k = 0; k < this.topHints.length; k++) { + /* this.topHints[k].setBox( new BufferedImage(GridUI.BOX_WIDTH, this.topBoundary, BufferedImage.TYPE_INT_RGB)); + */ + //Bitmap b = Bitmap.createBitmap(GridUI.BOX_WIDTH, this.topBoundary, Bitmap.Config.ARGB_8888); + Picture b = new Picture(); + //this.topHints[k].setBox(b); - Graphics2D g2d = this.topHints[k].createBoxGraphics(); - g2d.setColor(Color.WHITE); + //Canvas g2d = this.topHints[k].createBoxGraphics(); + Canvas g2d = b.beginRecording(GridUI.BOX_WIDTH, this.topBoundary); + //g2d.drawColor(Color.WHITE); + /* g2d.fillRect(0, 0, this.topHints[k].getWidth(), this.topHints[k].getHeight()); + */ + Paint paint = new Paint(); + paint.setStyle(Paint.Style.FILL); + paint.setColor(Color.WHITE); + g2d.drawRect(new Rect(0, 0, + this.topHints[k].getWidth(), + this.topHints[k].getHeight()), paint); int y = 0; // Column hints are in reverse order for (int i = (this.colData[0].length - 1); i >= 0; i--) { if (this.colData[k][i] != GridModel.EMPTY_HINT) { - this.hintBoxIcon.paintIcon(this, g2d, topHintsStart, y); + //this.hintBoxIcon.paintIcon(this, g2d, topHintsStart, y); + g2d.drawBitmap(this.hintBoxIcon, topHintsStart, y, null); } y += this.topHintsDecal; } - }*/ + + b.endRecording(); + + this.topHints[k].setBox(b); + } } /** @@ -474,29 +567,40 @@ * @param leftHintsStart coordinate where the boxes begin */ private void initLeftHints(int leftHintsStart) { - // FIXME - /* for (int k = 0; k < this.leftHints.length; k++) { + /* this.leftHints[k].setBox( new BufferedImage(this.leftBoundary, GridUI.BOX_HEIGHT, BufferedImage.TYPE_INT_RGB)); + */ + Picture b = new Picture(); + Canvas g2d = b.beginRecording(this.leftBoundary, GridUI.BOX_HEIGHT); - Graphics2D g2d = this.leftHints[k].createBoxGraphics(); - g2d.setColor(Color.WHITE); - g2d.fillRect(0, 0, + //Graphics2D g2d = this.leftHints[k].createBoxGraphics(); + //g2d.setColor(Color.WHITE); + Paint paint = new Paint(); + paint.setStyle(Paint.Style.FILL); + paint.setColor(Color.WHITE); + + g2d.drawRect(new Rect(0, 0, this.leftHints[k].getWidth(), - this.leftHints[k].getHeight()); + this.leftHints[k].getHeight()), paint); int x = 0; for (int j = 0; j < this.rowData[k].length; j++) { if (this.rowData[k][j] != GridModel.EMPTY_HINT) { - this.hintBoxIcon.paintIcon(this, g2d, x, leftHintsStart); + //this.hintBoxIcon.paintIcon(this, g2d, x, leftHintsStart); + g2d.drawBitmap(this.hintBoxIcon, x, leftHintsStart, null); } x += this.leftHintsDecal; } - }*/ + + b.endRecording(); + + this.leftHints[k].setBox(b); + } } /** @@ -504,57 +608,61 @@ * * @param g the graphics context */ - // FIXME - /* - private void drawTopHints(Graphics g, int col) { + private void drawTopHints(Canvas c, int col) { + /* g.drawImage(this.topHints[col].getBox(), this.topHints[col].getX(), this.topHints[col].getY(), null); + */ - g.setFont(GridUI.HINT_FONT); + //this.topHints[col].getBox().draw(c); + c.drawPicture(this.topHints[col].getBox(), this.topHints[col].getRect()); + // FIXME + //g.setFont(GridUI.HINT_FONT); + int x = this.topHintsX + (col * GridUI.BOX_WIDTH); int y = 0; for (int i = this.colData[0].length - 1; i >= 0; i--) { if (this.colData[col][i] != GridModel.EMPTY_HINT) { - this.drawHint(g, this.colData[col][i], x, y, - this.completedHints.isColHintComplete(col, i), - (this.rolloverColumn == col)); + this.drawHint(c, this.colData[col][i], x, y, + this.completedHints.isColHintComplete(col, i)); } y += this.topHintsDecal; - } + } } - */ + /** * Draws the left hints. * * @param g the graphics context */ - // FIXME - /* - private void drawLeftHints(Graphics g, int row) { + private void drawLeftHints(Canvas c, int row) { + /* g.drawImage(this.leftHints[row].getBox(), this.leftHints[row].getX(), this.leftHints[row].getY(), null); + */ + c.drawPicture(this.leftHints[row].getBox(), this.leftHints[row].getRect()); - g.setFont(GridUI.HINT_FONT); + //FIXME + //g.setFont(GridUI.HINT_FONT); int y = this.leftHintsY + (row * GridUI.BOX_HEIGHT); int x = 0; for (int j = 0; j < this.rowData[row].length; j++) { if (this.rowData[row][j] != GridModel.EMPTY_HINT) { - this.drawHint(g, this.rowData[row][j], x, y, - this.completedHints.isRowHintComplete(row, j), - (this.rolloverRow == row)); + this.drawHint(c, this.rowData[row][j], x, y, + this.completedHints.isRowHintComplete(row, j)); } x += this.leftHintsDecal; } } - */ + /** * Draws a hint. * @@ -563,35 +671,43 @@ * @param x X coordinate * @param y Y coordinate */ - // FIXME - /* - private void drawHint(Graphics g, int value, int x, int y, - boolean complete, boolean rollover) { - if (!rollover) { + private void drawHint(Canvas c, int value, int x, int y, + boolean complete) { + //GridUI.log.debug("drawHint(c, " + value + ", " + x + ", " + y + ", " + complete + ")"); + + //Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); + Paint paint = GridUI.getHintPaint(); + if (complete) { - g.setColor(GridUI.COMPLETED_HINT_COLOR); + paint.setColor(GridUI.COMPLETED_HINT_COLOR); } else { - g.setColor(GridUI.HINT_TEXT_COLOR); + paint.setColor(GridUI.HINT_TEXT_COLOR); } - } else { - if (complete) { - g.setColor(new Color(255, 122, 0)); - } else { - g.setColor(Color.ORANGE); - } - } - + /* + paint.setTypeface(GridUI.HINT_FONT); + paint.setTextAlign(Paint.Align.CENTER); +paint.setTextSize(10); + */ y += this.centerHintHeight; if (value < 10) { x += this.centerLowHintWidth; - g.drawString(String.valueOf(value), x, y); + c.drawText(String.valueOf(value), x, y, paint); } else { x += this.centerHighHintWidth; - g.drawString(String.valueOf(value), x, y); + c.drawText(String.valueOf(value), x, y, paint); } } - */ + + private static Paint getHintPaint() { + Paint paint = new Paint(/*Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG*/); + paint.setTypeface(GridUI.HINT_FONT); + paint.setTextAlign(Paint.Align.CENTER); + paint.setTextSize(10); + + return paint; + } + /** * This methods tells wether a point is inside the grid or not. * @@ -657,72 +773,6 @@ //this.repaint(this.boxes[column][row].getRect()); } - /** - * Allows to set the current rolled-over box. - * - * @param row row of the box - * @param column column of the box - */ - void setRollover(int row, int column) { - /* - this.rolloverEnded(); - this.rollover = this.boxes[column][row]; - this.repaint(this.rollover.getRect()); - - this.rolloverHighlight(row, column); - */ - } - /** - * Sets the currently highlighted row and column. - * - * @param row row's index to highlight - * @param column column's index to highlight - */ - void rolloverHighlight(int row, int column) { - /* - if ((this.rolloverColumn != column) || (this.rolloverRow != row)) { - this.repaintColHints(this.rolloverColumn); - this.repaintRowHints(this.rolloverRow); - - this.rolloverColumn = column; - this.rolloverRow = row; - - this.repaintColHints(this.rolloverColumn); - this.repaintRowHints(this.rolloverRow); - } - */ - } - /** Indicates that no box is currently rolled over. */ - - void rolloverEnded() { - /* - if (this.rollover != null) { - */ - /* - * Save the old rolled-over box so we can draw it - * in its initial state - */ - /* - Rectangle rect = this.rollover.getRect(); - - this.rollover = null; - this.repaint(rect); - } - - this.highlightEnded(); - */ - } - - /** Ends the highlight. */ - void highlightEnded() { - /* - this.repaintColHints(this.rolloverColumn); - this.repaintRowHints(this.rolloverRow); - - this.rolloverColumn = -1; - this.rolloverRow = -1; - */ - } /** Repaints top hints. */ void repaintColHints(int col) { // FIXME @@ -750,4 +800,22 @@ public void updateBox(int row, int col, Box box) { this.boxes[row][col].updateState(box); } + + private static class Line2D { + private int x1; + private int y1; + private int x2; + private int y2; + + private Line2D(int x1, int y1, int x2, int y2) { + this.x1 = x1; + this.y1 = y1; + this.x2 = x2; + this.y2 = y2; + } + + private float[] getPoints() { + return new float[] {this.x1, this.y1, this.x2, this.y2}; + } + } } Modified: branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-15 14:25:07 UTC (rev 119) @@ -33,6 +33,10 @@ package picross.specific.grid.ui; +import android.graphics.Rect; +import android.graphics.Canvas; +import android.graphics.Picture; + /** * Informations about a hint box. * @@ -42,10 +46,11 @@ /*** Field ***/ /** The rectangle taken by the box. */ - //private Rectangle rect = null; + private Rect rect = null; /** Pre-rendered image of the box. */ //private BufferedImage box = null; + private Picture box = null; /*** Methods ***/ @@ -55,8 +60,7 @@ * @param rectangle the rectangle to test * @return boolean indicating wether the two rectangles intersect * with each other - *//* - boolean intersects(Rectangle rectangle) { + *//* boolean intersects(Rectangle rectangle) { return this.rect.intersects(rectangle); }*/ @@ -65,46 +69,47 @@ * to the box. * * @return graphical object corresponding to the box - *//* - Graphics2D createBoxGraphics() { - return this.box.createGraphics(); - }*/ - + */ + /* + Canvas createBoxGraphics() { + return new Canvas(this.box); + } + */ /** * Returns the rectangle's width. * * @return width of the box's rectangle - *//* + */ int getWidth() { - return this.rect.width; - }*/ + return this.rect.width(); + } /** * Returns the rectangle's height. * * @return height of the box's rectangle - *//* + */ int getHeight() { - return this.rect.height; - }*/ + return this.rect.height(); + } /** * Return the rectangle's X coordinate. * * @return X coordinate for the rectangle - *//* + */ int getX() { - return this.rect.x; - }*/ + return this.rect.left; + } /** * Return the rectangle's Y coordinate. * * @return Y coordinate for the rectangle - *//* + */ int getY() { - return this.rect.y; - }*/ + return this.rect.top; + } /*** Accessors ***/ @@ -112,36 +117,36 @@ * Sets the rectangle occupied by the box. * * @param newRect the box's rectangle - *//* - void setRect(Rectangle newRect) { + */ + void setRect(Rect newRect) { this.rect = newRect; - }*/ + } /** * Sets the box's image. * * @param newBox pre-rendered image of the box - *//* - void setBox(BufferedImage newBox) { + */ + void setBox(Picture newBox) { this.box = newBox; - }*/ + } /** * Return the box. * * @return the rectangle occupied by the box - *//* - Rectangle getRect() { + */ + Rect getRect() { return this.rect; - }*/ + } /** * Return the box's image. * * @return pre-rendered image of the box - *//* - BufferedImage getBox() { + */ + Picture getBox() { return this.box; - }*/ + } } Modified: branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -111,9 +111,12 @@ if (cmd.equals(LevelMenuController.LEVEL_CMD)) { String level = e.getComment(); + /* this.fireEventPerformed(new GameCommand(new SimpleGameMediator(level))); + */ + this.fireEventPerformed(this.newSimpleGameCommand(level)); return; } @@ -126,6 +129,12 @@ super.eventPerformed(e); } + protected GameCommand newSimpleGameCommand(String selectedLevel) { + return new + GameCommand(new + SimpleGameMediator(selectedLevel)); + } + /*** Method ***/ /** Modified: branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -81,11 +81,23 @@ * @param data grid content * @throws PicrossException if there is a probleme while building the view */ - public AbstractGridMediator(final int width, final int height, boolean[][] data) + public AbstractGridMediator(int width, int height, boolean[][] data) throws PicrossException { + this(width, height, data, true); + } + + public AbstractGridMediator(int width, int height, boolean[][] data, boolean doInit) + throws PicrossException { + this.model = new GridModel(/*this, */data); + if (doInit) { + this.doInit(width, height); + } + } + + protected void doInit(final int width, final int height) throws PicrossException { final GridController controller = new GridController(); controller.addSimpleListener(this); this.addSimpleListener(controller); @@ -117,7 +129,8 @@ controller.setView(this.view); } - protected void initGrid(int width, int height, UIBox[][] boxes, int[][] colData, int[][] rowData, CompletedHints hints, GridController controller) { + protected abstract void initGrid(int width, int height, UIBox[][] boxes, int[][] colData, int[][] rowData, CompletedHints hints, GridController controller); + /* this.view = new GridUI(width, height, boxes, colData, @@ -125,6 +138,7 @@ hints, controller); } + */ /*** Method overloaded from the class Mediateur ***/ Modified: branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -46,11 +46,13 @@ /*** Method overriden from MenuMediator ***/ /** {@inheritDoc} */ + /* @Override protected MenuUI initView(PicrossUI ui, MenuController controller) throws PicrossException { return new WaitMenuUI(); } + */ } Modified: branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -35,4 +35,4 @@ import picross.common.ui.AbstractWaitMenuMediator; -public final class WaitMenuMediator extends AbstractWaitMenuMediator { } +public abstract class WaitMenuMediator extends AbstractWaitMenuMediator { } Modified: branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java =================================================================== --- branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java 2013-01-15 09:23:58 UTC (rev 118) +++ branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java 2013-01-15 14:25:07 UTC (rev 119) @@ -35,4 +35,18 @@ import picross.common.ui.AbstractWaitMenuMediator; -public final class WaitMenuMediator extends AbstractWaitMenuMediator { } +import picross.engine.PicrossException; + +import picross.specific.ui.MenuController; +import picross.specific.ui.MenuUI; +import picross.specific.ui.WaitMenuUI; +import picross.common.ui.PicrossUI; + +public final class WaitMenuMediator extends AbstractWaitMenuMediator { + @Override + protected MenuUI initView(PicrossUI ui, MenuController controller) + throws PicrossException { + + return new WaitMenuUI(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-15 09:24:03
|
Revision: 118 http://sourceforge.net/p/picross/code/118 Author: yvan_norsa Date: 2013-01-15 09:23:58 +0000 (Tue, 15 Jan 2013) Log Message: ----------- draw the grid Modified Paths: -------------- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java branches/engine_split/android/src/picross/specific/game/ui/GameUI.java branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java branches/engine_split/android/src/picross/specific/ui/PicrossUIHelper.java branches/engine_split/build.xml branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java Added Paths: ----------- branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java Removed Paths: ------------- branches/engine_split/android/src/picross/specific/ui/PicrossAndroidView.java Modified: branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-15 09:23:58 UTC (rev 118) @@ -66,7 +66,7 @@ @Override public void setContent(PicrossView content) { PicrossLogHelper.getLogger().debug("setContent(" + content + ")"); - this.activity.setContentView((picross.specific.ui.PicrossAndroidView) content); + this.activity.setContentView((picross.specific.ui.AbstractAndroidView) content); } /** {@inheritDoc} */ Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-15 09:23:58 UTC (rev 118) @@ -37,7 +37,6 @@ import picross.engine.game.random.RandomPicrossModel; -import picross.specific.game.ui.GameController; import picross.specific.game.ui.GameMediator; import picross.specific.game.ui.GameUI; @@ -49,6 +48,8 @@ import android.content.Context; +import picross.specific.game.ui.GameController; + /** * This object handles a random grid game. * @@ -63,8 +64,10 @@ /** {@inheritDoc} */ @Override + //p//r//otected GameUI initView(int width, int height, GridView gridView, + // MenuController controller) { protected GameUI initView(int width, int height, GridView gridView, - MenuController controller) { + MenuController controller) { return new RandomGameUI(this.context, width, height, gridView, controller); } @@ -87,7 +90,7 @@ public void eventPerformed(SimpleEvent e) { String cmd = e.getCommandName(); if (cmd.equals(RandomGameController.NEXT_CMD)) { - this.fireEventPerformed(RandomGameModeUI.getRandomGameCommand()); + this.fireEventPerformed(RandomGameModeUI.getRandomGameCommand(this.context)); return; } Modified: branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-15 09:23:58 UTC (rev 118) @@ -114,7 +114,11 @@ controller.addSimpleListener(this); // The view has to be init'ed on the EDT - this.view = this.initView(width, height, this.grid.getView(), controller); + //new Thread() { + // public void run() { + GameMediator.this.view = GameMediator.this.initView(width, height, GameMediator.this.grid.getView(), controller); + // } + //}.start(); } /** Modified: branches/engine_split/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-15 09:23:58 UTC (rev 118) @@ -46,17 +46,19 @@ import android.content.Context; import picross.specific.ui.MenuController; -import picross.specific.ui.PicrossAndroidView; +import picross.specific.ui.AbstractAndroidView; +import android.graphics.Canvas; + /** * The game UI. * * @author Y. Norsa */ // FIXME -public class GameUI extends PicrossAndroidView +public class GameUI extends AbstractAndroidView /*extends JPanel*/ -implements GameView { + implements GameView { /*** Constant ***/ @@ -65,7 +67,7 @@ /** Panel holding the buttons. */ //private JPanel buttonsPanel; - private Context context; + private GridView grid; /*** Constructor ***/ @@ -78,11 +80,14 @@ * @param listener listener for the buttons */ //public GameUI(int width, int height, JPanel grid, - public GameUI(Context context, int width, int height, GridView grid, + public GameUI(Context context, int width, int height, GridView gridView, MenuController listener) { super(context); - this.context = context; + this.grid = gridView; + + picross.specific.grid.ui.UIBox.staticInit(context.getResources()); + // FIXME /* this.setLayout(new BorderLayout()); @@ -125,6 +130,16 @@ */ } + @Override + public void onDraw(Canvas canvas) { + if (canvas == null) { + return; + } + + //GameUI.log.debug("onDraw(" + canvas + ")"); + ((picross.specific.grid.ui.GridUI) this.grid).draw(canvas); + } + /*** Method ***/ /** Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-15 09:23:58 UTC (rev 118) @@ -39,6 +39,8 @@ import picross.engine.PicrossException; +import picross.engine.grid.CompletedHints; + /** * Picross grid mediator. * @@ -52,5 +54,19 @@ this.context = context; } + + @Override + protected void initGrid(final int width, final int height, final UIBox[][] boxes, final int[][] colData, final int[][] rowData, final CompletedHints hints, final GridController controller) { + //new Thread() { + // public void run() { + GridMediator.this.view = new GridUI(width, height, + boxes, + colData, + rowData, + hints, + controller); + // } + // }.start(); + } } Modified: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-15 09:23:58 UTC (rev 118) @@ -46,6 +46,9 @@ import picross.engine.grid.CompletedHints; import picross.engine.grid.GridModel; +import android.graphics.Canvas; +import android.graphics.Rect; + /** * Grid UI. * @@ -227,15 +230,8 @@ /*** Method overloaded from JPanel ***/ - /** {@inheritDoc} */ - // FIXME - /* - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - - Graphics2D newG = (Graphics2D) g.create(); - + public void draw(Canvas c) { + /* Rectangle clipRect = newG.getClipBounds(); for (int i = 0; i < this.topHints.length; i++) { @@ -249,36 +245,30 @@ this.drawLeftHints(newG, i); } } - + */ // Paints the boxes for (int i = 0; i < this.width; i++) { for (int j = 0; j < this.height; j++) { - Rectangle currentRect = this.boxes[i][j].getRect(); + Rect currentRect = this.boxes[i][j].getRect(); - if (currentRect.intersects(clipRect)) { - if (this.boxes[i][j] == this.rollover) { - this.boxes[i][j].getRolloverIcon() - .paintIcon(this, newG, - currentRect.x, currentRect.y); - } else { - this.boxes[i][j].getIcon().paintIcon(this, newG, - currentRect.x, - currentRect.y); - } - } + //if (currentRect.intersects(clipRect)) { + c.drawBitmap(this.boxes[i][j].getIcon(), + currentRect.left, + currentRect.top, null); + //} } } // Draws the blocks + /* newG.setColor(GridUI.BLOCKS_COLOR); for (Line2D line : this.blocksLines) { newG.draw(line); } + */ + } - newG.dispose(); - } - */ /*** Methods ***/ /** @@ -368,16 +358,13 @@ * so we'll be able * to redraw only what is needed */ - // FIXME - /* this.boxes[i][j] - .setRect(new Rectangle(this.leftBoundary + .setRect(new Rect(this.leftBoundary + (i * GridUI.BOX_WIDTH), this.topBoundary + (j * GridUI.BOX_WIDTH), GridUI.BOX_WIDTH, GridUI.BOX_HEIGHT)); - */ } } Modified: branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java 2013-01-15 09:23:58 UTC (rev 118) @@ -43,6 +43,12 @@ import picross.engine.grid.Box.BoxState; import picross.common.ui.MissingImageException; + +import android.graphics.Bitmap; +import android.graphics.Rect; + +import picross.specific.activities.R; +import android.content.res.Resources; import picross.specific.ui.PicrossUIHelper; /** @@ -54,56 +60,51 @@ /*** Constants ***/ /** Index of the normal icon. */ - private static final int ICON_INDEX = 0; + //private static final int ICON_INDEX = 0; - /** Index of the rollover icon. */ - private static final int ROLLOVER_ICON_INDEX = 1; - - /** Suffix for rollover icons. */ - private static final String ROLLOVER_NAME = "-rollover"; - /** Images files extension. */ private static final String IMAGES_EXT = ".png"; /*** Static field ***/ /** Map containing the images corresponding to the different states. */ - //private static Map<BoxState, ImageIcon[]> images; + private static Map<BoxState, Bitmap> images; /*** Field ***/ /** Rectangle occupied by the box. */ //private Rectangle rect; + private Rect rect; /*** Static block ***/ - static { + //static { + public static void staticInit(Resources res) { // Fills in the images map /* * We create a too large HashMap so it doesn't grow * during its initialisation */ - //UIBox.images = new HashMap<BoxState, ImageIcon[]>(7); + UIBox.images = new HashMap<BoxState, Bitmap>(4); - //try { + try { + /* for (BoxState state : BoxState.values()) { - /* - ImageIcon[] img = new ImageIcon[2]; + ImageIcon[] img = new ImageIcon[1]; String stateImageName = state.toString().toLowerCase(); img[UIBox.ICON_INDEX] = PicrossUIHelper.getImage(stateImageName + UIBox.IMAGES_EXT); - img[UIBox.ROLLOVER_ICON_INDEX] = - PicrossUIHelper.getImage(stateImageName + UIBox.ROLLOVER_NAME - + UIBox.IMAGES_EXT); - UIBox.images.put(state, img); + } */ - } - /* + + UIBox.images.put(BoxState.EMPTY, PicrossUIHelper.getImage(res, R.drawable.empty)); + UIBox.images.put(BoxState.CHECKED, PicrossUIHelper.getImage(res, R.drawable.checked)); + UIBox.images.put(BoxState.CROSSED, PicrossUIHelper.getImage(res, R.drawable.crossed)); } catch (MissingImageException imageEx) { throw new ExceptionInInitializerError(imageEx); - }*/ + } } private UIBox(BoxState boxState, int hashCode) { @@ -145,16 +146,11 @@ return UIBox.images.get(this.state)[UIBox.ICON_INDEX]; } */ - /** - * Returns the rollover icon representing the current state of the box. - * - * @return rollover icon of the state of the box - */ - /* - ImageIcon getRolloverIcon() { - return UIBox.images.get(this.state)[UIBox.ROLLOVER_ICON_INDEX]; - }*/ + Bitmap getIcon() { + return UIBox.images.get(this.state); + } + /*** Accessors ***/ /** @@ -164,23 +160,21 @@ * @throws IllegalArgumentException if <code>rect</code> * is <code>null</code> */ - /* - void setRect(Rectangle rect) throws IllegalArgumentException { + void setRect(Rect rect) throws IllegalArgumentException { if (rect == null) { throw new IllegalArgumentException("rect cannot be null"); } this.rect = rect; - }*/ + } /** * Returns this box' rectangle. * * @return rectangle occupied by this box */ - /* - Rectangle getRect() { + Rect getRect() { return this.rect; - }*/ + } } Copied: branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java (from rev 115, branches/engine_split/android/src/picross/specific/ui/PicrossAndroidView.java) =================================================================== --- branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java (rev 0) +++ branches/engine_split/android/src/picross/specific/ui/AbstractAndroidView.java 2013-01-15 09:23:58 UTC (rev 118) @@ -0,0 +1,90 @@ +/* + * $Id$ + */ + + +package picross.specific.ui; + +import android.content.Context; + +import android.graphics.Canvas; + +import android.view.SurfaceView; +import android.view.SurfaceHolder; + +import picross.common.ui.PicrossView; + +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + +public abstract class AbstractAndroidView extends SurfaceView implements PicrossView, SurfaceHolder.Callback, Runnable { + protected static PicrossLogger log = PicrossLogHelper.getLogger(); + + private SurfaceHolder surface; + private boolean running; + protected Context context; + + public AbstractAndroidView(Context androidContext) { + super(androidContext); + + AbstractAndroidView.log.debug("AbstractAndroidView(" + androidContext + ")"); + + this.context = androidContext; + this.surface = this.getHolder(); + this.surface.addCallback(this); + } + + @Override + public final void surfaceCreated(SurfaceHolder holder) { + AbstractAndroidView.log.debug("surfaceCreated()"); + this.setRunning(true); + + Thread thread = new Thread(this); + thread.start(); + } + + @Override + public final void surfaceChanged(SurfaceHolder holder, int format, int width, + int height) { + AbstractAndroidView.log.debug("surfaceChanged"); + } + + private final void setRunning(boolean run) { + this.running = run; + } + + @Override + public void surfaceDestroyed(SurfaceHolder holder) { + AbstractAndroidView.log.debug("surfaceDestroyed"); + + this.setRunning(false); + } + + @Override + public final void run() { + AbstractAndroidView.log.debug("run()"); + + Canvas c; + + while (this.running) { + c = null; + try { + + c = this.surface.lockCanvas(null); + + synchronized (this.surface) { + this.onDraw(c); + } + } finally { + // do this in a finally so that if an exception is thrown + // during the above, we don't leave the Surface in an + // inconsistent state + if (c != null) { + this.surface.unlockCanvasAndPost(c); + } + } + } + } + + public abstract void onDraw(Canvas canvas); +} Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-15 09:23:58 UTC (rev 118) @@ -70,7 +70,7 @@ * * @author Y. Norsa */ -public abstract class MenuUI extends PicrossAndroidView implements SurfaceHolder.Callback, Runnable { +public abstract class MenuUI extends AbstractAndroidView { /*** Constants ***/ /** Background image. */ @@ -88,15 +88,15 @@ /*** Static field ***/ /** This class' logger. */ - private static PicrossLogger log = PicrossLogHelper.getLogger(); + //private static PicrossLogger log = PicrossLogHelper.getLogger(); /*** Field ***/ /** Background image. */ private Bitmap image; - protected Context context; - private SurfaceHolder surface; + //protected Context context; + //private SurfaceHolder surface; private List<PicrossLabel> buttons; @@ -109,7 +109,7 @@ MenuUI.log.debug("MenuUI(" + context + ")"); - this.context = context; + //this.context = context; Resources res = context.getResources(); @@ -117,66 +117,13 @@ MenuUI.log.debug("this.image: " + this.image); - this.surface = this.getHolder(); - this.surface.addCallback(this); + //this.surface = this.getHolder(); + //this.surface.addCallback(this); this.buttons = new ArrayList<PicrossLabel>(); } - @Override - public void surfaceCreated(SurfaceHolder holder) { - MenuUI.log.debug("surfaceCreated()"); - this.setRunning(true); - - Thread thread = new Thread(this); - thread.start(); - } - - @Override - public void surfaceChanged(SurfaceHolder holder, int format, int width, - int height) { - MenuUI.log.debug("surfaceChanged"); - } - - private boolean running; - - private void setRunning(boolean run) { - this.running = run; - } - - @Override - public void surfaceDestroyed(SurfaceHolder holder) { - MenuUI.log.debug("surfaceDestroyed"); - - boolean retry = true; - this.setRunning(false); - } - - @Override - public void run() { - MenuUI.log.debug("run()"); - - Canvas c; - while (this.running) { - c = null; - try { - c = surface.lockCanvas(null); - synchronized (surface) { - onDraw(c); - - } - } finally { - // do this in a finally so that if an exception is thrown - // during the above, we don't leave the Surface in an - // inconsistent state - if (c != null) { - surface.unlockCanvasAndPost(c); - } - } - } - } - public void onDraw(Canvas canvas) { //MenuUI.log.debug("onDraw(" + canvas + ")"); Deleted: branches/engine_split/android/src/picross/specific/ui/PicrossAndroidView.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossAndroidView.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/ui/PicrossAndroidView.java 2013-01-15 09:23:58 UTC (rev 118) @@ -1,20 +0,0 @@ -/* - * $Id$ - */ - - -package picross.specific.ui; - -import android.content.Context; - -import android.view.SurfaceView; - -import picross.common.ui.PicrossView; - -public class PicrossAndroidView extends SurfaceView implements PicrossView { - public PicrossAndroidView(Context context) { - super(context); - - picross.engine.PicrossLogHelper.getLogger().debug("PicrossAndroidView(" + context + ")"); - } -} Modified: branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java 2013-01-15 09:23:58 UTC (rev 118) @@ -97,6 +97,34 @@ protected void gameLoaded(final GameMediator game) { this.view.displayMessage("TODO gameLoaded()"); game.addSimpleListener(this); - this.view.setContent(game.getView()); + + //new Thread() { + // public void run() { + PicrossMediator.this.view.setContent(game.getView()); + // } + //}.start(); } + + /** + * Method launching a game. + * + * @param game game the launch + */ +@Override + protected void startGame(final GameMediator game) { + //Thread worker = new Thread() { + // public void run() { + try { + game.init(); + /*AbstractPicrossMediator.*/this.gameLoaded(game); + } catch (PicrossException picrossEx) { + /*AbstractPicrossMediator.*/this.view + .displayError(picrossEx.getMessage()); + return; + } + // } + // }; + + // worker.start(); + } } Modified: branches/engine_split/android/src/picross/specific/ui/PicrossUIHelper.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossUIHelper.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/android/src/picross/specific/ui/PicrossUIHelper.java 2013-01-15 09:23:58 UTC (rev 118) @@ -73,7 +73,7 @@ /*** Static methods ***/ - static Bitmap getImage(Resources res, int id) { + public static Bitmap getImage(Resources res, int id) { return BitmapFactory.decodeResource(res, id); } Modified: branches/engine_split/build.xml =================================================================== --- branches/engine_split/build.xml 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/build.xml 2013-01-15 09:23:58 UTC (rev 118) @@ -363,6 +363,10 @@ defaultexcludes="no" includes="**/*~" /> </delete> + + <ant antfile="build.xml" + dir="${android.dir}" + target="clean" /> </target> <target name="rebuild" Modified: branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-14 13:23:53 UTC (rev 117) +++ branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-15 09:23:58 UTC (rev 118) @@ -217,7 +217,7 @@ * * @param game game the launch */ - private void startGame(final GameMediator game) { + protected void startGame(final GameMediator game) { Thread worker = new Thread() { public void run() { try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-14 13:23:57
|
Revision: 117 http://sourceforge.net/p/picross/code/117 Author: yvan_norsa Date: 2013-01-14 13:23:53 +0000 (Mon, 14 Jan 2013) Log Message: ----------- more android version Modified Paths: -------------- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java branches/engine_split/android/src/picross/specific/game/ui/GameUI.java branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java branches/engine_split/android/src/picross/specific/ui/GameMenuUI.java branches/engine_split/android/src/picross/specific/ui/PicrossMediator.java branches/engine_split/swing/src/picross/specific/grid/ui/GridController.java branches/engine_split/swing/src/picross/specific/grid/ui/GridMediator.java branches/engine_split/swing/src/picross/specific/grid/ui/GridUI.java branches/engine_split/swing/src/picross/specific/grid/ui/UIBox.java Added Paths: ----------- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java branches/engine_split/android/src/picross/specific/game/ui/GameController.java branches/engine_split/android/src/picross/specific/grid/ branches/engine_split/android/src/picross/specific/grid/ui/ branches/engine_split/android/src/picross/specific/grid/ui/GridController.java branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java branches/engine_split/android/src/picross/specific/grid/ui/UIBox.java branches/engine_split/common/src/picross/common/grid/ui/AbstractGridMediator.java branches/engine_split/common/src/picross/specific/grid/ branches/engine_split/common/src/picross/specific/grid/ui/ branches/engine_split/common/src/picross/specific/grid/ui/GridController.java branches/engine_split/common/src/picross/specific/grid/ui/GridUI.java branches/engine_split/common/src/picross/specific/grid/ui/UIBox.java Modified: branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/activities/PicrossActivityUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -73,10 +73,14 @@ @Override public void displayMessage(String msg) { PicrossLogHelper.getLogger().debug("displayMessage(" + msg + ")"); + + // FIXME + /* AlertDialog.Builder builder = new AlertDialog.Builder(this.activity); builder.setMessage(msg) .setTitle("Picross"); AlertDialog dialog = builder.create(); + */ } /** {@inheritDoc} */ Added: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java (rev 0) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.game.random.ui; + +import picross.specific.game.ui.GameController; + +/** + * Controller for the random game UI. + * + * @author Y. Norsa + */ +final class RandomGameController extends GameController { + /*** Constant ***/ + + /** Command asking to create another grid. */ + static final String NEXT_CMD = "NEXT_CMD"; + + /** Random game command. */ + static final String RANDOM_GAME_CMD = "RANDOM_GAME_CMD"; + + /*** Method overloaded from the class Controller ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void actionPerformed(ActionEvent e) { + String cmd = e.getActionCommand(); + + if (cmd.equals(RandomGameController.NEXT_CMD)) { + this.fireEventPerformed(cmd); + + return; + } + + super.actionPerformed(e); + } + */ +} Property changes on: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameController.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameMediator.java 2013-01-14 13:23:53 UTC (rev 117) @@ -37,7 +37,7 @@ import picross.engine.game.random.RandomPicrossModel; -//import picross.specific.game.ui.GameController; +import picross.specific.game.ui.GameController; import picross.specific.game.ui.GameMediator; import picross.specific.game.ui.GameUI; @@ -47,52 +47,51 @@ import picross.specific.ui.MenuController; +import android.content.Context; + /** * This object handles a random grid game. * * @author Y. Norsa */ public final class RandomGameMediator extends GameMediator { + public RandomGameMediator(Context context) { + super(context); + } + /*** Methods overloaded from the class GameMediator ***/ /** {@inheritDoc} */ - /* @Override protected GameUI initView(int width, int height, GridView gridView, MenuController controller) { - return new RandomGameUI(width, height, gridView, + return new RandomGameUI(this.context, width, height, gridView, controller); } - */ + /** {@inheritDoc} */ - // FIXME - /* @Override protected GameController initController() { return new RandomGameController(); } - */ + /** {@inheritDoc} */ @Override protected PicrossGrid initModel() { - // FIXME - //return new RandomPicrossModel(); - return null; + return new RandomPicrossModel(); } /** {@inheritDoc} */ @Override public void eventPerformed(SimpleEvent e) { String cmd = e.getCommandName(); - // FIXME - /* if (cmd.equals(RandomGameController.NEXT_CMD)) { this.fireEventPerformed(RandomGameModeUI.getRandomGameCommand()); return; } - */ + // We want to relay other events, such as GRID_FILLED_CMD super.eventPerformed(e); } Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameModeUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -47,6 +47,8 @@ import picross.specific.activities.R; +import android.content.Context; + /** * Random game mode. * @@ -73,8 +75,8 @@ * * @return a game command for a new random grid */ - public static GameCommand getRandomGameCommand() { - return new GameCommand(new RandomGameMediator()); + public static GameCommand getRandomGameCommand(Context context) { + return new GameCommand(new RandomGameMediator(context)); } /*** Method implanted from the interface GameMode ***/ @@ -82,9 +84,9 @@ /** {@inheritDoc} */ @Override //public SimpleButton<JButton> getButton() { - public PicrossButton getButton() { + public PicrossButton getButton(Context context) { SimpleEvent event = - new SimpleEvent(RandomGameModeUI.getRandomGameCommand()); + new SimpleEvent(RandomGameModeUI.getRandomGameCommand(context)); // FIXME /* ImageIcon icon = Modified: branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/random/ui/RandomGameUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -41,6 +41,8 @@ import picross.specific.ui.MenuController; +import android.content.Context; + /** * Custom UI for a random game. * @@ -62,9 +64,9 @@ * @param grid the grid * @param controller the UI controller */ - RandomGameUI(int width, int height, GridView grid, + RandomGameUI(Context context, int width, int height, GridView grid, MenuController controller) { - super(width, height, grid, controller); + super(context, width, height, grid, controller); // FIXME /* Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/SimpleGameModeUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -50,6 +50,8 @@ import picross.specific.activities.R; +import android.content.Context; + /** * Simple game mode. * @@ -74,7 +76,7 @@ /** {@inheritDoc} */ @Override //public SimpleButton<JButton> getButton() { - public PicrossButton getButton() { + public PicrossButton getButton(Context context) { //ImageIcon icon = //PicrossUIHelper.getLocalizedImage(SimpleGameModeUI.SELECT_BUTTON_IMAGE); SimpleEvent event = Added: branches/engine_split/android/src/picross/specific/game/ui/GameController.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameController.java (rev 0) +++ branches/engine_split/android/src/picross/specific/game/ui/GameController.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,81 @@ +/* + * $Id$ + * + * Copyright (c) 2008-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.game.ui; + +import fr.cle.mmvcs.Controller; +import fr.cle.mmvcs.SimpleEvent; + +import picross.engine.PicrossLogger; +import picross.engine.PicrossLogHelper; + +import picross.common.ui.PicrossController; + +import picross.specific.ui.MenuController; + +/** + * Controller for the game. + * + * @author Y. Norsa + */ +public class GameController extends MenuController {//implements ActionListener { + /*** Static field ***/ + + /** The class' logger. */ + private static PicrossLogger log = PicrossLogHelper.getLogger(); + + /*** Method overloaded from the class Controller ***/ + + /** {@inheritDoc} */ + @Override + public void eventPerformed(SimpleEvent e) { } + + /*** Method implanted from the interface ActionListener ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void actionPerformed(ActionEvent e) { + GameController.log.debug("actionPerformed(" + e + ")"); + + String cmd = e.getActionCommand(); + + if (cmd.equals(PicrossController.QUIT_CMD)) { + this.fireEventPerformed(cmd); + return; + } + } + */ +} + Property changes on: branches/engine_split/android/src/picross/specific/game/ui/GameController.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/ui/GameMediator.java 2013-01-14 13:23:53 UTC (rev 117) @@ -42,12 +42,16 @@ import picross.engine.grid.PicrossGrid; -//import picross.specific.grid.ui.GridMediator; +import picross.specific.grid.ui.GridMediator; import picross.common.grid.ui.GridView; import picross.common.grid.ui.IGridMediator; import picross.common.game.ui.GameView; +import android.content.Context; + +import picross.specific.ui.MenuController; + public abstract class GameMediator extends Mediateur { /*** Static field ***/ @@ -57,13 +61,19 @@ /*** Fields ***/ /** The game view. */ - //private GameUI view; + private GameUI view; /** The game grid. */ private IGridMediator grid; - /*** Abstrac method ***/ + protected Context context; + public GameMediator(Context androidContext) { + this.context = androidContext; + } + + /*** Abstract method ***/ + /** * Creates the model. * @@ -77,7 +87,7 @@ /** {@inheritDoc} */ @Override public void eventPerformed(SimpleEvent e) { - //GameMediator.log.debug("eventPerformed(" + e + ")"); + GameMediator.log.debug("eventPerformed(" + e + ")"); this.fireEventPerformed(e); } @@ -95,19 +105,16 @@ final int width = model.getWidth(); final int height = model.getHeight(); - /* - this.grid = new GridMediator(width, height, + + this.grid = new GridMediator(this.context, width, height, model.getData()); - */ - // FIXME - //this.grid.addSimpleListener(this); + this.grid.addSimpleListener(this); - //final GameController controller = this.initController(); - // FIXME - //controller.addSimpleListener(this); + final GameController controller = this.initController(); + controller.addSimpleListener(this); // The view has to be init'ed on the EDT - //this.view = this.initView(width, height, this.grid.getView(), controller); + this.view = this.initView(width, height, this.grid.getView(), controller); } /** @@ -119,28 +126,27 @@ * @param controller controller for the grid buttons * @return view containing the grid */ - /* protected GameUI initView(int width, int height, GridView gridView, - ActionListener controller) { - return new GameUI(width, height, gridView, controller); + MenuController controller) { + return new GameUI(this.context, width, height, gridView, controller); } -*/ + /** * Initialises the controller. * * @return the created controller */ - /* + protected GameController initController() { return new GameController(); } - */ + /** * Returns the game view. * * @return the view */ - /* public final GameView getView() { + public final GameView getView() { return this.view; - }*/ } +} Modified: branches/engine_split/android/src/picross/specific/game/ui/GameUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/ui/GameUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -41,9 +41,12 @@ import picross.common.game.ui.GameView; +import picross.specific.ui.PicrossButton; +import android.content.Context; + import picross.specific.ui.MenuController; -import picross.specific.ui.PicrossButton; +import picross.specific.ui.PicrossAndroidView; /** * The game UI. @@ -51,17 +54,19 @@ * @author Y. Norsa */ // FIXME -public class GameUI /*extends JPanel*/ implements GameView { +public class GameUI extends PicrossAndroidView +/*extends JPanel*/ +implements GameView { /*** Constant ***/ - /** Serialisation ID. */ - private static final long serialVersionUID = 5888877041010228476L; /*** Field ***/ /** Panel holding the buttons. */ //private JPanel buttonsPanel; + private Context context; + /*** Constructor ***/ /** @@ -73,9 +78,11 @@ * @param listener listener for the buttons */ //public GameUI(int width, int height, JPanel grid, - public GameUI(int width, int height, GridView grid, + public GameUI(Context context, int width, int height, GridView grid, MenuController listener) { - super(); + super(context); + + this.context = context; // FIXME /* this.setLayout(new BorderLayout()); Modified: branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-14 10:48:50 UTC (rev 116) +++ branches/engine_split/android/src/picross/specific/game/ui/UIGameMode.java 2013-01-14 13:23:53 UTC (rev 117) @@ -41,6 +41,8 @@ import picross.specific.ui.PicrossButton; +import android.content.Context; + /** * Service describing a game mode. * @@ -53,6 +55,6 @@ * @return a button that can be added to a menu */ //SimpleButton<JButton> getButton(); - PicrossButton getButton(); + PicrossButton getButton(Context context); } Added: branches/engine_split/android/src/picross/specific/grid/ui/GridController.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridController.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridController.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,245 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.grid.ui; + +import fr.cle.mmvcs.Controller; +import fr.cle.mmvcs.SimpleEvent; + +import picross.common.grid.ui.FillCommand; +import picross.common.grid.ui.PaintCommand; +import picross.common.grid.ui.RepaintLeftHintsCommand; +import picross.common.grid.ui.RepaintTopHintsCommand; + +import picross.engine.grid.GridAction; + +import picross.common.grid.ui.GridCommands; + +/** + * Grid controller. + * + * @author Y. Norsa + */ +public final class GridController extends Controller + // FIXME +{//implements MouseListener, MouseMotionListener { + + /*** Fields ***/ + + /** The view to which the controller is attached. */ + private GridUI view = null; + + /** Indicates wether the erase mode is "on" or not. */ + private boolean eraseMode; + + /*** Method overloaded from the class Controller ***/ + + /** {@inheritDoc} */ + @Override + public void eventPerformed(SimpleEvent e) { + String cmd = e.getCommandName(); + + if (cmd.equals(GridCommands.GRID_FILLED_CMD)) { + this.view.rolloverEnded(); + this.view.disableGrid(); + + return; + } + + if (cmd.equals(GridCommands.PAINT_CMD)) { + PaintCommand command = (PaintCommand) e.getCommand(); + this.view.repaint(command.getRow(), command.getColumn()); + + return; + } + + if (cmd.equals(GridCommands.REPAINT_TOP_HINTS_CMD)) { + int col = ((RepaintTopHintsCommand) e.getCommand()).getColumn(); + this.view.repaintColHints(col); + + return; + } + + if (cmd.equals(GridCommands.REPAINT_LEFT_HINTS_CMD)) { + int row = ((RepaintLeftHintsCommand) e.getCommand()).getRow(); + this.view.repaintRowHints(row); + + return; + } + + if (cmd.equals(GridCommands.ERASE_MODE_CMD)) { + this.eraseMode = true; + return; + } + } + + /*** Methods implanted from the interface MouseListener ***/ + + /** {@inheritDoc} */ + /* + @Override + public void mouseClicked(MouseEvent e) { } + */ + /** {@inheritDoc} */ + /* + @Override + public void mouseEntered(MouseEvent e) { } + */ + /** {@inheritDoc} */ + /* + @Override + public void mouseExited(MouseEvent e) { + this.view.rolloverEnded(); + this.view.highlightEnded(); + } + */ + /** {@inheritDoc} */ + /* + @Override + public void mousePressed(MouseEvent e) { + this.view.rolloverEnded(); + } + */ + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void mouseReleased(MouseEvent e) { + this.checkAndFill(e); + this.eraseMode = false; + this.fireEventPerformed(GridCommands.END_ACTION_CMD); + } + */ + /*** Methods implanted from the interface MouseMotionListener ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void mouseDragged(MouseEvent e) { + this.checkAndFill(e); + } + */ + /** {@inheritDoc} */ + // FIXME + /* + @Override + public void mouseMoved(MouseEvent e) { + Point point = e.getPoint(); + + if (this.view.isInGrid(point)) { + int row = this.view.getRow(point); + int column = this.view.getColumn(point); + + this.view.setRollover(row, column); + } else { + this.view.rolloverEnded(); + } + } + */ + /*** Methods ***/ + + /** + * Checks if the mouse current click's location is inside the grid + * and eventually fills the corresponding box. + * + * @param e mouse event to handle + */ + + // FIXME + /* + private void checkAndFill(MouseEvent e) { + int modifiers = e.getModifiers(); + + if (modifiers != MouseEvent.BUTTON1_MASK + && modifiers != MouseEvent.BUTTON3_MASK) { + + return; + } + + Point point = e.getPoint(); + + if (this.view.isInGrid(point)) { + int row = this.view.getRow(point); +- int column = this.view.getColumn(point); + + GridAction type; + + if (this.eraseMode) { + type = GridAction.EMPTY; + } else { + type = GridController.modifiersToType(modifiers); + } + + this.view.rolloverHighlight(row, column); + + this.fireEventPerformed(GridCommands.FILL_CMD, + new FillCommand(row, column, type)); + } else { + this.view.highlightEnded(); + } + } + */ + /** + * Converts a mouse click to an action. + * + * @param modifiers mouse event modifiers + * @return corresponding action, or -1 + */ + // FIXME + /* + private static GridAction modifiersToType(int modifiers) { + switch (modifiers) { + case MouseEvent.BUTTON1_MASK: + return GridAction.CHECK; + + case MouseEvent.BUTTON3_MASK: + return GridAction.CROSS; + + default: + return GridAction.UNKNOWN; + } + } + */ + /*** Accessor ***/ + + /** + * Allows to set the view. + * + * @param view view to which this controller is attached + */ + public void setView(GridUI view) { + this.view = view; + } +} + Property changes on: branches/engine_split/android/src/picross/specific/grid/ui/GridController.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.grid.ui; + +import picross.common.grid.ui.AbstractGridMediator; + +import android.content.Context; + +import picross.engine.PicrossException; + +/** + * Picross grid mediator. + * + * @author Y. Norsa + */ +public final class GridMediator extends AbstractGridMediator { + private Context context; + + public GridMediator(Context context, final int width, final int height, boolean[][] data) throws PicrossException { + super(width, height, data); + + this.context = context; + } +} + Property changes on: branches/engine_split/android/src/picross/specific/grid/ui/GridMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,766 @@ +/* + * $Id$ + * + * Copyright (c) 2007-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.grid.ui; + +import java.io.FileNotFoundException; + +import java.util.ArrayList; +import java.util.List; + +import picross.common.grid.ui.GridView; + +import picross.specific.ui.PicrossUIHelper; + +import picross.engine.grid.Box; +import picross.engine.grid.CompletedHints; +import picross.engine.grid.GridModel; + +/** + * Grid UI. + * + * @author Y. Norsa + */ +public final class GridUI /*extends JPanel*/ implements GridView { + /*** Constants ***/ + + /** Space left before the top hints. */ + private static final int TOP_HINTS = 10; + + /** Space left after the left hints. */ + private static final int LEFT_HINTS = 10; + + /** Color of the hints text. */ + //private static final Color HINT_TEXT_COLOR = new Color(233, 246, 255); + + /** Color of a completed hint text. */ + //private static final Color COMPLETED_HINT_COLOR = new Color(208, 215, 217); + + /** Font used for the hints. */ + /* + private static final Font HINT_FONT = + new Font("Sans Serif", Font.BOLD, 10); + */ + /** A box width. */ + private static final int BOX_WIDTH = 25; + + /** A box height. */ + private static final int BOX_HEIGHT = 25; + + /** Extra space at the right end of the grid. */ + private static final int RIGHT_SPACE = 5; + + /** Extra space at the bottom of the grid. */ + private static final int BOTTOM_SPACE = 5; + + /** Text used to compute the high hints boxes size. */ + private static final String HIGH_SAMPLE_HINT = "88"; + + /** Text used to compute the low hints boxes size. */ + private static final String LOW_SAMPLE_HINT = "8"; + + /** Hint box icon. */ + private static final String HINT_BOX_ICON = "hint.png"; + + /** Space between hint boxes. */ + private static final int HINTS_SPACE = 2; + + /** Boxes blocks color. */ + //private static final Color BLOCKS_COLOR = new Color(131, 155, 200); + + /** A block width. */ + private static final int BLOCK_WIDTH = 5; + + /** A block height. */ + private static final int BLOCK_HEIGHT = 5; + + /*** Fields ***/ + + /** Grid width. */ + private int width; + + /** Grid height. */ + private int height; + + /** Columns hints. */ + private int[][] colData; + + /** Rows hints. */ + private int[][] rowData; + + /** Amount of space left before the grid. */ + private int leftBoundary; + + /** Position of the right end of the grid. */ + private int rightBoundary; + + /** Amount of space left before the grid. */ + private int topBoundary; + + /** Position of the bottom end of the grid. */ + private int bottomBoundary; + + /** Top hints boxes. */ + private transient HintBoxInfos[] topHints; + + /** Left hints boxes. */ + private transient HintBoxInfos[] leftHints; + + /** Current state of the grid. */ + private transient UIBox[][] boxes; + + /** Current rolled-over box. */ + private transient UIBox rollover; + + /** Controller attached to this view. */ + private transient GridController controller; + + /** Hint box icon. */ + //private ImageIcon hintBoxIcon; + + /** X coordinate of the beginning of a top hints row. */ + private int topHintsX; + + /** Space left between two top hints. */ + private int topHintsDecal; + + /** Y coordinate of the beginning of a left hints column. */ + private int leftHintsY; + + /** Space left between two left hints. */ + private int leftHintsDecal; + + /** Used to center a hint vertically. */ + private int centerHintHeight; + + /** Used to center a low hint horizontally. */ + private int centerLowHintWidth; + + /** Used to center a high hint horizontally. */ + private int centerHighHintWidth; + + /** Boxes blocks. */ + //private List<Line2D> blocksLines; + + /** List of completed hints. */ + private transient CompletedHints completedHints; + + /** Index of the currently highlighted row. */ + private int rolloverRow = -1; + + /** Index of the currently highlighted column. */ + private int rolloverColumn = -1; + + /*** Constructor ***/ + + /** + * Constructor. + * + * @param width grid width + * @param height grid height + * @param boxes current state of the grid + * @param colData columns hints + * @param rowData rows hints + * @param completedHints list of completed hints + * @param controller controller for the grid + */ + public GridUI(int width, int height, + UIBox[][] boxes, + int[][] colData, + int[][] rowData, + CompletedHints completedHints, + GridController controller) { + // FIXME + //super(true); + + this.controller = controller; + + // FIXME + /* + this.addMouseListener(this.controller); + this.addMouseMotionListener(this.controller); + + this.setBackground(Color.WHITE); + this.setOpaque(true); + */ + this.width = width; + this.height = height; + + this.colData = colData; + this.rowData = rowData; + + this.completedHints = completedHints; + + // Contain the state of the grid + this.boxes = boxes; + } + + /*** Method overloaded from JPanel ***/ + + /** {@inheritDoc} */ + // FIXME + /* + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + + Graphics2D newG = (Graphics2D) g.create(); + + Rectangle clipRect = newG.getClipBounds(); + + for (int i = 0; i < this.topHints.length; i++) { + if (this.topHints[i].intersects(clipRect)) { + this.drawTopHints(newG, i); + } + } + + for (int i = 0; i < this.leftHints.length; i++) { + if (this.leftHints[i].intersects(clipRect)) { + this.drawLeftHints(newG, i); + } + } + + // Paints the boxes + for (int i = 0; i < this.width; i++) { + for (int j = 0; j < this.height; j++) { + Rectangle currentRect = this.boxes[i][j].getRect(); + + if (currentRect.intersects(clipRect)) { + if (this.boxes[i][j] == this.rollover) { + this.boxes[i][j].getRolloverIcon() + .paintIcon(this, newG, + currentRect.x, currentRect.y); + } else { + this.boxes[i][j].getIcon().paintIcon(this, newG, + currentRect.x, + currentRect.y); + } + } + } + } + + // Draws the blocks + newG.setColor(GridUI.BLOCKS_COLOR); + + for (Line2D line : this.blocksLines) { + newG.draw(line); + } + + newG.dispose(); + } + */ + /*** Methods ***/ + + /** + * Initializes various stuff. + * + * @throws FileNotFoundException if an image is missing + */ + public void init() throws FileNotFoundException { + // FIXME + /* + // Computes the size of a hint + FontRenderContext frc = new FontRenderContext(null, true, true); + + // High hint (> 10) + Rectangle2D textBounds = + GridUI.HINT_FONT.getStringBounds(GridUI.HIGH_SAMPLE_HINT, frc); + int hintHeight = (int) textBounds.getHeight(); + int highHintWidth = (int) textBounds.getWidth(); + + // Low hint + textBounds = GridUI.HINT_FONT.getStringBounds(GridUI.LOW_SAMPLE_HINT, + frc); + int lowHintWidth = (int) textBounds.getWidth(); + + this.hintBoxIcon = PicrossUIHelper.getImage(GridUI.HINT_BOX_ICON); + + int hintBoxWidth = this.hintBoxIcon.getIconWidth(); + int hintBoxHeight = this.hintBoxIcon.getIconHeight(); + + this.leftHintsDecal = hintBoxWidth + GridUI.HINTS_SPACE; + this.topHintsDecal = hintBoxHeight + GridUI.HINTS_SPACE; + + // Now computes the grid boundaries + + this.leftBoundary = GridUI.LEFT_HINTS + + (this.rowData[0].length * this.leftHintsDecal); + + this.rightBoundary = this.leftBoundary + + (this.width * GridUI.BOX_WIDTH); + + this.topBoundary = GridUI.TOP_HINTS + + (this.colData[0].length * this.topHintsDecal); + + this.bottomBoundary = this.topBoundary + + (this.height * GridUI.BOX_HEIGHT); + + // Space occupied by the hints + this.topHints = new HintBoxInfos[this.width]; + + for (int i = 0; i < this.topHints.length; i++) { + this.topHints[i] = new HintBoxInfos(); + + this.topHints[i].setRect(new Rectangle(this.leftBoundary + + (i * GridUI.BOX_WIDTH), 0, + GridUI.BOX_WIDTH, + this.topBoundary)); + } + + this.leftHints = new HintBoxInfos[this.height]; + + for (int i = 0; i < this.leftHints.length; i++) { + this.leftHints[i] = new HintBoxInfos(); + + this.leftHints[i].setRect(new Rectangle(0, this.topBoundary + + (i * GridUI.BOX_HEIGHT), + this.leftBoundary, + GridUI.BOX_HEIGHT)); + } + + this.topHintsX = this.leftBoundary + + (GridUI.BOX_WIDTH / 2) - (hintBoxWidth / 2); + + this.leftHintsY = this.topBoundary + + (GridUI.BOX_HEIGHT / 2) - (hintBoxHeight / 2); + + this.centerHintHeight = + (hintBoxHeight / 2) + (hintHeight / 2); + this.centerLowHintWidth = + (hintBoxWidth / 2) - (lowHintWidth / 2); + this.centerHighHintWidth = + (hintBoxWidth / 2) - (highHintWidth / 2); + */ + for (int i = 0; i < this.width; i++) { + for (int j = 0; j < this.height; j++) { + /* + * We compute here the rectangle corresponding to each box + * so we'll be able + * to redraw only what is needed + */ + // FIXME + /* + this.boxes[i][j] + .setRect(new Rectangle(this.leftBoundary + + (i * GridUI.BOX_WIDTH), + this.topBoundary + + (j * GridUI.BOX_WIDTH), + GridUI.BOX_WIDTH, + GridUI.BOX_HEIGHT)); + */ + } + } + + + // FIXME + /* + this.initBlocks(); + this.initTopHints((GridUI.BOX_WIDTH / 2) - (hintBoxWidth / 2)); + this.initLeftHints((GridUI.BOX_HEIGHT / 2) - (hintBoxHeight / 2)); + + this.setPreferredSize(new Dimension(this.rightBoundary + + GridUI.RIGHT_SPACE, + this.bottomBoundary + + GridUI.BOTTOM_SPACE)); + */ + } + + /** Precomputes the blocks lines. */ + private void initBlocks() { + // FIXME + /* + this.blocksLines = new ArrayList<Line2D>(); + + this.blocksLines.add(new Line2D.Double(this.leftBoundary, + this.topBoundary, + this.leftBoundary, + this.bottomBoundary)); + this.blocksLines.add(new Line2D.Double(this.leftBoundary, + this.topBoundary, + this.rightBoundary, + this.topBoundary)); + this.blocksLines.add(new Line2D.Double(this.rightBoundary, + this.bottomBoundary, + this.leftBoundary, + this.bottomBoundary)); + this.blocksLines.add(new Line2D.Double(this.rightBoundary, + this.bottomBoundary, + this.rightBoundary, + this.topBoundary)); + + int boxWidth = GridUI.BLOCK_WIDTH * GridUI.BOX_WIDTH; + int boxHeight = GridUI.BLOCK_HEIGHT * GridUI.BOX_HEIGHT; + + int i = 1; + int currentY = this.topBoundary + boxHeight; + + while ((i + GridUI.BLOCK_HEIGHT) <= this.height) { + this.blocksLines.add(new Line2D.Double(this.leftBoundary, + currentY, + this.rightBoundary, + currentY)); + + currentY += boxHeight; + i += GridUI.BLOCK_HEIGHT; + } + + i = 1; + int currentX = this.leftBoundary + boxWidth; + + while ((i + GridUI.BLOCK_WIDTH) <= this.width) { + this.blocksLines.add(new Line2D.Double(currentX, + this.topBoundary, + currentX, + this.bottomBoundary)); + + currentX += boxWidth; + i += GridUI.BLOCK_WIDTH; + } + */ + } + + /** + * Precomputes the top hints boxes. + * + * @param topHintsStart coordinate where the boxes begin + */ + private void initTopHints(int topHintsStart) { + // FIXME + /* + for (int k = 0; k < this.topHints.length; k++) { + this.topHints[k].setBox( + new BufferedImage(GridUI.BOX_WIDTH, this.topBoundary, + BufferedImage.TYPE_INT_RGB)); + + Graphics2D g2d = this.topHints[k].createBoxGraphics(); + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, + this.topHints[k].getWidth(), + this.topHints[k].getHeight()); + + int y = 0; + + // Column hints are in reverse order + for (int i = (this.colData[0].length - 1); i >= 0; i--) { + if (this.colData[k][i] != GridModel.EMPTY_HINT) { + this.hintBoxIcon.paintIcon(this, g2d, topHintsStart, y); + } + + y += this.topHintsDecal; + } + }*/ + } + + /** + * Precomputes the left hints boxes. + * + * @param leftHintsStart coordinate where the boxes begin + */ + private void initLeftHints(int leftHintsStart) { + // FIXME + /* + for (int k = 0; k < this.leftHints.length; k++) { + this.leftHints[k].setBox( + new BufferedImage(this.leftBoundary, GridUI.BOX_HEIGHT, + BufferedImage.TYPE_INT_RGB)); + + Graphics2D g2d = this.leftHints[k].createBoxGraphics(); + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, + this.leftHints[k].getWidth(), + this.leftHints[k].getHeight()); + + int x = 0; + + for (int j = 0; j < this.rowData[k].length; j++) { + if (this.rowData[k][j] != GridModel.EMPTY_HINT) { + this.hintBoxIcon.paintIcon(this, g2d, x, leftHintsStart); + } + + x += this.leftHintsDecal; + } + }*/ + } + + /** + * Draws the top hints. + * + * @param g the graphics context + */ + // FIXME + /* + private void drawTopHints(Graphics g, int col) { + g.drawImage(this.topHints[col].getBox(), + this.topHints[col].getX(), this.topHints[col].getY(), + null); + + g.setFont(GridUI.HINT_FONT); + + int x = this.topHintsX + (col * GridUI.BOX_WIDTH); + int y = 0; + + for (int i = this.colData[0].length - 1; i >= 0; i--) { + if (this.colData[col][i] != GridModel.EMPTY_HINT) { + this.drawHint(g, this.colData[col][i], x, y, + this.completedHints.isColHintComplete(col, i), + (this.rolloverColumn == col)); + } + + y += this.topHintsDecal; + } + } + */ + /** + * Draws the left hints. + * + * @param g the graphics context + */ + // FIXME + /* + private void drawLeftHints(Graphics g, int row) { + g.drawImage(this.leftHints[row].getBox(), + this.leftHints[row].getX(), this.leftHints[row].getY(), + null); + + g.setFont(GridUI.HINT_FONT); + + int y = this.leftHintsY + (row * GridUI.BOX_HEIGHT); + int x = 0; + + for (int j = 0; j < this.rowData[row].length; j++) { + if (this.rowData[row][j] != GridModel.EMPTY_HINT) { + this.drawHint(g, this.rowData[row][j], x, y, + this.completedHints.isRowHintComplete(row, j), + (this.rolloverRow == row)); + } + + x += this.leftHintsDecal; + } + } + */ + /** + * Draws a hint. + * + * @param g the graphics context + * @param value hint value + * @param x X coordinate + * @param y Y coordinate + */ + // FIXME + /* + private void drawHint(Graphics g, int value, int x, int y, + boolean complete, boolean rollover) { + if (!rollover) { + if (complete) { + g.setColor(GridUI.COMPLETED_HINT_COLOR); + } else { + g.setColor(GridUI.HINT_TEXT_COLOR); + } + } else { + if (complete) { + g.setColor(new Color(255, 122, 0)); + } else { + g.setColor(Color.ORANGE); + } + } + + y += this.centerHintHeight; + + if (value < 10) { + x += this.centerLowHintWidth; + g.drawString(String.valueOf(value), x, y); + } else { + x += this.centerHighHintWidth; + g.drawString(String.valueOf(value), x, y); + } + } + */ + /** + * This methods tells wether a point is inside the grid or not. + * + * @param point point to be tested + * @return boolean telling if the point is inside the grid + */ + // FIXME + /* + boolean isInGrid(Point point) { + double x = point.getX(); + double y = point.getY(); + + return (x >= this.leftBoundary && x < this.rightBoundary + && y >= this.topBoundary && y < this.bottomBoundary); + } + */ + /** + * Allows to get the row number corresponding to a point inside the grid. + * + * @param point a point inside the grid + * @return the row corresponding to the point + */ + // FIXME + /* + int getRow(Point point) { + double y = point.getY() - this.topBoundary; + + return (int) (y / GridUI.BOX_HEIGHT); + } + */ + /** + * Allows to get the column number corresponding to a point + * inside the grid. + * + * @param point a point inside the grid + * @return the column corresponding to the point + */ + // FIXME + /* + int getColumn(Point point) { + double x = point.getX() - this.leftBoundary; + + return (int) (x / GridUI.BOX_WIDTH); + } + */ + /** Removes the listeners to disable the grid. */ + void disableGrid() { + // FIXME + /* + this.removeMouseListener(this.controller); + this.removeMouseMotionListener(this.controller); + */ + } + + /** + * Repaints a box. + * + * @param row row of the box + * @param column column of the box + */ + void repaint(int row, int column) { + // FIXME + //this.repaint(this.boxes[column][row].getRect()); + } + + /** + * Allows to set the current rolled-over box. + * + * @param row row of the box + * @param column column of the box + */ + void setRollover(int row, int column) { + /* + this.rolloverEnded(); + this.rollover = this.boxes[column][row]; + this.repaint(this.rollover.getRect()); + + this.rolloverHighlight(row, column); + */ + } + /** + * Sets the currently highlighted row and column. + * + * @param row row's index to highlight + * @param column column's index to highlight + */ + void rolloverHighlight(int row, int column) { + /* + if ((this.rolloverColumn != column) || (this.rolloverRow != row)) { + this.repaintColHints(this.rolloverColumn); + this.repaintRowHints(this.rolloverRow); + + this.rolloverColumn = column; + this.rolloverRow = row; + + this.repaintColHints(this.rolloverColumn); + this.repaintRowHints(this.rolloverRow); + } + */ + } + /** Indicates that no box is currently rolled over. */ + + void rolloverEnded() { + /* + if (this.rollover != null) { + */ + /* + * Save the old rolled-over box so we can draw it + * in its initial state + */ + /* + Rectangle rect = this.rollover.getRect(); + + this.rollover = null; + this.repaint(rect); + } + + this.highlightEnded(); + */ + } + + /** Ends the highlight. */ + void highlightEnded() { + /* + this.repaintColHints(this.rolloverColumn); + this.repaintRowHints(this.rolloverRow); + + this.rolloverColumn = -1; + this.rolloverRow = -1; + */ + } + /** Repaints top hints. */ + void repaintColHints(int col) { + // FIXME + /* + if (col < 0 || col >= this.width) { + return; + } + + this.repaint(this.topHints[col].getRect()); + */ + } + + /** Repaints left hints. */ + void repaintRowHints(int row) { + // FIXME + /* + if (row < 0 || row >= this.height) { + return; + } + + this.repaint(this.leftHints[row].getRect()); + */ + } + + public void updateBox(int row, int col, Box box) { + this.boxes[row][col].updateState(box); + } +} Property changes on: branches/engine_split/android/src/picross/specific/grid/ui/GridUI.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java =================================================================== --- branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java (rev 0) +++ branches/engine_split/android/src/picross/specific/grid/ui/HintBoxInfos.java 2013-01-14 13:23:53 UTC (rev 117) @@ -0,0 +1,147 @@ +/* + * $Id$ + * + * Copyright (c) 2008-2011 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.grid.ui; + +/** + * Informations about a hint box. + * + * @author Y. Norsa + */ +final class HintBoxInfos { + /*** Field ***/ + + /** The rectangle taken by the box. */ + //private Rectangle rect = null; + + /** Pre-rendered image of the box. */ + //private BufferedImage box = null; + + /*** Methods ***/ + + /** + * Determines if the box's rectangle intersects with another. + * + * @param rectangle the rectangle to test + * @return boolean indicating wether the two rectangles intersect + * with each other + *//* + boolean intersects(Rectangle rectangle) { + return this.rect.intersects(rectangle); + }*/ + + /** + * Creates and return a <code>Graphics2D</code> object corresponding + * to the box. + * + * @return graphical object corresponding to the box + *//* + Graphics2D createBoxGraphics() { + return this.box.createGraphics(); + }*/ + + /** + * Returns the rectangle's width. + * + * @return width of the box's rectangle + *//* + int getWidth() { + return this.rect.width; + }*/ + + /** + * Returns the rectangle's height. + * + * @return height of the box's rectangle + *//* + int getHeight() { + return this.rect.height; + }*/ + + /** + * Return the rectangle's X coordinate. + * + * @return X coordinate for the rectangle + *//* + int getX() { + return this.rect.x; + }*/ + + /** + * Return the rectangle's Y coordinate. + * + * @return Y coordinate for the rectangle + *//* + int getY() { + return this.rect.y; + }*/ + + /*** Accessors ***/ + + /** + * Sets the rectangle occupied by the box. + * + * @param newRect the box's rectangle + *//* + void setRect(Rectangle newRect) { + this.rect = newRect; + }*/ + + /** + * Sets the box's image. + * + * @param newBox pre-rendered image of the box + *//* + void setBox(BufferedImage newBox) { + this.box = newBox; + }*/ + + /** + * Return the box. + * + * @return the rectangle occupied by the box + *//* + Rectangle getRect() { + return this.rect; + }*/ + + /** + * Return th... [truncated message content] |
From: <yva...@us...> - 2013-01-14 10:48:54
|
Revision: 116 http://sourceforge.net/p/picross/code/116 Author: yvan_norsa Date: 2013-01-14 10:48:50 +0000 (Mon, 14 Jan 2013) Log Message: ----------- android version Modified Paths: -------------- branches/engine_split/android/custom_rules.xml branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java branches/engine_split/android/src/picross/specific/ui/MenuUI.java branches/engine_split/android/src/picross/specific/ui/PicrossButton.java branches/engine_split/build.xml branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java Added Paths: ----------- branches/engine_split/android/src/picross/specific/ui/PicrossLabel.java branches/engine_split/android/src/picross/specific/ui/WaitMenuMediator.java branches/engine_split/android/src/picross/specific/ui/WaitMenuUI.java branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java branches/engine_split/properties/ branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java Removed Paths: ------------- branches/engine_split/android/extraData/META-INF/ branches/engine_split/common/src/picross/common/ui/WaitMenuMediator.java branches/engine_split/src/picross/properties/ Modified: branches/engine_split/android/custom_rules.xml =================================================================== --- branches/engine_split/android/custom_rules.xml 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/android/custom_rules.xml 2013-01-14 10:48:50 UTC (rev 116) @@ -1,14 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="PicrossDroid-custom"> - <target name="-post-compile"> - <copy todir="${out.classes.absolute.dir}/picross"> - <fileset dir="extraData/picross" /> - </copy> - </target> - <target name="-post-package"> - <jar destfile="${out.packaged.file}" update="true"> <fileset dir="extraData/gameModes"/> </jar> Modified: branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/android/src/picross/specific/game/simple/ui/LevelMenuUI.java 2013-01-14 10:48:50 UTC (rev 116) @@ -118,10 +118,11 @@ */ public void displayLevels(MenuController listener, List<String> levels) { // FIXME + this.removeAllButtons(); + + // FIXME /* - this.removeAll(); - JPanel panel = new JPanel(); panel.setOpaque(false); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); @@ -137,7 +138,10 @@ /* panel.add(this.createSimpleButton(level, event, listener) .getButton()); + */ + this.add(this.createSimpleButton(level, event, listener)); + /* if (i != (nbLevels - 1)) { panel.add(Box.createRigidArea(new Dimension(0, 20))); }*/ Modified: branches/engine_split/android/src/picross/specific/ui/MenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/android/src/picross/specific/ui/MenuUI.java 2013-01-14 10:48:50 UTC (rev 116) @@ -62,6 +62,9 @@ import android.view.MotionEvent; +import android.graphics.Color; +import android.graphics.Paint; + /** * Base class for menus. * @@ -95,7 +98,7 @@ protected Context context; private SurfaceHolder surface; - private List<PicrossButton> buttons; + private List<PicrossLabel> buttons; /*** Constructor ***/ @@ -108,23 +111,6 @@ this.context = context; - // FIXME - /* - try { - ImageIcon icon = PicrossUIHelper.getImage(MenuUI.BACKGROUND_IMAGE); - this.setPreferredSize(new Dimension(icon.getIconWidth(), - icon.getIconHeight())); - this.image = icon.getImage(); - } catch (MissingImageException imageEx) { - MenuUI.log.info(imageEx.getMessage()); - this.setPreferredSize(new Dimension(MenuUI.DEFAULT_WIDTH, - MenuUI.DEFAULT_HEIGHT)); - } - - this.setLayout(null); - */ - - Resources res = context.getResources(); this.image = PicrossUIHelper.getImage(res, R.drawable.background); @@ -134,7 +120,7 @@ this.surface = this.getHolder(); this.surface.addCallback(this); - this.buttons = new ArrayList<PicrossButton>(); + this.buttons = new ArrayList<PicrossLabel>(); } @@ -198,10 +184,19 @@ return; } + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setTextSize(20); + canvas.drawBitmap(this.image, 0, 0, null); - for (PicrossButton button : this.buttons) { + for (PicrossLabel button : this.buttons) { canvas.drawBitmap(button.getIcon(), button.getX(), button.getY(), null); + + if (button instanceof PicrossButton && ((PicrossButton) button).getText() != null) { + canvas.drawText(((PicrossButton) button).getText(), button.getX() + (button.getWidth() / 2), button.getY() + + (button.getHeight() / 2), paint); + } } } @@ -250,12 +245,9 @@ SimpleListener listener, int x, int y) { MenuUI.log.debug("addSimpleButton(" + label + ", " + event + ", listener, " + x + ", " + y + ")"); - // FIXME - /* PicrossButton button = this.createSimpleButton(label, event, listener); - this.putButton(button.getButton(), x, y, 150, 50); - */ + this.putButton(button/*.getButton()*/, x, y, 150, 50); } /** @@ -266,17 +258,18 @@ * @param listener listener for the button * @return the created button */ - // FIXME - /* protected final PicrossButton createSimpleButton(String label, SimpleEvent event, SimpleListener listener) { PicrossButton button = new PicrossButton(label, - PicrossUIHelper.getImage("empty-button.png"), + PicrossUIHelper.getImage(this.context.getResources(), R.drawable.empty_button), event); - button.addSimpleListener(listener); + //button.addSimpleListener(listener); + button.setListener(listener); + // FIXME + /* JButton realButton = button.getButton(); realButton.setHorizontalTextPosition(JButton.CENTER); @@ -290,11 +283,14 @@ realButton.setMinimumSize(dim); realButton.setMaximumSize(dim); realButton.setPreferredSize(dim); + */ + button.setWidth(150); + button.setHeight(50); return button; } - */ + /** * Helper method to add a button. * @@ -386,7 +382,7 @@ //312 267 - private void add(PicrossButton button) { + protected void add(PicrossLabel button) { this.buttons.add(button); } @@ -397,7 +393,13 @@ MenuUI.log.debug("x = " + x + ", y = " + y); - for (PicrossButton button : buttons) { + for (PicrossLabel label : buttons) { + if (!(label instanceof PicrossButton)) { + continue; + } + + PicrossButton button = (PicrossButton) label; + MenuUI.log.debug("Testing with X between " + button.getX() + " and " + (button.getX() + button.getWidth()) + ", and Y between " + button.getY() + " and " + (button.getY() + button.getHeight())); /* @@ -426,6 +428,23 @@ return false; } + public void removeAllButtons() { + this.buttons.clear(); + } + + protected void addLabel(int resID, int x, int y) { + Bitmap icon = + PicrossUIHelper.getImage(this.context.getResources(), resID); + //JLabel label = new JLabel(labelIcon); + //label.setBorder(null); + //label.setBounds(75, 225, + // labelIcon.getIconWidth(), labelIcon.getIconHeight()); + + + PicrossLabel label = new PicrossLabel(icon, x, y, icon.getWidth(), icon.getHeight()); + this.add(label); + } + public static class PicrossEvent { private String actionCommand; Modified: branches/engine_split/android/src/picross/specific/ui/PicrossButton.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossButton.java 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/android/src/picross/specific/ui/PicrossButton.java 2013-01-14 10:48:50 UTC (rev 116) @@ -38,14 +38,9 @@ import android.graphics.Bitmap; -public class PicrossButton { - private Bitmap icon; +public class PicrossButton extends PicrossLabel { private MenuController controller; private String command; - private int x; - private int y; - private int width; - private int height; PicrossButton(Bitmap buttonIcon, MenuController buttonController, String cmd) { this.icon = buttonIcon; @@ -59,6 +54,18 @@ this.event = event; } + public PicrossButton(String label, Bitmap buttonIcon, SimpleEvent event) { + this.text = label; + this.icon = buttonIcon; + this.event = event; + } + + private String text; + + public String getText() { + return this.text; + } + private int resID; private SimpleEvent event; @@ -70,14 +77,6 @@ return this.resID; } - public Bitmap getIcon() { - return this.icon; - } - - public void setIcon(Bitmap buttonIcon) { - this.icon = buttonIcon; - } - public MenuController getController() { return this.controller; } @@ -95,36 +94,4 @@ public String getCommand() { return this.command; } - - public int getX() { - return this.x; - } - - public void setX(int xValue) { - this.x = xValue; - } - - public int getY() { - return this.y; - } - - public void setY(int yValue) { - this.y = yValue; - } - - public int getWidth() { - return this.width; - } - - public void setWidth(int w) { - this.width = w; - } - - public int getHeight() { - return this.height; - } - - public void setHeight(int h) { - this.height = h; - } } Added: branches/engine_split/android/src/picross/specific/ui/PicrossLabel.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/PicrossLabel.java (rev 0) +++ branches/engine_split/android/src/picross/specific/ui/PicrossLabel.java 2013-01-14 10:48:50 UTC (rev 116) @@ -0,0 +1,94 @@ +/* + * $Id$ + * + * Copyright (c) 2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.ui; + +import android.graphics.Bitmap; + +public class PicrossLabel { + protected Bitmap icon; + protected int x; + protected int y; + protected int width; + protected int height; + + public PicrossLabel() { } + + public PicrossLabel(Bitmap icon, int x, int y, int width, int height) { + this.icon = icon; + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + + public Bitmap getIcon() { + return this.icon; + } + + public void setIcon(Bitmap buttonIcon) { + this.icon = buttonIcon; + } + + public int getX() { + return this.x; + } + + public void setX(int xValue) { + this.x = xValue; + } + + public int getY() { + return this.y; + } + + public void setY(int yValue) { + this.y = yValue; + } + + public int getWidth() { + return this.width; + } + + public void setWidth(int w) { + this.width = w; + } + + public int getHeight() { + return this.height; + } + + public void setHeight(int h) { + this.height = h; + } +} Property changes on: branches/engine_split/android/src/picross/specific/ui/PicrossLabel.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/ui/WaitMenuMediator.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/WaitMenuMediator.java (rev 0) +++ branches/engine_split/android/src/picross/specific/ui/WaitMenuMediator.java 2013-01-14 10:48:50 UTC (rev 116) @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * Copyright (c) 2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.ui; + +import android.content.Context; + +import picross.common.ui.AbstractWaitMenuMediator; +import picross.common.ui.PicrossUI; + +import picross.engine.PicrossException; + +public final class WaitMenuMediator extends AbstractWaitMenuMediator { + private Context context; + + public WaitMenuMediator(Context androidContext) { + this.context = androidContext; + } + + /** {@inheritDoc} */ + @Override + protected MenuUI initView(PicrossUI ui, MenuController controller) + throws PicrossException { + + return new WaitMenuUI(this.context); + } +} Property changes on: branches/engine_split/android/src/picross/specific/ui/WaitMenuMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/android/src/picross/specific/ui/WaitMenuUI.java =================================================================== --- branches/engine_split/android/src/picross/specific/ui/WaitMenuUI.java (rev 0) +++ branches/engine_split/android/src/picross/specific/ui/WaitMenuUI.java 2013-01-14 10:48:50 UTC (rev 116) @@ -0,0 +1,71 @@ +/* + * $Id$ + * + * Copyright (c) 2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.ui; + +import picross.specific.activities.R; + +import android.content.Context; + +/** + * Displays a wait message. + * + * @author Y. Norsa + */ +public final class WaitMenuUI extends MenuUI { + /*** Constant ***/ + + /** Serialisation ID. */ + static final long serialVersionUID = -6083373008192848638L; + + /*** Constructor ***/ + + /** + * Constructor. + */ + public WaitMenuUI(Context androidContext) { + super(androidContext); + + /* + ImageIcon labelIcon = + PicrossUIHelper.getLocalizedImage("label_wait.png"); + JLabel label = new JLabel(labelIcon); + label.setBorder(null); + label.setBounds(75, 225, + labelIcon.getIconWidth(), labelIcon.getIconHeight()); + this.add(label); + */ + this.addLabel(R.drawable.label_wait, 75, 225); + } +} + Property changes on: branches/engine_split/android/src/picross/specific/ui/WaitMenuUI.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Modified: branches/engine_split/build.xml =================================================================== --- branches/engine_split/build.xml 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/build.xml 2013-01-14 10:48:50 UTC (rev 116) @@ -236,6 +236,10 @@ <fileset dir="data" /> </copy> + <copy todir="${game.build.dir}/picross/properties"> + <fileset dir="properties" /> + </copy> + <copy todir="${game.build.dir}/META-INF/services"> <fileset dir="services" /> </copy> @@ -451,10 +455,14 @@ <target name="android-dist" depends="common-dist"> - <copy todir="${android.dir}/servicesData/META-INF/services"> + <copy todir="${android.dir}/extraData/gameModes/META-INF/services"> <fileset dir="services" /> </copy> + <copy todir="${android.dir}/src/picross/properties"> + <fileset dir="properties" /> + </copy> + <copy todir="${android.dir}/libs" file="${common.jar.name}" /> <copy todir="${android.dir}/libs" @@ -474,6 +482,10 @@ includes="*.png" /> </copy> + <copy todir="${android.dir}/src/picross/data"> + <fileset dir="data" /> + </copy> + <ant antfile="build.xml" dir="${android.dir}" target="debug" /> Modified: branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuMediator.java 2013-01-14 10:48:50 UTC (rev 116) @@ -71,7 +71,7 @@ /** {@inheritDoc} */ @Override - protected MenuController initController() { + protected final MenuController initController() { MenuController controller = new LevelMenuController(); this.addSimpleListener(controller); @@ -95,7 +95,7 @@ /** {@inheritDoc} */ @Override - public void eventPerformed(SimpleEvent e) { + public final void eventPerformed(SimpleEvent e) { LevelMenuMediator.log.debug("eventPerformed(" + e + ")"); LevelMenuMediator.log.debug("this : " + this); LevelMenuMediator.log.debug("this.model : " + this.model); Modified: branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java =================================================================== --- branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/common/src/picross/common/game/simple/ui/LevelMenuModel.java 2013-01-14 10:48:50 UTC (rev 116) @@ -44,6 +44,7 @@ import picross.engine.Picross; import picross.engine.PicrossException; +import picross.engine.PicrossLogHelper; import picross.engine.game.simple.Dimensions; import picross.engine.game.simple.FileInfos; @@ -119,12 +120,15 @@ String line = null; while ((line = in.readLine()) != null) { + PicrossLogHelper.getLogger().debug("read line: \"" + line + "\""); list.add(FileInfos.readFileInfos(line)); } } catch (IOException ioEx) { throw ioEx; } finally { - in.close(); + if (in != null) { + in.close(); + } } return list; Modified: branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/common/src/picross/common/ui/AbstractPicrossMediator.java 2013-01-14 10:48:50 UTC (rev 116) @@ -54,7 +54,7 @@ import picross.common.grid.ui.GridCommands; import picross.common.ui.PicrossController; -import picross.common.ui.WaitMenuMediator; +import picross.specific.ui.WaitMenuMediator; import picross.specific.ui.GameMenuMediator; import picross.common.ui.MenuCommand; import picross.specific.ui.MainMenuMediator; Copied: branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java (from rev 109, branches/engine_split/common/src/picross/common/ui/WaitMenuMediator.java) =================================================================== --- branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java (rev 0) +++ branches/engine_split/common/src/picross/common/ui/AbstractWaitMenuMediator.java 2013-01-14 10:48:50 UTC (rev 116) @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * Copyright (c) 2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.common.ui; + +import picross.engine.PicrossException; + +import picross.specific.ui.MenuController; +import picross.specific.ui.MenuUI; +import picross.specific.ui.WaitMenuUI; + +/** + * @author Y. Norsa + */ +public abstract class AbstractWaitMenuMediator extends MenuMediator { + /*** Method overriden from MenuMediator ***/ + + /** {@inheritDoc} */ + @Override + protected MenuUI initView(PicrossUI ui, MenuController controller) + throws PicrossException { + + return new WaitMenuUI(); + } +} + Deleted: branches/engine_split/common/src/picross/common/ui/WaitMenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/common/ui/WaitMenuMediator.java 2013-01-14 09:30:39 UTC (rev 115) +++ branches/engine_split/common/src/picross/common/ui/WaitMenuMediator.java 2013-01-14 10:48:50 UTC (rev 116) @@ -1,56 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2008 - * - * This software is governed by the CeCILL license under French law and - * abiding by the rules of distribution of free software. You can use, - * modify and/ or redistribute the software under the terms of the CeCILL - * license as circulated by CEA, CNRS and INRIA at the following URL - * "http://www.cecill.info". - * - * As a counterpart to the access to the source code and rights to copy, - * modify and redistribute granted by the license, users are provided only - * with a limited warranty and the software's author, the holder of the - * economic rights, and the successive licensors have only limited - * liability. - * - * In this respect, the user's attention is drawn to the risks associated - * with loading, using, modifying and/or developing or reproducing the - * software by the user in light of its specific status of free software, - * that may mean that it is complicated to manipulate, and that also - * therefore means that it is reserved for developers and experienced - * professionals having in-depth computer knowledge. Users are therefore - * encouraged to load and test the software's suitability as regards their - * requirements in conditions enabling the security of their systems and/or - * data to be ensured and, more generally, to use and operate it in the - * same conditions as regards security. - * - * The fact that you are presently reading this means that you have had - * knowledge of the CeCILL license and that you accept its terms. - */ - - -package picross.common.ui; - -import picross.engine.PicrossException; - -import picross.specific.ui.MenuController; -import picross.specific.ui.MenuUI; -import picross.specific.ui.WaitMenuUI; - -/** - * @author Y. Norsa - */ -public final class WaitMenuMediator extends MenuMediator { - /*** Method overriden from MenuMediator ***/ - - /** {@inheritDoc} */ - @Override - protected MenuUI initView(PicrossUI ui, MenuController controller) - throws PicrossException { - - return new WaitMenuUI(); - } -} - Added: branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java =================================================================== --- branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java (rev 0) +++ branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java 2013-01-14 10:48:50 UTC (rev 116) @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * Copyright (c) 2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.ui; + +import picross.common.ui.AbstractWaitMenuMediator; + +public final class WaitMenuMediator extends AbstractWaitMenuMediator { } Property changes on: branches/engine_split/common/src/picross/specific/ui/WaitMenuMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Added: branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java =================================================================== --- branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java (rev 0) +++ branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java 2013-01-14 10:48:50 UTC (rev 116) @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * Copyright (c) 2008 + * + * This software is governed by the CeCILL license under French law and + * abiding by the rules of distribution of free software. You can use, + * modify and/ or redistribute the software under the terms of the CeCILL + * license as circulated by CEA, CNRS and INRIA at the following URL + * "http://www.cecill.info". + * + * As a counterpart to the access to the source code and rights to copy, + * modify and redistribute granted by the license, users are provided only + * with a limited warranty and the software's author, the holder of the + * economic rights, and the successive licensors have only limited + * liability. + * + * In this respect, the user's attention is drawn to the risks associated + * with loading, using, modifying and/or developing or reproducing the + * software by the user in light of its specific status of free software, + * that may mean that it is complicated to manipulate, and that also + * therefore means that it is reserved for developers and experienced + * professionals having in-depth computer knowledge. Users are therefore + * encouraged to load and test the software's suitability as regards their + * requirements in conditions enabling the security of their systems and/or + * data to be ensured and, more generally, to use and operate it in the + * same conditions as regards security. + * + * The fact that you are presently reading this means that you have had + * knowledge of the CeCILL license and that you accept its terms. + */ + + +package picross.specific.ui; + +import picross.common.ui.AbstractWaitMenuMediator; + +public final class WaitMenuMediator extends AbstractWaitMenuMediator { } Property changes on: branches/engine_split/swing/src/picross/specific/ui/WaitMenuMediator.java ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yva...@us...> - 2013-01-14 09:30:41
|
Revision: 115 http://sourceforge.net/p/picross/code/115 Author: yvan_norsa Date: 2013-01-14 09:30:39 +0000 (Mon, 14 Jan 2013) Log Message: ----------- android integration into build script Modified Paths: -------------- branches/engine_split/android/custom_rules.xml Added Paths: ----------- branches/engine_split/android/extraData/ branches/engine_split/android/extraData/gameModes/ Removed Paths: ------------- branches/engine_split/android/extraData/META-INF/services/ branches/engine_split/android/servicesData/ Modified: branches/engine_split/android/custom_rules.xml =================================================================== --- branches/engine_split/android/custom_rules.xml 2013-01-14 09:29:22 UTC (rev 114) +++ branches/engine_split/android/custom_rules.xml 2013-01-14 09:30:39 UTC (rev 115) @@ -1,10 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project name="PicrossDroid-custom"> + <target name="-post-compile"> + <copy todir="${out.classes.absolute.dir}/picross"> + <fileset dir="extraData/picross" /> + </copy> + </target> + <target name="-post-package"> <jar destfile="${out.packaged.file}" update="true"> - <fileset dir="servicesData"/> + <fileset dir="extraData/gameModes"/> </jar> </target> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |