Jelajahi Sumber

Utilize scaling to make sprites fit on whatever space they have available.
Prepare the ground for better sprites down the line.

Reddo 5 tahun lalu
induk
melakukan
65d5d20c35
1 mengubah file dengan 12 tambahan dan 7 penghapusan
  1. 12 7
      app/Elements/Modules/AnimationHandler.ts

+ 12 - 7
app/Elements/Modules/AnimationHandler.ts

@@ -22,6 +22,7 @@ interface AnimationInstruction {
 module Elements.AnimationHandler {
     var container = document.getElementById("sceneAnimation");
     var stop = true;
+    var originalSpriteSize = 200; // TODO: If ever get an actual artist, increase original sprite size to whatever new art goes for.
     export var animations : Array<AnimationLayer> = [];
     export var animationSpeed = 1500; // how long to complete in ms
     export var lastTime = 0;
@@ -71,17 +72,21 @@ module Elements.AnimationHandler {
 
     function fixVerticalPosition () {
         let availHeight = getSize(true);
-        container.style.marginBottom = (availHeight - 200) + "px";
+        //container.style.marginBottom = (availHeight - 200) + "px";
+        container.style.transform = "scale(" + availHeight / originalSpriteSize + ")";
+        container.style.bottom = (availHeight - originalSpriteSize) / 2 + "px";
+        container.style.width = originalSpriteSize + "px";
+        container.style.height = originalSpriteSize + "px";
     }
 
     export function getSize (fixMin = true) {
-        let tab = document.getElementById("turnContainer");
-        let tab1 = document.getElementById("roomName");
-        tab1.style.marginTop = "";
+        let tab = document.getElementById("currentTurn");
+        //let tab1 = document.getElementById("roomName");
+        //tab1.style.marginTop = "";
         let height = window.innerHeight - tab.clientHeight;
-        if (fixMin && height < 200) {
-            tab1.style.marginTop = (200 - height) + "px";
-            height = 200;
+        if (fixMin && height < originalSpriteSize) {
+            //tab1.style.marginTop = (200 - height) + "px";
+            //height = 200;
         }
         return height;
     }