qsdwfegrhtjyukil;

pull/12/head
hYdos 2020-02-29 10:41:32 +10:00
parent de06575654
commit 046d92a87a
4 changed files with 6 additions and 10 deletions

View File

@ -50,7 +50,6 @@ public class Litecraft extends Game
this.setupWindow(); this.setupWindow();
Blocks.setup(); // make sure blocks are initialised Blocks.setup(); // make sure blocks are initialised
GingerUtils.init(); // set up ginger utilities GingerUtils.init(); // set up ginger utilities
Window.setBackgroundColour(0.2f, 0.2f, 0.6f); // set the window refresh colour
// set up Ginger3D stuff // set up Ginger3D stuff
this.setupGinger(); this.setupGinger();
this.oldWindowWidth = Window.width; this.oldWindowWidth = Window.width;

View File

@ -122,7 +122,7 @@ public class Ginger
while (!Window.closed()) while (!Window.closed())
{ {
Litecraft.getInstance().ups++; Litecraft.getInstance().ups++;
if (Window.isUpdating()) if (Window.shouldRender())
{ {
timer.tick(); timer.tick();
gingerRegister.game.render(); gingerRegister.game.render();

View File

@ -18,7 +18,7 @@ public class Window
public static int height; public static int height;
private static String title; private static String title;
public static long window; public static long window;
private static Vector3f backgroundColour = new Vector3f(0.2f, 0.2f, 0.2f); private static Vector3f backgroundColour = new Vector3f(118f, 215f, 234f);
private static boolean[] mouseButtons = new boolean[GLFW.GLFW_MOUSE_BUTTON_LAST]; private static boolean[] mouseButtons = new boolean[GLFW.GLFW_MOUSE_BUTTON_LAST];
private static GLFWImage.Buffer iconBuffer = null; private static GLFWImage.Buffer iconBuffer = null;
private static double fpsCap, time, processedTime = 0; private static double fpsCap, time, processedTime = 0;
@ -127,7 +127,7 @@ public class Window
public static boolean isMouseReleased(int keyCode) public static boolean isMouseReleased(int keyCode)
{ return !isMouseDown(keyCode) && mouseButtons[keyCode]; } { return !isMouseDown(keyCode) && mouseButtons[keyCode]; }
public static boolean isUpdating() public static boolean shouldRender()
{ {
double nextTime = getTime(); double nextTime = getTime();
double passedTime = nextTime - time; double passedTime = nextTime - time;
@ -144,9 +144,6 @@ public class Window
public static void lockMouse() public static void lockMouse()
{ GLFW.glfwSetInputMode(window, GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_DISABLED); } { GLFW.glfwSetInputMode(window, GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_DISABLED); }
public static void setBackgroundColour(float r, float g, float b)
{ backgroundColour = new Vector3f(r, g, b); }
private static void setIcon() private static void setIcon()
{ {
Image icon = Image.createImage("/icon.png"); Image icon = Image.createImage("/icon.png");
@ -180,7 +177,7 @@ public class Window
width = widthBuffer.get(0); width = widthBuffer.get(0);
height = heightBuffer.get(0); height = heightBuffer.get(0);
GL11.glViewport(0, 0, width, height); GL11.glViewport(0, 0, width, height);
GL11.glClearColor(backgroundColour.x, backgroundColour.y, backgroundColour.z, 1.0f); GL11.glClearColor(backgroundColour.x/255, backgroundColour.y/255, backgroundColour.z/255, 1.0f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GLFW.glfwPollEvents(); GLFW.glfwPollEvents();
newX = Window.getMouseX(); newX = Window.getMouseX();

View File

@ -20,8 +20,8 @@ const vec4 plane = vec4(0, -1, 0, 15);
uniform float useFakeLighting; uniform float useFakeLighting;
const float density = 0.025; const float density = 0.0025;
const float gradient = 1.0; const float gradient = 10.0;
void main(void){ void main(void){