Skip to content
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

Fix setup page issues #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/game_border2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
<div class="players"> 1P </div>

<div class="sliders">
<div id="level_slider"></div>
<div id="level_slider">
<canvas id="level_canvas" width="400" height="100"></canvas>
</div>
</div>

<div id="level_amount" class="levels amount level-number"> 0 </div>
Expand Down
76 changes: 61 additions & 15 deletions javascripts/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
var speeds = ["LOW", "MED", "HI"];
var musics = ["FEVER", "CHILD", "OFF"];
drawingConfig = {
level_count: 20,
level_line_size: 340,
level_start_x: 20,
level_start_y: 5,
level_end_y: 15,
level_slice_size: 16
};

function Setup() {
this.level = $( "#level_slider" ).slider( "value" );
Expand All @@ -13,6 +21,37 @@ function start(){
window.location.href = "./src/play_game.html?" + jQuery.param(settings);
};

function drawLevelLine(){
var canvas = document.getElementById("level_canvas"),
context = canvas.getContext("2d");

context.strokeStyle = 'white';
context.lineWidth = 2;

context.beginPath();
context.moveTo(drawingConfig.level_start_x, 10);
context.lineTo(drawingConfig.level_line_size, 10);
context.stroke();
context.closePath();

for (i=0; i <= drawingConfig.level_count; i++){
var x = drawingConfig.level_start_x + i * drawingConfig.level_slice_size,
start_y = drawingConfig.level_start_y,
end_y = drawingConfig.level_end_y;

if(i % 5 == 0){
start_y -= 5;
end_y += 5;
}

context.beginPath();
context.moveTo(x, start_y);
context.lineTo(x, end_y);
context.stroke();
context.closePath();
}
}

$(function(){
$( "#level_slider" ).slider({
value:0,
Expand All @@ -21,38 +60,45 @@ $(function(){
step: 1,
slide: function( event, ui ) {
$( "#level_amount" ).html( ui.value );
$( "#level_title").addClass('border');
$( "#music_title").removeClass('border');
$( "#speed_title").removeClass('border');
}
});

$( "#speed_slider" ).slider({
min: 0,
max: speeds.length - 1,
step: 1,
slide: function( event, ui ) {
$( "#speed_title").addClass('border');
$( "#level_title").removeClass('border');
$( "#music_title").removeClass('border');
}
step: 1
});

$( "#music_slider" ).slider({
min: 0,
max: musics.length - 1,
step: 1,
slide: function( event, ui ) {
$( "#music_title").addClass('border');
$( "#level_title").removeClass('border');
$( "#speed_title").removeClass('border');
}
step: 1
});

$("#play").bind('click', function(){
start();
return false;
});

drawLevelLine();

$('#level_slider .ui-slider-handle').focus(function() {
$("#level_title").addClass('border');
$("#speed_title").removeClass('border');
$("#music_title").removeClass('border');
});

$('#speed_slider .ui-slider-handle').focus(function() {
$("#speed_title").addClass('border');
$("#level_title").removeClass('border');
$("#music_title").removeClass('border');
});

$('#music_slider .ui-slider-handle').focus(function() {
$("#music_title").addClass('border');
$("#speed_title").removeClass('border');
$("#level_title").removeClass('border');
});
});

window.addEventListener('keydown', function(e) {
Expand Down
24 changes: 18 additions & 6 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ html {
background-position: center;
border-bottom: 0px; }

input:focus,
select:focus,
textarea:focus {
outline: none; }

.pane {
width: 55%;
background: black;
Expand All @@ -320,17 +325,19 @@ html {
background-position: center;
z-index: 1; }
.pane .border {
border: 3px solid #CC7A29;
border: 3px solid #CC7A29 !important;
padding: 5px;
width: 200px;
border-radius: 6px; }
.pane .option {
margin: 60px 40px; }
margin: 70px 40px; }
.pane .option .title {
border: 3px solid transparent;
width: 200px;
color: #FFB870;
padding: 5px;
padding: 7px;
clear: both;
margin: 22px 0px; }
margin: 30px 0px; }
.pane .option .players {
float: left;
width: 10%; }
Expand All @@ -352,7 +359,7 @@ html {
.pane .option .levels {
float: right;
width: 10%;
margin: -50px 40px; }
margin: -50px; }
.pane .option .speeds {
float: left;
width: 10%;
Expand All @@ -374,14 +381,19 @@ html {
height: 20px;
text-align: center; }

.ui-slider.ui-slider-horizontal.ui-widget.ui-widget-content.ui-corner-all {
width: 320px; }

.ui-slider-handle.ui-state-default.ui-corner-all {
background: black;
margin: -16px 0px;
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid #B2B26B; }
border-top: 20px solid #B2B26B;
border-bottom: 0px solid #B2B26B;
outline: none; }

.ui-slider.ui-slider-horizontal.ui-widget.ui-widget-content.ui-corner-all {
background: black;
Expand Down
24 changes: 19 additions & 5 deletions styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@ margin: 25px -125px 0 0;
border-bottom: 0px;
}

input:focus,
select:focus,
textarea:focus {
outline: none;
}

.pane{
width: 55%;
background: black;
Expand All @@ -348,19 +354,21 @@ margin: 25px -125px 0 0;
z-index: 1;

.border{
border: 3px solid #CC7A29;
border: 3px solid #CC7A29 !important;
padding: 5px;
width: 200px;
border-radius: 6px;
}

.option{
margin: 60px 40px;
margin: 70px 40px;
.title{
border: 3px solid transparent;
width: 200px;
color: #FFB870;
padding: 5px;
padding: 7px;
clear: both;
margin: 22px 0px;
margin: 30px 0px;
}
.players{
float: left;
Expand All @@ -385,7 +393,7 @@ margin: 25px -125px 0 0;
.levels{
float: right;
width: 10%;
margin: -50px 40px;
margin: -50px;
}
.speeds{
float: left;
Expand Down Expand Up @@ -414,6 +422,10 @@ margin: 25px -125px 0 0;
text-align: center;
}

.ui-slider.ui-slider-horizontal.ui-widget.ui-widget-content.ui-corner-all{
width: 320px;
}

.ui-slider-handle.ui-state-default.ui-corner-all{
background: black;
margin: -16px 0px;
Expand All @@ -422,6 +434,8 @@ margin: 25px -125px 0 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid #B2B26B;
border-bottom: 0px solid #B2B26B;
outline: none;
}

.ui-slider.ui-slider-horizontal.ui-widget.ui-widget-content.ui-corner-all{
Expand Down