Skip to content

Commit

Permalink
KOTOR: Add loadscreen gui
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius authored and DrMcCoy committed Jun 11, 2018
1 parent 64f1813 commit ea1060e
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/engines/kotor/gui/loadscreen/loadscreen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* xoreos - A reimplementation of BioWare's Aurora engine
*
* xoreos is the legal property of its developers, whose names
* can be found in the AUTHORS file distributed with this source
* distribution.
*
* xoreos is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* xoreos is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with xoreos. If not, see <http://www.gnu.org/licenses/>.
*/

/** @file
* The loading screen gui
*/

#include <boost/bind.hpp>

#include "src/aurora/2dareg.h"
#include "src/aurora/talkman.h"

#include "src/engines/kotor/gui/loadscreen/loadscreen.h"

#include "src/engines/kotor/gui/widgets/panel.h"
#include "src/engines/kotor/gui/widgets/progressbar.h"
#include "src/engines/kotor/gui/widgets/label.h"

namespace Engines {

namespace KotOR {

LoadScreen::LoadScreen(const Common::UString &loadScreenName, Console *console)
: GUI(console) {
load("loadscreen");

getPanel("TGuiPanel")->setFill("load_" + loadScreenName);

// TODO: Add loading hints according to loadscreenhints.2da
getLabel("LBL_HINT")->setFont("fnt_d16x16b");
getLabel("LBL_HINT")->setText("");

addBackground(kBackgroundTypeLoad);

_progressBar = getProgressbar("PB_PROGRESS");
_progressBar->setCurrentValue(0);
}

void LoadScreen::setLoadingProgress(unsigned int progress) {
_progressBar->setCurrentValue(progress);
}

LoadingProgressFunc LoadScreen::getLoadingProgressFunc() {
return boost::bind(&LoadScreen::setLoadingProgress, this, _1);
}

} // End of namespace KotOR

} // End of namespace Engines
56 changes: 56 additions & 0 deletions src/engines/kotor/gui/loadscreen/loadscreen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* xoreos - A reimplementation of BioWare's Aurora engine
*
* xoreos is the legal property of its developers, whose names
* can be found in the AUTHORS file distributed with this source
* distribution.
*
* xoreos is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* xoreos is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with xoreos. If not, see <http://www.gnu.org/licenses/>.
*/

/** @file
* The loading screen gui
*/

#ifndef ENGINES_KOTOR_GUI_LOADSCREEN_LOADSCREEN_H
#define ENGINES_KOTOR_GUI_LOADSCREEN_LOADSCREEN_H

#include <boost/function.hpp>

#include "src/common/thread.h"

#include "src/engines/kotor/module.h"
#include "src/engines/kotor/gui/gui.h"

namespace Engines {

namespace KotOR {

typedef boost::function<void(unsigned int)> LoadingProgressFunc;

class LoadScreen : public GUI {
public:
LoadScreen(const Common::UString &loadScreenName, Console *console = 0);

void setLoadingProgress(unsigned int progress);
LoadingProgressFunc getLoadingProgressFunc();

private:
WidgetProgressbar *_progressBar;
};

} // End of namespace KotOR

} // End of namespace Engines

#endif // ENGINES_KOTOR_GUI_LOADSCREEN_LOADSCREEN_H
2 changes: 2 additions & 0 deletions src/engines/kotor/gui/loadscreen/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
# Load screen system in Star Wars: Knights of the Old Republic.

src_engines_kotor_libkotor_la_SOURCES += \
src/engines/kotor/gui/loadscreen/loadscreen.h \
$(EMPTY)

src_engines_kotor_libkotor_la_SOURCES += \
src/engines/kotor/gui/loadscreen/loadscreen.cpp \
$(EMPTY)

0 comments on commit ea1060e

Please sign in to comment.