package Standard; public class MainComponemt { public static final int WIDTH = 800; public static final int HEIGHT = 600; public static final String TITLE = "TSudio Gaming SDK"; private boolean isRunnuning; public MainComponemt() { isRunnuning = false; } public void start() { if(isRunnuning) { return; } run(); } public void stop() { if(!isRunnuning) { return; } isRunnuning = false; } private void run() { isRunnuning = true; while(isRunnuning) { if (Window.isCloseRequested()) { stop(); } } cleanup(); } @SuppressWarnings("unused") private void render() { Window.render(); } private void cleanup() { Window.dispose(); } public static void main(String[] args) { Window.createWindow(WIDTH, HEIGHT, TITLE); MainComponemt game = new MainComponemt(); game.start(); } }
package Standard; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; public class Window { public static void createWindow(int width, int height, String title) { Display.setTitle(title); try { Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); Keyboard.create(); Mouse.create(); } catch (LWJGLException e) { e.printStackTrace(); } } public static void render() { Display.update(); } public static void dispose() { Display.destroy(); Keyboard.destroy(); Mouse.destroy(); } public static boolean isCloseRequested() { return Display.isCloseRequested(); } public static int getWidth() { return Display.getDisplayMode().getWidth(); } public static int getHeight() { return Display.getDisplayMode().getHeight(); } public static String getTitle() { return Display.getTitle(); } }