ソースを参照

fixed wrong view width and height at startup

Kajetan Johannes Hammerle 5 年 前
コミット
61934652c5

+ 2 - 1
src/me/hammerle/snuviengine/api/Engine.java

@@ -1,5 +1,6 @@
 package me.hammerle.snuviengine.api;
 
+import me.hammerle.snuviengine.api.Shader;
 import org.lwjgl.glfw.*;
 import org.lwjgl.opengl.*;
 import static org.lwjgl.glfw.Callbacks.*;
@@ -61,7 +62,7 @@ public abstract class Engine
         glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
         glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
 
-        window = glfwCreateWindow(Shader.getViewWidth(), Shader.getViewHeight(), "SnuviEngine " + VERSION, NULL, NULL);
+        window = glfwCreateWindow(Shader.BASE_WIDTH, Shader.BASE_HEIGHT, "SnuviEngine " + VERSION, NULL, NULL);
         if(window == NULL)
         {
             throw new RuntimeException("Failed to create the GLFW window");

+ 6 - 3
src/me/hammerle/snuviengine/api/Shader.java

@@ -16,8 +16,11 @@ public final class Shader
 {
     private static int program = -1;
     
-    private static int width = 1024;
-    private static int height = 620;
+    public final static int BASE_WIDTH = 1024;
+    public final static int BASE_HEIGHT = 620;
+    
+    private static int width = 512;
+    private static int height = 310;
     private static int scale = 2;
     
     private static final List<Runnable> TASKS = new LinkedList<>();
@@ -83,7 +86,7 @@ public final class Shader
         unifMixColorLoc = glGetUniformLocation(program, "mixColor");
         setMixColor(0.0f, 0.0f, 0.0f, 0.0f);
         
-        setViewPort(width, height);
+        setViewPort(BASE_WIDTH, BASE_HEIGHT);
         initDone = true;
     }