Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import static org.lwjgl.glfw.GLFW.*;
  2. import org.lwjgl.glfw.GLFWVidMode;
  3. public class Okno {
  4.     public static void main(String[] args) {
  5.        
  6.         if(!glfwInit()) {
  7.             throw new IllegalStateException("Błąd wczytania GLFW!");
  8.            
  9.         }
  10.        
  11.         glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
  12.         long window = glfwCreateWindow(640, 480, "My LWGJL", 0, 0);
  13.        
  14.         if(window == 0) {
  15.             throw new IllegalStateException("Nie można wczytać okna");
  16.         }
  17.        
  18.         GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
  19.        
  20.         glfwSetWindowPos(window, (videoMode.width() - 640)/2, (videoMode.height() - 480) /2);
  21.    
  22.         glfwShowWindow(window);
  23.        
  24.         while(!glfwWindowShouldClose(window)) {
  25.             glfwPollEvents();
  26.         }
  27.         glfwTerminate();
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement