From 52ef1b4494fc967ba0792703792f24d171b5774e Mon Sep 17 00:00:00 2001 From: Remco Date: Tue, 21 Jun 2016 22:10:58 +0200 Subject: [PATCH] added loadingscreen clas --- LoadingScreen.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++ LoadingScreen.h | 15 ++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 LoadingScreen.cpp create mode 100644 LoadingScreen.h diff --git a/LoadingScreen.cpp b/LoadingScreen.cpp new file mode 100644 index 0000000..247cc6f --- /dev/null +++ b/LoadingScreen.cpp @@ -0,0 +1,51 @@ +#include "LoadingScreen.h" +#include +#include "CrystalPoint.h" +#include "Util.h" +#include + + +LoadingScreen::LoadingScreen() +{ + loading = "Loading..."; +} + + +LoadingScreen::~LoadingScreen() +{ +} + + + +void LoadingScreen::draw() +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, CrystalPoint::width, CrystalPoint::height, 0, -10, 10); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glDisable(GL_LIGHTING); + glDisable(GL_DEPTH_TEST); + glDisable(GL_TEXTURE_2D); + + + glColor4f(0.0f, 0.0f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glVertex2f(0, 0); + glVertex2f(0, CrystalPoint::height); + glVertex2f(CrystalPoint::width, CrystalPoint::height); + glVertex2f(CrystalPoint::width, 0); + glEnd(); + + glColor4f(1.0f, 1.0f, 0.0f, 1.0f); + + Util::glutBitmapString(loading, + CrystalPoint::width / 2 - Util::glutTextWidth(loading), + CrystalPoint::height / 2 - 7); + + + glEnable(GL_LIGHTING); + glEnable(GL_DEPTH_TEST); + glutSwapBuffers(); +} diff --git a/LoadingScreen.h b/LoadingScreen.h new file mode 100644 index 0000000..01a7c96 --- /dev/null +++ b/LoadingScreen.h @@ -0,0 +1,15 @@ +#pragma once +#include + +class LoadingScreen +{ +public: + LoadingScreen(); + ~LoadingScreen(); + + void draw(); + +private: + std::string loading; +}; +