Index: new-game.cpp
===================================================================
--- new-game.cpp	(revision 4a9416a988cc9dbc7460f1c5db43de22e12258e7)
+++ new-game.cpp	(revision 670c09af1971c9568423ac0b125725b93b7fb2f7)
@@ -9,5 +9,6 @@
 
 #include "IMGUI/imgui.h"
-#include "imgui_impl_glfw_gl3.h"
+#include "IMGUI/imgui_impl_glfw.h"
+#include "IMGUI/imgui_impl_opengl3.h"
 
 #include <GL/glew.h>
@@ -36,27 +37,27 @@
 using namespace glm;
 
-enum State {
-   STATE_MAIN_MENU,
-   STATE_GAME,
+enum class State {
+   MAIN_MENU,
+   GAME,
 };
 
-enum Event {
-   EVENT_GO_TO_MAIN_MENU,
-   EVENT_GO_TO_GAME,
-   EVENT_QUIT,
+enum class Event {
+   GO_TO_MAIN_MENU,
+   GO_TO_GAME,
+   QUIT,
 };
 
 /*** START OF REFACTORED CODE ***/
-enum ObjectType {
-   TYPE_SHIP,
-   TYPE_ASTEROID,
-   TYPE_LASER,
-   TYPE_EXPLOSION,
+enum class ObjectType {
+   SHIP,
+   ASTEROID,
+   LASER,
+   EXPLOSION,
 };
 
-enum AttribType {
-   ATTRIB_UNIFORM,
-   ATTRIB_OBJECT_VARYING,
-   ATTRIB_POINT_VARYING,
+enum class AttribType {
+   UNIFORM,
+   OBJECT_VARYING,
+   POINT_VARYING,
 };
 
@@ -248,5 +249,4 @@
 
 #define NUM_KEYS (512)
-#define ONE_DEG_IN_RAD ((2.0f * M_PI) / 360.0f) // 0.017444444 (maybe make this a const instead)
 #define TARGET_FPS 60.0f
 
@@ -332,4 +332,6 @@
       return 1;
    }
+
+   string glsl_version = "#version 410";
 
 #ifdef MAC
@@ -411,12 +413,16 @@
    IMGUI_CHECKVERSION();
    ImGui::CreateContext();
+
    ImGuiIO& io = ImGui::GetIO(); (void)io;
-   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;  // Enable Keyboard Controls
-   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;   // Enable Gamepad Controls
-   ImGui_ImplGlfwGL3_Init(window, true);
-
-   // Setup style
+   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;     // Enable Keyboard Controls
+   //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;      // Enable Gamepad Controls
+
+   // Setup Dear ImGui style
    ImGui::StyleColorsDark();
    //ImGui::StyleColorsClassic();
+
+   // Setup Platform/Renderer backends
+   ImGui_ImplGlfw_InitForOpenGL(window, true);
+   ImGui_ImplOpenGL3_Init(glsl_version.c_str());
 
    glfwSetMouseButtonCallback(window, mouse_button_callback);
@@ -497,83 +503,83 @@
    map<ObjectType, ShaderModelGroup> modelGroups;
 
-   modelGroups[TYPE_SHIP] = createModelGroup(
+   modelGroups[ObjectType::SHIP] = createModelGroup(
       loadShaderProgram("gl-shaders/ship.vert", "gl-shaders/ship.frag"));
-   shaderBufferInfo[modelGroups[TYPE_SHIP].shaderProgram] = BufferInfo(); // temporary
-
-   defineModelGroupAttrib(modelGroups[TYPE_SHIP], "vertex_position", ATTRIB_POINT_VARYING,
+   shaderBufferInfo[modelGroups[ObjectType::SHIP].shaderProgram] = BufferInfo(); // temporary
+
+   defineModelGroupAttrib(modelGroups[ObjectType::SHIP], "vertex_position", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&SceneObject::points));
-   defineModelGroupAttrib(modelGroups[TYPE_SHIP], "vertex_color", ATTRIB_POINT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::SHIP], "vertex_color", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&SceneObject::colors));
-   defineModelGroupAttrib(modelGroups[TYPE_SHIP], "vertex_normal", ATTRIB_POINT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::SHIP], "vertex_normal", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&SceneObject::normals));
-   defineModelGroupAttrib(modelGroups[TYPE_SHIP], "ubo_index", ATTRIB_OBJECT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::SHIP], "ubo_index", AttribType::OBJECT_VARYING,
       1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
 
-   defineModelGroupUniform(modelGroups[TYPE_SHIP], "view", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::SHIP], "view", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(view_mat));
-   defineModelGroupUniform(modelGroups[TYPE_SHIP], "proj", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::SHIP], "proj", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(proj_mat));
 
-   initModelGroupAttribs(modelGroups[TYPE_SHIP]);
-
-   modelGroups[TYPE_ASTEROID] = createModelGroup(
+   initModelGroupAttribs(modelGroups[ObjectType::SHIP]);
+
+   modelGroups[ObjectType::ASTEROID] = createModelGroup(
       loadShaderProgram("gl-shaders/asteroid.vert", "gl-shaders/asteroid.frag"));
-   shaderBufferInfo[modelGroups[TYPE_ASTEROID].shaderProgram] = BufferInfo(); // temporary
-
-   defineModelGroupAttrib(modelGroups[TYPE_ASTEROID], "vertex_position", ATTRIB_POINT_VARYING,
+   shaderBufferInfo[modelGroups[ObjectType::ASTEROID].shaderProgram] = BufferInfo(); // temporary
+
+   defineModelGroupAttrib(modelGroups[ObjectType::ASTEROID], "vertex_position", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&SceneObject::points));
-   defineModelGroupAttrib(modelGroups[TYPE_ASTEROID], "vertex_color", ATTRIB_POINT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::ASTEROID], "vertex_color", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&SceneObject::colors));
-   defineModelGroupAttrib(modelGroups[TYPE_ASTEROID], "vertex_normal", ATTRIB_POINT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::ASTEROID], "vertex_normal", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&SceneObject::normals));
-   defineModelGroupAttrib(modelGroups[TYPE_ASTEROID], "ubo_index", ATTRIB_OBJECT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::ASTEROID], "ubo_index", AttribType::OBJECT_VARYING,
       1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
 
-   defineModelGroupUniform(modelGroups[TYPE_ASTEROID], "view", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::ASTEROID], "view", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(view_mat));
-   defineModelGroupUniform(modelGroups[TYPE_ASTEROID], "proj", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::ASTEROID], "proj", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(proj_mat));
 
-   initModelGroupAttribs(modelGroups[TYPE_ASTEROID]);
-
-   modelGroups[TYPE_LASER] = createModelGroup(
+   initModelGroupAttribs(modelGroups[ObjectType::ASTEROID]);
+
+   modelGroups[ObjectType::LASER] = createModelGroup(
       loadShaderProgram("gl-shaders/laser.vert", "gl-shaders/laser.frag"));
-   shaderBufferInfo[modelGroups[TYPE_LASER].shaderProgram] = BufferInfo(); // temporary
-
-   defineModelGroupAttrib(modelGroups[TYPE_LASER], "vertex_position", ATTRIB_POINT_VARYING,
+   shaderBufferInfo[modelGroups[ObjectType::LASER].shaderProgram] = BufferInfo(); // temporary
+
+   defineModelGroupAttrib(modelGroups[ObjectType::LASER], "vertex_position", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&SceneObject::points));
-   defineModelGroupAttrib(modelGroups[TYPE_LASER], "vt", ATTRIB_POINT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::LASER], "vt", AttribType::POINT_VARYING,
       2, GL_FLOAT, offset_of(&SceneObject::texcoords));
-   defineModelGroupAttrib(modelGroups[TYPE_LASER], "ubo_index", ATTRIB_OBJECT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::LASER], "ubo_index", AttribType::OBJECT_VARYING,
       1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
 
-   defineModelGroupUniform(modelGroups[TYPE_LASER], "view", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::LASER], "view", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(view_mat));
-   defineModelGroupUniform(modelGroups[TYPE_LASER], "proj", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::LASER], "proj", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(proj_mat));
-    defineModelGroupUniform(modelGroups[TYPE_LASER], "laser_color", ATTRIB_UNIFORM,
+    defineModelGroupUniform(modelGroups[ObjectType::LASER], "laser_color", AttribType::UNIFORM,
       1, UNIFORM_3F, laserColor);
 
-   initModelGroupAttribs(modelGroups[TYPE_LASER]);
-
-   modelGroups[TYPE_EXPLOSION] = createModelGroup(
+   initModelGroupAttribs(modelGroups[ObjectType::LASER]);
+
+   modelGroups[ObjectType::EXPLOSION] = createModelGroup(
       loadShaderProgram("gl-shaders/explosion.vert", "gl-shaders/explosion.frag"));
-   shaderBufferInfo[modelGroups[TYPE_EXPLOSION].shaderProgram] = BufferInfo(); // temporary
-
-   defineModelGroupAttrib(modelGroups[TYPE_EXPLOSION], "v_i", ATTRIB_POINT_VARYING,
+   shaderBufferInfo[modelGroups[ObjectType::EXPLOSION].shaderProgram] = BufferInfo(); // temporary
+
+   defineModelGroupAttrib(modelGroups[ObjectType::EXPLOSION], "v_i", AttribType::POINT_VARYING,
       3, GL_FLOAT, offset_of(&ParticleEffect::particleVelocities));
-   defineModelGroupAttrib(modelGroups[TYPE_EXPLOSION], "start_time", ATTRIB_POINT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::EXPLOSION], "start_time", AttribType::POINT_VARYING,
       1, GL_FLOAT, offset_of(&ParticleEffect::particleTimes));
-   defineModelGroupAttrib(modelGroups[TYPE_EXPLOSION], "ubo_index", ATTRIB_OBJECT_VARYING,
+   defineModelGroupAttrib(modelGroups[ObjectType::EXPLOSION], "ubo_index", AttribType::OBJECT_VARYING,
       1, GL_UNSIGNED_INT, offset_of(&SceneObject::ubo_offset));
 
-   defineModelGroupUniform(modelGroups[TYPE_EXPLOSION], "cur_time", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::EXPLOSION], "cur_time", AttribType::UNIFORM,
       1, UNIFORM_1F, &curTime);
-   defineModelGroupUniform(modelGroups[TYPE_EXPLOSION], "view", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::EXPLOSION], "view", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(view_mat));
-   defineModelGroupUniform(modelGroups[TYPE_EXPLOSION], "proj", ATTRIB_UNIFORM,
+   defineModelGroupUniform(modelGroups[ObjectType::EXPLOSION], "proj", AttribType::UNIFORM,
       1, UNIFORM_MATRIX_4F, value_ptr(proj_mat));
 
-   initModelGroupAttribs(modelGroups[TYPE_EXPLOSION]);
+   initModelGroupAttribs(modelGroups[ObjectType::EXPLOSION]);
 
    cam_pos = vec3(0.0f, 0.0f, 2.0f);
@@ -587,6 +593,6 @@
 
    float cam_speed = 1.0f;
-   float cam_yaw_speed = 60.0f*ONE_DEG_IN_RAD;
-   float cam_pitch_speed = 60.0f*ONE_DEG_IN_RAD;
+   float cam_yaw_speed = radians(60.0f);
+   float cam_pitch_speed = radians(60.0f);
 
    // glm::lookAt can create the view matrix
@@ -601,5 +607,5 @@
    // TODO: Create a function to construct the projection matrix
    // (Maybe I should just use glm::perspective, after making sure it matches what I have now)
-   float fov = 67.0f * ONE_DEG_IN_RAD;
+   float fov = radians(67.0f);
    float aspect = (float)windowWidth / (float)windowHeight;
 
@@ -657,26 +663,26 @@
    GLuint ub_binding_point = 0;
 
-   GLuint ship_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[TYPE_SHIP].shaderProgram, "models");
-
-   GLuint asteroid_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[TYPE_ASTEROID].shaderProgram, "models");
-
-   GLuint laser_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[TYPE_LASER].shaderProgram, "models");
-
-   GLuint explosion_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[TYPE_EXPLOSION].shaderProgram, "models");
-
-
-   glUseProgram(modelGroups[TYPE_SHIP].shaderProgram);
-   bindUniformData(modelGroups[TYPE_SHIP].attribs["view"]);
-   bindUniformData(modelGroups[TYPE_SHIP].attribs["proj"]);
-
-   glUniformBlockBinding(modelGroups[TYPE_SHIP].shaderProgram, ship_sp_models_ub_index, ub_binding_point);
+   GLuint ship_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[ObjectType::SHIP].shaderProgram, "models");
+
+   GLuint asteroid_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[ObjectType::ASTEROID].shaderProgram, "models");
+
+   GLuint laser_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[ObjectType::LASER].shaderProgram, "models");
+
+   GLuint explosion_sp_models_ub_index = glGetUniformBlockIndex(modelGroups[ObjectType::EXPLOSION].shaderProgram, "models");
+
+
+   glUseProgram(modelGroups[ObjectType::SHIP].shaderProgram);
+   bindUniformData(modelGroups[ObjectType::SHIP].attribs["view"]);
+   bindUniformData(modelGroups[ObjectType::SHIP].attribs["proj"]);
+
+   glUniformBlockBinding(modelGroups[ObjectType::SHIP].shaderProgram, ship_sp_models_ub_index, ub_binding_point);
    glBindBufferRange(GL_UNIFORM_BUFFER, ub_binding_point, ubo, 0, GL_MAX_UNIFORM_BLOCK_SIZE);
 
 
-   glUseProgram(modelGroups[TYPE_ASTEROID].shaderProgram);
-   bindUniformData(modelGroups[TYPE_ASTEROID].attribs["view"]);
-   bindUniformData(modelGroups[TYPE_ASTEROID].attribs["proj"]);
-
-   glUniformBlockBinding(modelGroups[TYPE_ASTEROID].shaderProgram, asteroid_sp_models_ub_index, ub_binding_point);
+   glUseProgram(modelGroups[ObjectType::ASTEROID].shaderProgram);
+   bindUniformData(modelGroups[ObjectType::ASTEROID].attribs["view"]);
+   bindUniformData(modelGroups[ObjectType::ASTEROID].attribs["proj"]);
+
+   glUniformBlockBinding(modelGroups[ObjectType::ASTEROID].shaderProgram, asteroid_sp_models_ub_index, ub_binding_point);
    glBindBufferRange(GL_UNIFORM_BUFFER, ub_binding_point, ubo, 0, GL_MAX_UNIFORM_BLOCK_SIZE);
 
@@ -685,18 +691,18 @@
    // Right now, I think I'm getting away without getting that uniform location because I'm only
    // using one texture, so setting it to GL_TEXTURE0 once works
-   glUseProgram(modelGroups[TYPE_LASER].shaderProgram);
-   bindUniformData(modelGroups[TYPE_LASER].attribs["view"]);
-   bindUniformData(modelGroups[TYPE_LASER].attribs["proj"]);
-   bindUniformData(modelGroups[TYPE_LASER].attribs["laser_color"]);
-
-   glUniformBlockBinding(modelGroups[TYPE_LASER].shaderProgram, laser_sp_models_ub_index, ub_binding_point);
+   glUseProgram(modelGroups[ObjectType::LASER].shaderProgram);
+   bindUniformData(modelGroups[ObjectType::LASER].attribs["view"]);
+   bindUniformData(modelGroups[ObjectType::LASER].attribs["proj"]);
+   bindUniformData(modelGroups[ObjectType::LASER].attribs["laser_color"]);
+
+   glUniformBlockBinding(modelGroups[ObjectType::LASER].shaderProgram, laser_sp_models_ub_index, ub_binding_point);
    glBindBufferRange(GL_UNIFORM_BUFFER, ub_binding_point, ubo, 0, GL_MAX_UNIFORM_BLOCK_SIZE);
 
 
-   glUseProgram(modelGroups[TYPE_EXPLOSION].shaderProgram);
-   bindUniformData(modelGroups[TYPE_EXPLOSION].attribs["view"]);
-   bindUniformData(modelGroups[TYPE_EXPLOSION].attribs["proj"]);
-
-   glUniformBlockBinding(modelGroups[TYPE_EXPLOSION].shaderProgram, explosion_sp_models_ub_index, ub_binding_point);
+   glUseProgram(modelGroups[ObjectType::EXPLOSION].shaderProgram);
+   bindUniformData(modelGroups[ObjectType::EXPLOSION].attribs["view"]);
+   bindUniformData(modelGroups[ObjectType::EXPLOSION].attribs["proj"]);
+
+   glUniformBlockBinding(modelGroups[ObjectType::EXPLOSION].shaderProgram, explosion_sp_models_ub_index, ub_binding_point);
    glBindBufferRange(GL_UNIFORM_BUFFER, ub_binding_point, ubo, 0, GL_MAX_UNIFORM_BLOCK_SIZE);
 /*** END OF REFACTORED CODE ***/
@@ -720,5 +726,5 @@
    //glfwSwapInterval(0);
 
-   State curState = STATE_MAIN_MENU;
+   State curState = State::MAIN_MENU;
 
    initGuiValueLists(valueLists);
@@ -762,11 +768,11 @@
       while (!events.empty()) {
          switch (events.front()) {
-            case EVENT_GO_TO_MAIN_MENU:
-               curState = STATE_MAIN_MENU;
+         case Event::GO_TO_MAIN_MENU:
+               curState = State::MAIN_MENU;
                break;
-            case EVENT_GO_TO_GAME:
-               curState = STATE_GAME;
+            case Event::GO_TO_GAME:
+               curState = State::GAME;
                break;
-            case EVENT_QUIT:
+            case Event::QUIT:
                isRunning = false;
                break;
@@ -775,5 +781,5 @@
       }
 
-      if (curState == STATE_GAME) {
+      if (curState == State::GAME) {
 
 /*** START OF REFACTORED CODE ***/
@@ -857,5 +863,5 @@
          for (unsigned int i = 0; i < objects.size(); i++) {
             if (!objects[i]->deleted) {
-               if (objects[i]->type == TYPE_ASTEROID) {
+               if (objects[i]->type == ObjectType::ASTEROID) {
                   transformObject(*objects[i], translate(mat4(1.0f), vec3(0.0f, 0.0f, 0.04f)), ubo);
 
@@ -878,5 +884,5 @@
                      addObjectToScene(createExplosion(model_mat), shaderBufferInfo, modelGroups, ubo);
                   }
-               } else if (objects[i]->type == TYPE_EXPLOSION) {
+               } else if (objects[i]->type == ObjectType::EXPLOSION) {
                   ParticleEffect* explosion = (ParticleEffect*)objects[i];
                   if (glfwGetTime() >= explosion->startTime + explosion->duration) {
@@ -888,8 +894,8 @@
 
          if (leftLaser != NULL && !leftLaser->deleted) {
-            updateLaserTarget(leftLaser, objects, modelGroups[TYPE_LASER], modelGroups[TYPE_ASTEROID].shaderProgram);
+            updateLaserTarget(leftLaser, objects, modelGroups[ObjectType::LASER], modelGroups[ObjectType::ASTEROID].shaderProgram);
          }
          if (rightLaser != NULL && !rightLaser->deleted) {
-            updateLaserTarget(rightLaser, objects, modelGroups[TYPE_LASER], modelGroups[TYPE_ASTEROID].shaderProgram);
+            updateLaserTarget(rightLaser, objects, modelGroups[ObjectType::LASER], modelGroups[ObjectType::ASTEROID].shaderProgram);
          }
       }
@@ -963,15 +969,15 @@
          view_mat = R * T;
 
-         glUseProgram(modelGroups[TYPE_SHIP].shaderProgram);
-         bindUniformData(modelGroups[TYPE_SHIP].attribs["view"]);
-
-         glUseProgram(modelGroups[TYPE_LASER].shaderProgram);
-         bindUniformData(modelGroups[TYPE_LASER].attribs["view"]);
+         glUseProgram(modelGroups[ObjectType::SHIP].shaderProgram);
+         bindUniformData(modelGroups[ObjectType::SHIP].attribs["view"]);
+
+         glUseProgram(modelGroups[ObjectType::LASER].shaderProgram);
+         bindUniformData(modelGroups[ObjectType::LASER].attribs["view"]);
 
          cam_moved = false;
       }
 
-      glUseProgram(modelGroups[TYPE_EXPLOSION].shaderProgram);
-      bindUniformData(modelGroups[TYPE_EXPLOSION].attribs["cur_time"]);
+      glUseProgram(modelGroups[ObjectType::EXPLOSION].shaderProgram);
+      bindUniformData(modelGroups[ObjectType::EXPLOSION].attribs["cur_time"]);
 
       // Render scene
@@ -981,9 +987,9 @@
 
       switch (curState) {
-         case STATE_MAIN_MENU:
+         case State::MAIN_MENU:
             renderMainMenu();
             renderMainMenuGui();
             break;
-         case STATE_GAME:
+         case State::GAME:
             renderScene(modelGroups, ubo);
             renderSceneGui(valueLists);
@@ -994,5 +1000,6 @@
    }
 
-   ImGui_ImplGlfwGL3_Shutdown();
+   ImGui_ImplOpenGL3_Shutdown();
+   ImGui_ImplGlfw_Shutdown();
    ImGui::DestroyContext();
 
@@ -1040,5 +1047,5 @@
 
       for (vector<SceneObject*>::iterator it = objects.begin(); it != objects.end(); it++) {
-         if ((*it)->type == TYPE_LASER) continue;
+         if ((*it)->type == ObjectType::LASER) continue;
          for (unsigned int p_idx = 0; p_idx < (*it)->points.size(); p_idx += 9) {
             if (faceClicked(
@@ -1342,5 +1349,5 @@
    }
 
-   if (obj->type == TYPE_SHIP || obj->type == TYPE_ASTEROID) {
+   if (obj->type == ObjectType::SHIP || obj->type == ObjectType::ASTEROID) {
       calculateObjectBoundingBox(obj);
 
@@ -1444,5 +1451,5 @@
    SceneObject* ship = new SceneObject();
 
-   ship->type = TYPE_SHIP;
+   ship->type = ObjectType::SHIP;
 
    ship->points = {
@@ -1839,5 +1846,5 @@
 Laser* createLaser(vec3 start, vec3 end, vec3 color, GLfloat width) {
    Laser* obj = new Laser();
-   obj->type = TYPE_LASER;
+   obj->type = ObjectType::LASER;
    obj->targetAsteroid = NULL;
 
@@ -1970,5 +1977,5 @@
    map<string, AttribInfo>::iterator it;
    for (it = modelGroup.attribs.begin(); it != modelGroup.attribs.end(); it++) {
-      if (it->second.attribType == ATTRIB_UNIFORM) {
+      if (it->second.attribType == AttribType::UNIFORM) {
          it->second.buffer = glGetUniformLocation(modelGroup.shaderProgram, it->first.c_str());
       } else {
@@ -2133,5 +2140,5 @@
       map<string, AttribInfo>::iterator attrIt;
       for (attrIt = smg->attribs.begin(); attrIt != smg->attribs.end(); attrIt++) {
-         if (attrIt->second.attribType != ATTRIB_UNIFORM) {
+         if (attrIt->second.attribType != AttribType::UNIFORM) {
             glBindBuffer(GL_ARRAY_BUFFER, attrIt->second.buffer);
             glBufferData(GL_ARRAY_BUFFER, smg->vboCapacity * GLsizeof(attrIt->second.type) * attrIt->second.size, NULL, GL_DYNAMIC_DRAW);
@@ -2165,9 +2172,9 @@
 
       switch (it->second.attribType) {
-         case ATTRIB_POINT_VARYING:
+         case AttribType::POINT_VARYING:
             glBufferSubData(GL_ARRAY_BUFFER, obj.vertex_vbo_offset * GLsizeof(it->second.type) * it->second.size,
                obj.num_points * GLsizeof(it->second.type) * it->second.size, getVectorAttribPtr(obj, it->second.fieldOffset));
             break;
-         case ATTRIB_OBJECT_VARYING:
+         case AttribType::OBJECT_VARYING:
             for (unsigned int i = 0; i < obj.num_points; i++) {
                glBufferSubData(GL_ARRAY_BUFFER, (obj.vertex_vbo_offset + i) * GLsizeof(it->second.type) * it->second.size,
@@ -2175,5 +2182,5 @@
             }
             break;
-         case ATTRIB_UNIFORM:
+         case AttribType::UNIFORM:
             break;
       }
@@ -2185,16 +2192,16 @@
    glBufferSubData(GL_UNIFORM_BUFFER, obj.ubo_offset * sizeof(mat4), sizeof(mat4), value_ptr(obj.model_mat));
 
-   if (obj.type == TYPE_ASTEROID) {
-      glUseProgram(modelGroups[TYPE_ASTEROID].shaderProgram);
+   if (obj.type == ObjectType::ASTEROID) {
+      glUseProgram(modelGroups[ObjectType::ASTEROID].shaderProgram);
 
       ostringstream oss;
       oss << "hp[" << obj.ubo_offset << "]";
-      glUniform1f(glGetUniformLocation(modelGroups[TYPE_ASTEROID].shaderProgram, oss.str().c_str()), ((Asteroid&)obj).hp);
-   } else if (obj.type == TYPE_EXPLOSION) {
-      glUseProgram(modelGroups[TYPE_EXPLOSION].shaderProgram);
+      glUniform1f(glGetUniformLocation(modelGroups[ObjectType::ASTEROID].shaderProgram, oss.str().c_str()), ((Asteroid&)obj).hp);
+   } else if (obj.type == ObjectType::EXPLOSION) {
+      glUseProgram(modelGroups[ObjectType::EXPLOSION].shaderProgram);
 
       ostringstream oss;
       oss << "explosion_start_time[" << obj.ubo_offset << "]";
-      glUniform1f(glGetUniformLocation(modelGroups[TYPE_EXPLOSION].shaderProgram, oss.str().c_str()), ((ParticleEffect&)obj).startTime);
+      glUniform1f(glGetUniformLocation(modelGroups[ObjectType::EXPLOSION].shaderProgram, oss.str().c_str()), ((ParticleEffect&)obj).startTime);
    }
 
@@ -2255,5 +2262,5 @@
 
    for (vector<SceneObject*>::iterator it = objects.begin(); it != objects.end(); it++) {
-      if ((*it)->type == TYPE_ASTEROID && !(*it)->deleted && getLaserAndAsteroidIntersection(start, end, **it, intersection)) {
+      if ((*it)->type == ObjectType::ASTEROID && !(*it)->deleted && getLaserAndAsteroidIntersection(start, end, **it, intersection)) {
          // TODO: Implement a more generic algorithm for testing the closest object by getting the distance between the points
          if (closestAsteroid == NULL || intersection.z > closestIntersection.z) {
@@ -2367,27 +2374,27 @@
 void renderScene(map<ObjectType, ShaderModelGroup>& modelGroups, GLuint ubo) {
 
-   glUseProgram(modelGroups[TYPE_SHIP].shaderProgram);
-   glBindVertexArray(modelGroups[TYPE_SHIP].vao);
-
-   glDrawArrays(GL_TRIANGLES, 0, modelGroups[TYPE_SHIP].numPoints);
-
-   glUseProgram(modelGroups[TYPE_ASTEROID].shaderProgram);
-   glBindVertexArray(modelGroups[TYPE_ASTEROID].vao);
-
-   glDrawArrays(GL_TRIANGLES, 0, modelGroups[TYPE_ASTEROID].numPoints);
+   glUseProgram(modelGroups[ObjectType::SHIP].shaderProgram);
+   glBindVertexArray(modelGroups[ObjectType::SHIP].vao);
+
+   glDrawArrays(GL_TRIANGLES, 0, modelGroups[ObjectType::SHIP].numPoints);
+
+   glUseProgram(modelGroups[ObjectType::ASTEROID].shaderProgram);
+   glBindVertexArray(modelGroups[ObjectType::ASTEROID].vao);
+
+   glDrawArrays(GL_TRIANGLES, 0, modelGroups[ObjectType::ASTEROID].numPoints);
 
    glEnable(GL_BLEND);
 
-   glUseProgram(modelGroups[TYPE_LASER].shaderProgram);
-   glBindVertexArray(modelGroups[TYPE_LASER].vao);
-
-   glDrawArrays(GL_TRIANGLES, 0, modelGroups[TYPE_LASER].numPoints);
-
-   glUseProgram(modelGroups[TYPE_EXPLOSION].shaderProgram);
-   glBindVertexArray(modelGroups[TYPE_EXPLOSION].vao);
+   glUseProgram(modelGroups[ObjectType::LASER].shaderProgram);
+   glBindVertexArray(modelGroups[ObjectType::LASER].vao);
+
+   glDrawArrays(GL_TRIANGLES, 0, modelGroups[ObjectType::LASER].numPoints);
+
+   glUseProgram(modelGroups[ObjectType::EXPLOSION].shaderProgram);
+   glBindVertexArray(modelGroups[ObjectType::EXPLOSION].vao);
 
    glEnable(GL_PROGRAM_POINT_SIZE);
 
-   glDrawArrays(GL_POINTS, 0, modelGroups[TYPE_EXPLOSION].numPoints);
+   glDrawArrays(GL_POINTS, 0, modelGroups[ObjectType::EXPLOSION].numPoints);
 
    glDisable(GL_PROGRAM_POINT_SIZE);
@@ -2397,5 +2404,7 @@
 
 void renderSceneGui(map<string, vector<UIValue>> valueLists) {
-   ImGui_ImplGlfwGL3_NewFrame();
+   ImGui_ImplOpenGL3_NewFrame();
+   ImGui_ImplGlfw_NewFrame();
+   ImGui::NewFrame();
 
    // 1. Show a simple window.
@@ -2443,5 +2452,5 @@
       ImGui::SameLine();
       if (ImGui::Button("Main Menu")) {
-         events.push(EVENT_GO_TO_MAIN_MENU);
+         events.push(Event::GO_TO_MAIN_MENU);
       }
       ImGui::End();
@@ -2462,5 +2471,5 @@
 
    ImGui::Render();
-   ImGui_ImplGlfwGL3_RenderDrawData(ImGui::GetDrawData());
+   ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
 }
 
@@ -2470,5 +2479,7 @@
 /*** START OF REFACTORED CODE ***/
 void renderMainMenuGui() {
-   ImGui_ImplGlfwGL3_NewFrame();
+   ImGui_ImplOpenGL3_NewFrame();
+   ImGui_ImplGlfw_NewFrame();
+   ImGui::NewFrame();
 
    {
@@ -2485,5 +2496,5 @@
       ImGui::SameLine();
       if (ImGui::Button("New Game")) {
-         events.push(EVENT_GO_TO_GAME);
+         events.push(Event::GO_TO_GAME);
       }
 
@@ -2492,5 +2503,5 @@
       ImGui::SameLine();
       if (ImGui::Button("Quit")) {
-         events.push(EVENT_QUIT);
+         events.push(Event::QUIT);
       }
 
@@ -2499,5 +2510,5 @@
 
    ImGui::Render();
-   ImGui_ImplGlfwGL3_RenderDrawData(ImGui::GetDrawData());
+   ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
 }
 /*** END OF REFACTORED CODE ***/
@@ -2544,5 +2555,5 @@
 Asteroid* createAsteroid(vec3 pos) {
    Asteroid* obj = new Asteroid();
-   obj->type = TYPE_ASTEROID;
+   obj->type = ObjectType::ASTEROID;
    obj->hp = 10.0f;
 
@@ -2648,5 +2659,5 @@
 
    mat4 T = translate(mat4(1.0f), pos);
-   mat4 R = rotate(mat4(1.0f), 60.0f * (float)ONE_DEG_IN_RAD, vec3(1.0f, 1.0f, -1.0f));
+   mat4 R = rotate(mat4(1.0f), radians(60.0f), vec3(1.0f, 1.0f, -1.0f));
    obj->model_base = T * R * scale(mat4(1.0f), vec3(0.1f, 0.1f, 0.1f));
 
@@ -2668,5 +2679,5 @@
    ParticleEffect* obj = new ParticleEffect();
 
-   obj->type = TYPE_EXPLOSION;
+   obj->type = ObjectType::EXPLOSION;
 
    initObject(obj);
