Skip to content

Commit

Permalink
Adaptive screen size
Browse files Browse the repository at this point in the history
  • Loading branch information
kotborealis committed Jan 13, 2020
1 parent 5c29054 commit 1aa017a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<style>
body {
background: black;
padding: 0;
margin: 0;
}
.emscripten {
display: flex;
Expand All @@ -15,6 +17,12 @@
canvas {
border: 0 none;
background-color: black;
cursor: none;
width: 100vw;
height: 100vh;
padding: 0;
margin: 0;
image-rendering: pixelated;
}
</style>
</head>
Expand Down
12 changes: 10 additions & 2 deletions src/Game.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <emscripten.h>

#include "Enums.h"

#include "Game.h"
Expand Down Expand Up @@ -4271,11 +4273,17 @@ void Game::loadstats( mapclass& map, Graphics& dwgfx )

if (pKey == "window_width")
{
width = atoi(pText);
// width = atoi(pText);
width = EM_ASM_INT({
return window.innerWidth;
});
}
if (pKey == "window_height")
{
height = atoi(pText);
// height = atoi(pText);
height = EM_ASM_INT({
return window.innerHeight;
});
}


Expand Down

0 comments on commit 1aa017a

Please sign in to comment.