Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main.java:
- ======================================================================================================================================
- package engineTest;
- import static org.lwjgl.glfw.GLFW.*;
- import static renderEngine.displayManager.*;
- public class Main {
- public static void main(String[] args) {
- window = glfwCreateWindow(WIDTH, HEIGHT, "Farm Game", glfwGetPrimaryMonitor(), 0);
- while(!glfwWindowShouldClose(window)) {
- updateDisplay();
- }
- glfwDestroyWindow(window);
- }
- }
- ======================================================================================================================================
- displayManager.java
- ======================================================================================================================================
- package renderEngine;
- import static org.lwjgl.glfw.GLFW.*;
- import org.lwjgl.opengl.GL11;
- public class displayManager {
- public static int WIDTH = 1280;
- public static int HEIGHT = 720;
- private static int FPS_CAP = 120;
- public static long window;
- public static void createDisplay() {
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
- glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- GL11.glViewport(0, 0, WIDTH, HEIGHT);
- }
- public static void updateDisplay() {
- glfwPollEvents();
- glfwSwapBuffers(FPS_CAP);
- }
- public static void closeDisplay() {
- glfwDestroyWindow(window);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement