/* * ===================================================================================== * * Filename: Application.cpp * * Description: * * Created: 14/12/2014 05:09:21 * * Author: Quentin Bazin, * * ===================================================================================== */ #include #include #include #include "Application.hpp" #include "Config.hpp" #include "GameState.hpp" #include "TextureLoader.hpp" void Application::init() { gk::CoreApplication::init(); gk::GamePad::init(m_keyboardHandler); createWindow(SCREEN_WIDTH, SCREEN_HEIGHT, APP_NAME); m_window.setVerticalSyncEnabled(true); m_window.disableView(); initOpenGL(); gk::Mouse::setCursorVisible(false); gk::Mouse::setCursorGrabbed(true); m_resourceHandler.loadConfigFile("resources/config/textures.xml"); m_resourceHandler.add("font-default", "resources/fonts/default.ttf"); Registry::setInstance(m_registry); m_scriptEngine.init(); m_stateStack.push(); } void Application::initOpenGL() { // Enable transparency glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Enable depth and hide backside of faces glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(1, 1); // Set best quality for mipmaps glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST); // Set clear color to skyblue glClearColor(0.196078, 0.6, 0.8, 1.0); }