/** * <p>Handle when the module create</p> */ private void onModuleCreate(Display.Preference preference) { //! //! Create display module. //! final GLFWFramebufferSizeCallback resize = GLFWFramebufferSizeCallback.create((window, width, height) -> { mLifecycle.onResize(width, height); //! //! NOTE: This is required due to GLFW3 limitation. //! onModuleRender(GLFW.glfwGetTime()); }); final GLFWWindowIconifyCallback iconify = GLFWWindowIconifyCallback.create((window, iconified) -> { if (iconified) { mLifecycle.onPause(); } else { mLifecycle.onResume(); } }); mDisplay.onModuleCreate(preference, resize, iconify); //! //! Create audio module. //! mAudio.onModuleCreate(new DesktopALES10()); mAudioThread.schedule(new TimerTask() { @Override public void run() { mAudio.onModuleUpdate(); } }, 0L, THREAD_AUDIO_DELAY); //! //! Create input module. //! mInput.onModuleCreate(new DesktopInputKeyboard(mDisplay.getHandle()), new DesktopInputMouse(mDisplay.getHandle())); mInputThread.schedule(new TimerTask() { @Override public void run() { mInput.onModuleUpdate(); } }, 0L, THREAD_INPUT_DELAY); //! //! Create render module. //! mRender.onModuleCreate(new DesktopGLES32()); //! //! Create resource module. //! mResources.registerAssetLocator("INTERNAL", new ClassAssetLocator()); mResources.registerAssetLocator("EXTERNAL", new FilesAssetLocator()); mResources.registerAssetLoader(new TexturePNGAssetLoader(), "png"); mResources.registerAssetLoader(new TextureDDSAssetLoader(), "dds", "s3tc"); mResources.registerAssetLoader(new AudioWAVAssetLoader(), "wav"); mResources.registerAssetLoader(new AudioOGGAssetLoader(), "ogg"); mResources.registerAssetLoader(new FontBinaryAssetLoader(), "fnt"); mResources.registerAssetLoader(new ShaderBinaryAssetLoader(QKRender.getCapabilities()), "shader"); //! //! Handle the create notification. //! mLifecycle.onCreate(); mLifecycle.onResize(mDisplay.getWidth(), mDisplay.getHeight()); }