-
Notifications
You must be signed in to change notification settings - Fork 1
User Interface for Adjusting Game Preferences #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,6 @@ div { | |
|
|
||
| .base { | ||
| background-color: gray; | ||
| height: 410px; | ||
| width: 410px; | ||
| /*for a 15*15 grid.*/ | ||
| } | ||
|
|
||
| .cell { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "name": "AlbertMineSweeper", | ||
| "version": "0.0.0", | ||
| "homepage": "https://github.com/albertliangcode/AlbertMineSweeper", | ||
| "authors": [ | ||
| "albertliangcode <albertliangcode@gmail.com>" | ||
| ], | ||
| "moduleType": [ | ||
| "amd", | ||
| "es6", | ||
| "globals", | ||
| "node", | ||
| "yui" | ||
| ], | ||
| "license": "MIT", | ||
| "private": true, | ||
| "ignore": [ | ||
| "**/.*", | ||
| "node_modules", | ||
| "bower_components", | ||
| "test", | ||
| "tests" | ||
| ], | ||
| "dependencies": { | ||
| "jquery": "~2.1.3" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,14 +11,15 @@ | |
| <h1>Albert Mine Sweeper</h1> | ||
| <h4>Project Status:</h4> | ||
| <ul> | ||
| <li>Current: End Conditions</li> | ||
| <li>Next: Adjustable Game</li> | ||
| <li>Current: Adjustable GameBoard</li> | ||
| <li>Next: User Interface for: | ||
| <ol> | ||
| <li>Resetting Game</li> | ||
| <li>Adjusting Game Settings</li> | ||
| </ol> | ||
| </li> | ||
| <li>Next: No First-Click Deaths</li> | ||
| <li>Next: End Conditions (UI Freeze)</li> | ||
| <li>Next: Clock</li> | ||
| <li>Next: Scoreboard?</li> | ||
| <li>Next: Match Graphics to MS Minesweeper?</li> | ||
|
|
@@ -32,45 +33,15 @@ <h4>Project Status:</h4> | |
| </ul> | ||
| </li> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the next steps: <li>Refactoring: decouple model from view (separate grid logic from jquery dom manipulation)</li>
<li>tidy up: make the game replay-able</li> |
||
| </ul> | ||
|
|
||
|
|
||
| <form id="gridSetup"> | ||
| Rows: <input type="text" name="rows"><br> | ||
| Columns: <input type="text" name="cols"><br> | ||
| Mines: <input type="text" name="mines"><br><br> | ||
| <input type="submit" value="Refresh Game"><br><br><br> | ||
| </form> | ||
| <div class="base" oncontextmenu="return false;"> | ||
| <div class="row"> | ||
| <!--The "." was needed, or else the margins in some of the cells became | ||
| unbalanced when some cells were visted and others not yet visited.--> | ||
| <div class="cell" data-row="0" data-col="0"></div> | ||
| <div class="cell" data-row="0" data-col="1"></div> | ||
| <div class="cell" data-row="0" data-col="2"></div> | ||
| <div class="cell" data-row="0" data-col="3"></div> | ||
| <div class="cell" data-row="0" data-col="4"></div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="cell" data-row="1" data-col="0"></div> | ||
| <div class="cell" data-row="1" data-col="1"></div> | ||
| <div class="cell" data-row="1" data-col="2"></div> | ||
| <div class="cell" data-row="1" data-col="3"></div> | ||
| <div class="cell" data-row="1" data-col="4"></div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="cell" data-row="2" data-col="0"></div> | ||
| <div class="cell" data-row="2" data-col="1"></div> | ||
| <div class="cell" data-row="2" data-col="2"></div> | ||
| <div class="cell" data-row="2" data-col="3"></div> | ||
| <div class="cell" data-row="2" data-col="4"></div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="cell" data-row="3" data-col="0"></div> | ||
| <div class="cell" data-row="3" data-col="1"></div> | ||
| <div class="cell" data-row="3" data-col="2"></div> | ||
| <div class="cell" data-row="3" data-col="3"></div> | ||
| <div class="cell" data-row="3" data-col="4"></div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="cell" data-row="4" data-col="0"></div> | ||
| <div class="cell" data-row="4" data-col="1"></div> | ||
| <div class="cell" data-row="4" data-col="2"></div> | ||
| <div class="cell" data-row="4" data-col="3"></div> | ||
| <div class="cell" data-row="4" data-col="4"></div> | ||
| </div> | ||
| </div> | ||
| <script type="text/javascript" src="AlbertMineSweeper.script.js"></script> | ||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,11 +25,15 @@ var stopGame = function () { | |
|
|
||
|
|
||
| $(document).ready(function() { | ||
| //Must bind contextmenu event handler to each cell | ||
| //document.oncontextmenu = function() {return false;}; | ||
| var grid = new Grid(5,5,2); | ||
| var report = grid.print(); | ||
|
|
||
| var grid; | ||
| var report; | ||
| $('#gridSetup').submit(function(){ | ||
| var $values = $('#gridSetup').serializeArray(); | ||
| grid = new Grid(parseInt($values[0].value),parseInt($values[1].value),parseInt($values[2].value)); | ||
| // var grid = new Grid(7,7,5); | ||
| report = grid.print(); | ||
| }); // <<<The program kicks me out here.>>> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's hard to know what is happening if you're not familiar with $('#gridSetup').submit(function(e){ // the first and only parameter to this event handler is a JQuery event object
e.preventDefault();
var $values = $('#gridSetup').serializeArray();
... |
||
|
|
||
| $('.cell').mousedown(function(event) { | ||
| var row = $(this).data('row'); | ||
| var col = $(this).data('col'); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't need to do these hacks if you apply the proper CSS rules to the board and cells. Delete the above 3 lines after adding these styles.