package com.jukusoft.renderer2d.prototyp;

import com.jukusoft.renderer2d.prototyp.engine.window.IWindow;
import com.jukusoft.renderer2d.prototyp.engine.glfw.GLFWUtils;
import com.jukusoft.renderer2d.prototyp.engine.glfw.GLFWWindow;
import com.jukusoft.renderer2d.prototyp.engine.window.callback.AbstractKeyCallback;
import com.jukusoft.renderer2d.prototyp.engine.window.callback.KeyCallback;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

import static org.lwjgl.glfw.GLFW.glfwPollEvents;
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
import static org.lwjgl.opengl.GL11.glClear;
import static org.lwjgl.opengles.GLES20.GL_COLOR_BUFFER_BIT;

/**
 * Created by Justin on 21.08.2016.
 */
public class Main {

    public static void main (String[] args) {
        //configure log4j to log to console
        BasicConfigurator.configure();

        //log message
        Logger.getRootLogger().info("initialize GLFW now.");

        //initialize GLFW
        GLFWUtils.init();

        //create new GLFW window
        IWindow window = new GLFWWindow(600, 400, "Window title");
        window.create();

        //set window title
        window.setTitle("Window Title");

        //set key callback
        window.addKeyCallback(new AbstractKeyCallback() {
            @Override
            public boolean keyPressed(int key) {
                Logger.getRootLogger().info("key pressed.");

                //execute other callbacks
                return true;
            }

            @Override
            public boolean keyReleased(int key) {
                Logger.getRootLogger().info("key released.");

                //execute other callbacks
                return true;
            }
        });

        //show window
        window.setVisible(true);

        //prepare rendering and create GL capabilities like GL.createCapabilities()
        window.prepareRendering();

        //renderer loop
        while (!window.shouldClose()) {
            //clear framebuffer
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

            //swap back and front buffers
            window.swap();

            //process input events and call callbacks
            window.processInput();
        }

        Logger.getRootLogger().info("window was closed by user.");

        //close window
        window.destroy();

        //log message
        Logger.getRootLogger().info("shutdown GLFW now.");

        //shutdown GLFW
        GLFWUtils.shutdownGLFW();
    }

}

@@ -885,1278 +885,137 @@
   //
-log message%0A        Logger.getRootLogger().info(%22initialize GLFW now.%22);%0A%0A        //initialize GLFW%0A        GLFWUtils.init();%0A%0A        //create new GLFW window%0A        IWindow window = new GLFWWindow(600, 400, %22Window title%22);%0A        window.create();%0A%0A        //set window title%0A        window.setTitle(%22Window Title%22);%0A%0A        //set key callback%0A        window.addKeyCallback(new AbstractKeyCallback() %7B%0A            @Override%0A            public boolean keyPressed(int key) %7B%0A                Logger.getRootLogger().info(%22key pressed.%22);%0A%0A                //execute other callbacks%0A                return true;%0A            %7D%0A%0A            @Override%0A            public boolean keyReleased(int key) %7B%0A                Logger.getRootLogger().info(%22key released.%22);%0A%0A                //execute other callbacks%0A                return true;%0A            %7D%0A        %7D);%0A%0A        //show window%0A        window.setVisible(true);%0A%0A        //prepare rendering and create GL capabilities like GL.createCapabilities()%0A        window.prepareRendering();%0A%0A        //renderer loop%0A        while (!window.shouldClose()) %7B%0A            //clear framebuffer%0A            glClear(GL_COLOR_BUFFER_BIT %7C GL_DEPTH_BUFFER_BIT);%0A%0A            //swap back and front buffers%0A            window.swap
+create new instance of game%0A        MySimpleGameApp app = new MySimpleGameApp();%0A%0A        //initialize game%0A        app.init
 ();%0A%0A
-    
     
@@ -1024,348 +1024,36 @@
   //
-process input events and call callbacks%0A            window.processInput();%0A        %7D%0A%0A        Logger.getRootLogger().info(%22window was closed by user.%22);%0A%0A        //close window%0A        window.destroy();%0A%0A        //log message%0A        Logger.getRootLogger().info(%22shutdown GLFW now.%22);%0A%0A        //shutdown GLFW%0A        GLFWUtils.shutdownGLFW
+start game%0A        app.start
 ();%0A

change class Main.