Updating loading screen during loading.
This commit is contained in:
parent
96a8943cb7
commit
40dfbf33d9
@ -35,7 +35,7 @@ void Application::initLevel() {
|
||||
level.load();
|
||||
Loader loader = Loader();
|
||||
|
||||
loader.load(levelXmlPath, &level, compositionsPath, scriptPath, geometryPath, texturePath, heightmapPath);
|
||||
loader.load(levelXmlPath, &level, compositionsPath, scriptPath, geometryPath, texturePath, heightmapPath, &graphics);
|
||||
graphics.init(&level);
|
||||
|
||||
// just in case: check for errors
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "loader.hh"
|
||||
#include "main.hh"
|
||||
#include <ACGL/OpenGL/Objects/VertexArrayObject.hh>
|
||||
using namespace tinyxml2;
|
||||
|
||||
@ -57,7 +58,7 @@ void Loader::loadConfig(Application* application) {
|
||||
}
|
||||
|
||||
void Loader::load(std::string filePath, Level* level, std::string compositionsPath, std::string scriptPath,
|
||||
std::string globalGeometryPath, std::string globalTexturePath, std::string heightmapPath) {
|
||||
std::string globalGeometryPath, std::string globalTexturePath, std::string heightmapPath, Graphics* graphics) {
|
||||
struct stat buf;
|
||||
//Loading from xml:
|
||||
XMLDocument* doc = new XMLDocument();
|
||||
@ -226,6 +227,13 @@ void Loader::load(std::string filePath, Level* level, std::string compositionsPa
|
||||
int compositionType = queryInt(composition, "typeID");
|
||||
//corect composition found
|
||||
if(thisType == compositionType){
|
||||
|
||||
// update loading screen
|
||||
glfwPollEvents();
|
||||
graphics->render(0.0f);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
typeExists = true;
|
||||
//iterate over all objects of the composition
|
||||
XMLElement* xmlObject = composition->FirstChildElement("object");
|
||||
|
@ -12,7 +12,7 @@ class Loader {
|
||||
void loadConfig(Application* application);
|
||||
void load(std::string filePath, Level* level, std::string compositionsPath,
|
||||
std::string scriptPath, std::string geometryPath, std::string texturePath,
|
||||
std::string heightmapPath);
|
||||
std::string heightmapPath, Graphics* graphics);
|
||||
glm::vec3 reloadPlayerPosition(std::string filePath, Level* level);
|
||||
private:
|
||||
float queryFloat(XMLElement* element, const char* attribute);
|
||||
|
@ -4,6 +4,9 @@
|
||||
#include <sstream>
|
||||
#include "keyboardState.hh"
|
||||
|
||||
Application app;
|
||||
GLFWwindow* window;
|
||||
|
||||
static void resizeCallback(GLFWwindow* window, int newWidth, int newHeight)
|
||||
{
|
||||
// store the new window size and adjust the viewport:
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef MAIN_HH_INCLUDED
|
||||
#define MAIN_HH_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "application.hh"
|
||||
|
||||
Application app;
|
||||
GLFWwindow* window;
|
||||
#endif
|
||||
extern Application app;
|
||||
extern GLFWwindow* window;
|
||||
|
Loading…
Reference in New Issue
Block a user