1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 10:22:52 +01:00

initialize some variables in constructor

This commit is contained in:
Aldoxtor 2017-04-16 07:57:08 +02:00 committed by Daniel Evans
parent 4fdf3a2280
commit 81734ae2fe
3 changed files with 10 additions and 3 deletions

View File

@ -31,7 +31,8 @@ std::map<GameRenderer::SpecialModel, std::string> kSpecialModels = {
RWGame::RWGame(Logger& log, int argc, char* argv[]) RWGame::RWGame(Logger& log, int argc, char* argv[])
: GameBase(log, argc, argv) : GameBase(log, argc, argv)
, data(&log, config.getGameDataPath()) , data(&log, config.getGameDataPath())
, renderer(&log, &data) { , renderer(&log, &data)
, lastDraws(0) {
bool newgame = options.count("newgame"); bool newgame = options.count("newgame");
bool test = options.count("test"); bool test = options.count("test");
std::string startSave( std::string startSave(

View File

@ -4,7 +4,7 @@
#include "RWGame.hpp" #include "RWGame.hpp"
BenchmarkState::BenchmarkState(RWGame* game, const std::string& benchfile) BenchmarkState::BenchmarkState(RWGame* game, const std::string& benchfile)
: State(game), benchfile(benchfile), benchmarkTime(0.f), frameCounter(0) { : State(game), benchfile(benchfile), benchmarkTime(0.f), duration(0.f), frameCounter(0) {
} }
void BenchmarkState::enter() { void BenchmarkState::enter() {

View File

@ -16,6 +16,7 @@
ViewerWidget::ViewerWidget(QGLFormat g, QWidget* parent, ViewerWidget::ViewerWidget(QGLFormat g, QWidget* parent,
const QGLWidget* shareWidget, Qt::WindowFlags f) const QGLWidget* shareWidget, Qt::WindowFlags f)
: QGLWidget(g, parent, shareWidget, f) : QGLWidget(g, parent, shareWidget, f)
, renderer(nullptr)
, gworld(nullptr) , gworld(nullptr)
, activeModel(nullptr) , activeModel(nullptr)
, selectedFrame(nullptr) , selectedFrame(nullptr)
@ -76,6 +77,7 @@ void ViewerWidget::paintGL() {
if (world() == nullptr) return; if (world() == nullptr) return;
RW_CHECK(renderer != nullptr, "GameRenderer is null");
auto& r = *renderer; auto& r = *renderer;
r.setViewport(width(), height()); r.setViewport(width(), height());
@ -163,7 +165,11 @@ void ViewerWidget::drawFrameWidget(ModelFrame* f, const glm::mat4& m) {
glLineWidth(1.f); glLineWidth(1.f);
} }
dp.textures = {whiteTex}; dp.textures = {whiteTex};
renderer->getRenderer()->drawArrays(thisM, _frameWidgetDraw, dp);
RW_CHECK(renderer != nullptr, "GameRenderer is null");
if(renderer != nullptr) {
renderer->getRenderer()->drawArrays(thisM, _frameWidgetDraw, dp);
}
for (auto c : f->getChildren()) { for (auto c : f->getChildren()) {
drawFrameWidget(c.get(), thisM); drawFrameWidget(c.get(), thisM);