<commit_before>package afk.gfx.athens;

import afk.gfx.Camera;
import afk.gfx.GfxEntity;
import afk.gfx.GfxListener;
import afk.gfx.GraphicsEngine;
import afk.gfx.Resource;
import afk.gfx.athens.particles.ParticleEmitter;
import com.hackoeur.jglm.*;
import com.jogamp.opengl.util.Animator;
import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLJPanel;
import javax.swing.JLabel;

/**
 * OpenGL 2.0 Implementation of the AFK Graphics Engine.
 *
 * @author Daniel
 */
public class Athens extends GraphicsEngine
{

    // loading queues
    private Queue<AthensResource> loadQueue = new LinkedList<AthensResource>();
    private Queue<AthensResource> unloadQueue = new LinkedList<AthensResource>();
    // this gets called when loading is done
    private Runnable onLoadCallback;
    // resources
    private Map<String, AthensResource>[] resources = new Map[Resource.NUM_RESOURCE_TYPES];
    // the scene's root entity
    private AthensEntity rootEntity;
    // flag indicating that the load queue has been dispatched
    private boolean loadQueueDispatched = false;
    private int w_width, w_height;
    private float aspect;
    // TODO: 1024 is enough, but there are some obscure codes in the region of 65000 that WILL make this program crash
    private boolean[] keys = new boolean[1024];
    private long lastUpdate;
    private float time = 0.0f;
    private float lastFPS = 0.0f;
    private float fpsInterval = 1.0f;
    Camera camera;
    Mat4 monkeyWorld, skyboxWorld;
    // TODO: move this to a sun/light position
    Vec3 origin_sun = new Vec3(-2.0f, 1.5f, 5.0f);
    Vec3 sun = new Vec3(origin_sun);
    float daytime = 0.0f;
    static final float MOUSE_SENSITIVITY = 60.0f;
    /* Amount to move / scale by in one step. */
    static final float DELTA = 5f, ANGLE_DELTA = 30.0f;
    private GLProfile glProfile;
    private GLCapabilities glCaps;
//    private GLCanvas glCanvas;
    private GLJPanel glCanvas;
    private Animator animator;
    private float fps = 0.0f;
    private JLabel fpsComp;

    public Athens(boolean autodraw)
    {
        for (int i = 0; i < resources.length; i++)
        {
            resources[i] = new HashMap<String, AthensResource>();
        }

        glProfile = GLProfile.getDefault();

        glCaps = new GLCapabilities(glProfile);
        glCaps.setDoubleBuffered(true);

//        glCanvas = new GLCanvas(glCaps);
        glCanvas = new GLJPanel(glCaps);

        KeyAdapter key = new KeyAdapter()
        {
            @Override
            public void keyTyped(KeyEvent e)
            {
                Athens.this.keyPressed(e);
            }

            @Override
            public void keyPressed(KeyEvent e)
            {
                Athens.this.keyPressed(e);
            }

            @Override
            public void keyReleased(KeyEvent e)
            {
                Athens.this.keyReleased(e);
            }
        };

        glCanvas.addKeyListener(key);

        MouseAdapter mouse = new MouseAdapter()
        {
            int cx = glCanvas.getWidth() / 2;
            int cy = glCanvas.getHeight() / 2;

            @Override<commit_msg>changed: switched to AWT Canvas<commit_after>package afk.gfx.athens;

import afk.gfx.Camera;
import afk.gfx.GfxEntity;
import afk.gfx.GfxListener;
import afk.gfx.GraphicsEngine;
import afk.gfx.Resource;
import afk.gfx.athens.particles.ParticleEmitter;
import com.hackoeur.jglm.*;
import com.jogamp.opengl.util.Animator;
import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.JLabel;

/**
 * OpenGL 2.0 Implementation of the AFK Graphics Engine.
 *
 * @author Daniel
 */
public class Athens extends GraphicsEngine
{

    // loading queues
    private Queue<AthensResource> loadQueue = new LinkedList<AthensResource>();
    private Queue<AthensResource> unloadQueue = new LinkedList<AthensResource>();
    // this gets called when loading is done
    private Runnable onLoadCallback;
    // resources
    private Map<String, AthensResource>[] resources = new Map[Resource.NUM_RESOURCE_TYPES];
    // the scene's root entity
    private AthensEntity rootEntity;
    // flag indicating that the load queue has been dispatched
    private boolean loadQueueDispatched = false;
    private int w_width, w_height;
    private float aspect;
    // TODO: 1024 is enough, but there are some obscure codes in the region of 65000 that WILL make this program crash
    private boolean[] keys = new boolean[1024];
    private long lastUpdate;
    private float time = 0.0f;
    private float lastFPS = 0.0f;
    private float fpsInterval = 1.0f;
    Camera camera;
    Mat4 monkeyWorld, skyboxWorld;
    // TODO: move this to a sun/light position
    Vec3 origin_sun = new Vec3(-2.0f, 1.5f, 5.0f);
    Vec3 sun = new Vec3(origin_sun);
    float daytime = 0.0f;
    static final float MOUSE_SENSITIVITY = 60.0f;
    /* Amount to move / scale by in one step. */
    static final float DELTA = 5f, ANGLE_DELTA = 30.0f;
    private GLProfile glProfile;
    private GLCapabilities glCaps;
    private GLCanvas glCanvas;
//    private GLJPanel glCanvas;
    private Animator animator;
    private float fps = 0.0f;
    private JLabel fpsComp;

    public Athens(boolean autodraw)
    {
        for (int i = 0; i < resources.length; i++)
        {
            resources[i] = new HashMap<String, AthensResource>();
        }

        glProfile = GLProfile.getDefault();

        glCaps = new GLCapabilities(glProfile);
        glCaps.setDoubleBuffered(true);

        glCanvas = new GLCanvas(glCaps);
//        glCanvas = new GLJPanel(glCaps);

        KeyAdapter key = new KeyAdapter()
        {
            @Override
            public void keyTyped(KeyEvent e)
            {
                Athens.this.keyPressed(e);
            }

            @Override
            public void keyPressed(KeyEvent e)
            {
                Athens.this.keyPressed(e);
            }

            @Override
            public void keyReleased(KeyEvent e)
            {
                Athens.this.keyReleased(e);
            }
        };

        glCanvas.addKeyListener(key);

        MouseAdapter mouse = new MouseAdapter()
        {
            int cx = glCanvas.getWidth() / 2;
            int cy = glCanvas.getHeight() / 2;

            @Override
{'fraction_non_alphanumeric': 0.0909966960352423, 'fraction_numerical': 0.012940528634361233, 'mean_word_length': 2.6562657272269754, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '7533317', 'n_tokens_mistral': 2291, 'n_tokens_neox': 2205, 'n_words': 593}