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

canvas resizing and plate refactoring #152

Merged
merged 4 commits into from
Jun 19, 2016
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<style>
body {
margin: 0;
background-color: black;
color: white;
}
canvas {
margin: 0 auto;
}
</style>
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<style>
body {
margin: 0;
background-color: black;
color: white;
}
canvas {
margin: 0 auto;
}
</style>
</head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// we create the global game object, an instance of Phaser.Game

var game = new Phaser.Game(800, 500, Phaser.AUTO, 'world');
var game = new Phaser.Game(800, 500, Phaser.AUTO);

// the first parameter is the key you use to jump between stated
// the key must be unique within the state manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ consumer.State001.prototype = {

// the Text is positioned at 0, 100
//text = game.add.text(0, 0, "phaser 2.4 text bounds", style);


this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;

}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions components/com_battle/views/plate/tmpl/002_dada/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<html>
<head>
<!-- Phaser -->
<script src="/components/com_battle/includes/phaser.js"></script>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<div id="world">
</div>
<script src='state001.js'></script>
<script src='script.js'></script>
</body>
</html>




11 changes: 11 additions & 0 deletions components/com_battle/views/plate/tmpl/002_dada/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// we create the global game object, an instance of Phaser.Game

var game = new Phaser.Game(800, 500, Phaser.AUTO, 'world');

// the first parameter is the key you use to jump between stated
// the key must be unique within the state manager
// the second parameter is the object that contains the state code
// these come from the js files we included in the head tag in the html file
game.state.add('State001', dada.State001);

game.state.start('State001');
34 changes: 34 additions & 0 deletions components/com_battle/views/plate/tmpl/002_dada/state001.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// defining a single global object (dada) and adding some functions in to its prototype (eg preload, create functions)

var dada = {};


dada.State001 = function (game) {


};

dada.State001.prototype = {

preload: function () {

// You can fill the preloader with as many assets as your game requires

// Here we are loading an image. The first parameter is the unique
// string by which we'll identify the image later in our code.

// The second parameter is the URL of the image (relative)
this.load.image('plate', 'bg.jpg');

},
create: function () {

// This creates a simple sprite that is using our loaded image and
// displays it on-screen and assign it to a variable
var image = this.add.sprite(game.world.centerX, game.world.centerY, 'plate');

// Moves the image anchor to the middle, so it centers inside the game properly
image.anchor.set(0.5);

}
}
75 changes: 75 additions & 0 deletions components/com_battle/views/plate/tmpl/002_dada/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* RGBA -> Red Green Blue Alpha

Alpha channel = value of 0% is fully transparent, a value of 100% is fully opaque

rgba(0,0,0,1); -> black
rgba(123,123,123,1); -> grey
rgba(203,203,203,1); -> light grey
rgba(255,255,255,1); -> white

rgba(255,0,0,1); -> red
rgba(0,255,0,1); -> green
rgba(0,0,255,1); -> blue

*/

*, *:before, *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}


body {
font-family:arial, sans-serif;
color:rgb(0,0,0);
}

#container {
/*background: rgba(203,203,203,1);
background-image: url(guides50x50.png);*/
margin: 0 auto;
width: 600px;
height:482px;
/*padding: 10px;*/
text-align: center;
/*border: 3px solid rgba(123,123,123,1);*/
overflow:hidden;
}

h3#title {
color:rgba(255,255,255,1);
background:rgba(0,0,255,1);
margin:0;
}

canvas {}

a {color:rgb(0,0,0);}
a:hover {color:rgb(255,255,255);}

#container p {
text-align:left;
}

#float_left {
float:left;
background: rgba(255,0,0,1);
margin: 10px ;
width: 245px;
padding: 10px;
border: 1px solid rgba(0,0,0,1);
}

#float_right {
float: right;
background: rgba(0,255,0,1);
margin: 10px;
width: 245px;
padding: 10px;
border: 1px solid rgba(0,0,0,1);
}

#float_left:hover,
#float_right:hover {
background: rgba(0,0,0,1);
color: rgba(255,255,255,1);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<head>
<!-- Phaser -->
<script src="/components/com_battle/includes/phaser.js"></script>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<div id="world">
</div>
<script src='state001.js'></script>
<script src='script.js'></script>
</body>
</html>



Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<!-- Phaser -->
<script src="/components/com_battle/includes/phaser.js"></script>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<div id="world">
</div>
<script src='state001.js'></script>
<script src='script.js'></script>
</body>
</html>

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

<html>
<head>
<!-- Phaser -->
<script src="../../../phaser/tmpl/_site/js/phaser.js"></script>

<style>
body {
margin: 0;
}
</style>
</head>

<body>

<div id="world">
</div>

<script src='/components/com_battle/views/plate/tmpl/001_consumer/script.js'></script>

</body>
</html>


Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// we create the global game object, an instance of Phaser.Game

var game = new Phaser.Game(800, 500, Phaser.AUTO, 'world');

// the first parameter is the key you use to jump between stated
// the key must be unique within the state manager
// the second parameter is the object that contains the state code
// these come from the js files we included in the head tag in the html file
game.state.add('State001', mother_of_the_matrix.State001);

game.state.start('State001');
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{"frames": [

{
"filename": "object001",
"frame": {"x":0,"y":0,"w":418,"h":151},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":0,"w":418,"h":151},
"sourceSize": {"w":418,"h":2500}
}
,{
"filename": "object002",
"frame": {"x":0,"y":152,"w":192,"h":275},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":0,"w":192,"h":275},
"sourceSize": {"w":418,"h":2500}
}
,{
"filename": "object003",
"frame": {"x":0,"y":428,"w":251,"h":201},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":0,"w":251,"h":201},
"sourceSize": {"w":418,"h":2500}
}
,{
"filename": "object004",
"frame": {"x":0,"y":629,"w":251,"h":201},
"rotated": false,
"trimmed": true,
"spriteSourceSize": {"x":0,"y":0,"w":251,"h":201},
"sourceSize": {"w":418,"h":2500}
}

]}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading