Advertisement
Guest User

Source code for takochako's game

a guest
Feb 13th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. Main.java:
  2. ======================================================================================================================================
  3. package engineTest;
  4.  
  5. import static org.lwjgl.glfw.GLFW.*;
  6.  
  7. import static renderEngine.displayManager.*;
  8.  
  9. public class Main {
  10.    
  11.     public static void main(String[] args) {
  12.        
  13.         window = glfwCreateWindow(WIDTH, HEIGHT, "Farm Game", glfwGetPrimaryMonitor(), 0);
  14.        
  15.         while(!glfwWindowShouldClose(window)) {
  16.            
  17.             updateDisplay();
  18.            
  19.         }
  20.        
  21.         glfwDestroyWindow(window);
  22.        
  23.     }
  24.    
  25. }
  26. ======================================================================================================================================
  27. displayManager.java
  28. ======================================================================================================================================
  29. package renderEngine;
  30.  
  31. import static org.lwjgl.glfw.GLFW.*;
  32.  
  33. import org.lwjgl.opengl.GL11;
  34.  
  35. public class displayManager {
  36.    
  37.     public static int WIDTH = 1280;
  38.     public static int HEIGHT = 720;
  39.     private static int FPS_CAP = 120;
  40.    
  41.     public static long window;
  42.    
  43.     public static void createDisplay() {
  44.        
  45.         glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
  46.         glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
  47.         glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
  48.         glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  49.        
  50.         GL11.glViewport(0, 0, WIDTH, HEIGHT);
  51.     }
  52.    
  53.     public static void updateDisplay() {
  54.        
  55.         glfwPollEvents();
  56.         glfwSwapBuffers(FPS_CAP);
  57.        
  58.     }
  59.    
  60.     public static void closeDisplay() {
  61.        
  62.         glfwDestroyWindow(window);
  63.        
  64.     }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement