<commit_before>package com.jed.core;

import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J;

import com.jed.state.DiscoState;
import com.jed.state.GameStateManager;
import com.jed.state.PlayState;

/**
 * @author jlinde
 */
public class MotherBrain {

    private static final Logger LOGGER = LoggerFactory.getLogger(MotherBrain.class);

    public static final int WIDTH = 1024;
    public static final int HEIGHT = 768;

    private long lastFrame;
    private int fps;
    private long lastFPS;

    private GameStateManager stateManager;

    /**
     * @param args
     * @see <a href="http://projects.lidalia.org.uk/sysout-over-slf4j/quickstart.html">System Out and Err redirected to SLF4J</a>
     */
    public static void main(String[] args) {
        SysOutOverSLF4J.sendSystemOutAndErrToSLF4J();
    }

    private void init() {
        stateManager = new GameStateManager();
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new PlayState(stateManager));
//
//        MainMenu one = new MainMenu(stateManager);
//        one.setDaString("Hello there!");
//        one.setCoords(new Vector(20,20));
//
//        stateManager.push(one);

        getDelta();
        lastFPS = getTime();
    }

    public void start() {
        try {

            // DisplayMode displayMode = Display.getDesktopDisplayMode();
            // HEIGHT = displayMode.getHeight();
            // WIDTH = displayMode.getWidth();

            Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
            Display.setFullscreen(true);
            Display.create();

        } catch (LWJGLException e) {
            LOGGER.error("An exception occurred while creating the display", e);
            System.exit(1);
        }

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(0, WIDTH, HEIGHT, 0, -1, 1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        init();

        while (!Display.isCloseRequested()) {
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);

            //int delta = getDelta();

            updateFPS();

            stateManager.update();
            stateManager.draw();

            Display.update();

            Display.sync(120);
        }

        Display.destroy();
    }

    public int getDelta() {
        long time = getTime();
        int delta = (int) (time - lastFrame);
        lastFrame = time;
        return delta;
    }

    public long getTime() {
        return (Sys.getTime() * 1000) / Sys.getTimerResolution();
    }

    public void updateFPS() {
        if (getTime() - lastFPS > 1000) {
            Display.setTitle("FPS: " + fps);<commit_msg>Made methods private where applicable.<commit_after>package com.jed.core;

import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J;

import com.jed.state.DiscoState;
import com.jed.state.GameStateManager;
import com.jed.state.PlayState;

/**
 * @author jlinde
 */
public class MotherBrain {

    private static final Logger LOGGER = LoggerFactory.getLogger(MotherBrain.class);

    public static final int WIDTH = 1024;
    public static final int HEIGHT = 768;

    private long lastFrame;
    private int fps;
    private long lastFPS;

    private GameStateManager stateManager;

    /**
     * @param args
     * @see <a href="http://projects.lidalia.org.uk/sysout-over-slf4j/quickstart.html">System Out and Err redirected to SLF4J</a>
     */
    public static void main(String[] args) {
        SysOutOverSLF4J.sendSystemOutAndErrToSLF4J();
    }

    private void init() {
        stateManager = new GameStateManager();
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new DiscoState(stateManager));
        stateManager.push(new PlayState(stateManager));
//
//        MainMenu one = new MainMenu(stateManager);
//        one.setDaString("Hello there!");
//        one.setCoords(new Vector(20,20));
//
//        stateManager.push(one);

        getDelta();
        lastFPS = getTime();
    }

    public void start() {
        try {

            // DisplayMode displayMode = Display.getDesktopDisplayMode();
            // HEIGHT = displayMode.getHeight();
            // WIDTH = displayMode.getWidth();

            Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
            Display.setFullscreen(true);
            Display.create();

        } catch (LWJGLException e) {
            LOGGER.error("An exception occurred while creating the display", e);
            System.exit(1);
        }

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(0, WIDTH, HEIGHT, 0, -1, 1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        init();

        while (!Display.isCloseRequested()) {
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);

            //int delta = getDelta();

            updateFPS();

            stateManager.update();
            stateManager.draw();

            Display.update();

            Display.sync(120);
        }

        Display.destroy();
    }

    private int getDelta() {
        long time = getTime();
        int delta = (int) (time - lastFrame);
        lastFrame = time;
        return delta;
    }

    private long getTime() {
        return (Sys.getTime() * 1000) / Sys.getTimerResolution();
    }

    private void updateFPS() {
        if (getTime() - lastFPS > 1000) {
            Display.setTitle("FPS: " + fps);
{'fraction_non_alphanumeric': 0.11612810155799193, 'fraction_numerical': 0.023946912867859205, 'mean_word_length': 2.5517418032786887, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '923143', 'n_tokens_mistral': 2350, 'n_tokens_neox': 2188, 'n_words': 397}