Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added some borders

  • Loading branch information...
commit b932fe2a5e555febd56bff749186516c7d74146a 1 parent 467bb93
@rdragon rdragon authored
View
22 .gitignore
@@ -1,16 +1,6 @@
-output/
-win32port/ipch/
-win32port/Debug*/
-win32port/server/Debug*/
-win32port/server/Release*/
-win32port/client/Debug*/
-win32port/client/Release*/
-win32port/libwebsocketswin32/Debug*/
-win32port/libwebsocketswin32/Release*/
-win32port/zlib/Debug*/
-win32port/zlib/Release*/
-*.vcxproj.user
-*.sdf
-*.suo
-Makefile.in
-Makefile
+*~
+server.o
+stderr
+core
+gedit.sh
+.fuse_hidden*
View
8 client/canvaslayers.js
@@ -34,8 +34,8 @@
this.bkgCvs = document.createElement('canvas');
this.bkgCvsId = this.holderID+"_bkg";
this.bkgCvs.setAttribute('id', this.bkgCvsId);
- this.bkgCvs.setAttribute('width', this.holderNode.offsetWidth);
- this.bkgCvs.setAttribute('height', this.holderNode.offsetHeight);
+ this.bkgCvs.setAttribute('width', this.holderNode.clientWidth);
+ this.bkgCvs.setAttribute('height', this.holderNode.clientHeight);
this.bkgCvs.style.backgroundColor = "transparent";
if (bkgColor != undefined)
this.bkgCvs.style.backgroundColor = bkgColor;
@@ -62,8 +62,8 @@
this.ovlyNumber++; // increment the count to make unique ids
newCvs.setAttribute('id', ovlId);
- newCvs.setAttribute('width', this.holderNode.offsetWidth);
- newCvs.setAttribute('height', this.holderNode.offsetHeight);
+ newCvs.setAttribute('width', this.holderNode.clientWidth);
+ newCvs.setAttribute('height', this.holderNode.clientHeight);
newCvs.style.backgroundColor = "transparent";
newCvs.style.position = "absolute";
newCvs.style.left = "0px";
View
24 client/game.js
@@ -423,15 +423,23 @@ GameEngine.prototype.addPlayer = function(player) {
/* i wanted to do this in css but it isn't possible to do full height minus
* fixed number of pixels */
GameEngine.prototype.calcScale = function() {
- var target = document.getElementById('content');
- var targetWidth = target.offsetWidth;
- var targetHeight = window.innerHeight;
+ var sidebar = document.getElementById('sidebar');
+ this.targetWidth = document.body.clientWidth - sidebar.offsetWidth - 1;
+ this.targetHeight = document.body.clientHeight - 1;
if(false) { // for mobile devices
- targetWidth = window.innerWidth;
+ this.targetWidth = window.innerWidth;
+ }
+
+ var scaleX = this.targetWidth/ this.width;
+ var scaleY = this.targetHeight/ this.height;
+ if(scaleX < scaleY) {
+ this.targetHeight = Math.round(this.height * scaleX);
+ this.scale = scaleX;
+ }else {
+ this.targetWidth = Math.round(this.width * scaleY);
+ this.scale = scaleY;
}
-
- this.scale = Math.min(targetWidth/ this.width, targetHeight/ this.height);
}
GameEngine.prototype.start = function(startPositions, startTime) {
@@ -450,8 +458,8 @@ GameEngine.prototype.start = function(startPositions, startTime) {
this.calcScale();
var container = document.getElementById(this.containerId);
- container.style.width = Math.floor(this.width * this.scale) + 'px';
- container.style.height = Math.floor(this.height * this.scale) + 'px';
+ container.style.width = this.targetWidth + 'px';
+ container.style.height = this.targetHeight + 'px';
/* create canvas stack */
this.canvasStack = new CanvasStack(this.containerId, canvasBgcolor);
View
11 client/index.html
@@ -12,12 +12,10 @@
<script src="game.js"></script>
</head>
<body>
- <div id="offset">
- <div id="content">
- <div id="gameContainer">
- <div id="canvasContainer"></div>
- <div id="status"></div>
- </div>
+ <div id="content">
+ <div id="gameContainer">
+ <div id="canvasContainer"></div>
+ <div id="status"></div>
</div>
</div>
@@ -25,7 +23,6 @@
<div id="lobbyOptions">
<input type="text" id="playername" placeholder="playername" />
<button id="lobby">Join Lobby</button>
-
</div>
<div id="gameOptions">
View
33 client/wide.css
@@ -2,18 +2,14 @@ body, html {
margin: 0;
padding: 0;
overflow: hidden;
+ width: 100%;
+ height: 100%;
}
body {
font-family: Arial, Helvetica, sans-serif;
text-align: center;
-}
-
-#offset {
- height: 100%;
- width: 100%;
- float: right;
- margin-left: -320px;
+ background-color: #F0F0F0;
}
table {
@@ -21,16 +17,26 @@ table {
}
#content {
- margin-left: 320px;
-}
-
-#gameContainer {
- position: relative;
+ top: 0;
+ left: 320px;
+ position: fixed;
}
#sidebar {
padding: 5px;
- width: 310px;
+ width: 309px;
+ height: 100%;
+ background-color: white;
+ border-right: 1px solid #808080;
+ position: fixed;
+ left: 0;
+ top: 0;
+}
+
+#canvasContainer {
+ position: relative;
+ border-bottom: 1px solid #808080;
+ border-right: 1px solid #808080;
}
canvas {
@@ -52,7 +58,6 @@ ul {
}
li {
- max-width: 800px;
word-wrap: break-word;
}
View
2  test-server/.gitignore
@@ -1,2 +0,0 @@
-server.o
-stderr
Please sign in to comment.
Something went wrong with that request. Please try again.