Skip to content

Commit

Permalink
KOTOR: Add barebone resolution submenu to graphics menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius authored and DrMcCoy committed May 5, 2018
1 parent 09a54cd commit 55ecfd0
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/engines/kotor/gui/options/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "src/engines/kotor/gui/options/graphics.h"
#include "src/engines/kotor/gui/options/graphicsadv.h"
#include "src/engines/kotor/gui/options/resolution.h"

#include "src/engines/kotor/gui/widgets/checkbox.h"

Expand All @@ -41,6 +42,7 @@ OptionsGraphicsMenu::OptionsGraphicsMenu(::Engines::Console *console) : GUI(cons
addBackground(kBackgroundTypeMenu);

_advanced.reset(new OptionsGraphicsAdvancedMenu(_console));
_resolution.reset(new OptionsResolutionMenu(_console));

//Hardcoded, the gui file returns incorrect values
getCheckBox("CB_SHADOWS", true)->setColor(0.0f, 0.658824f, 0.980392f, 1.0f);
Expand Down Expand Up @@ -68,6 +70,11 @@ void OptionsGraphicsMenu::callbackActive(Widget &widget) {
return;
}

if (widget.getTag() == "BTN_RESOLUTION") {
sub(*_resolution, kStartCodeNone, true, false);
return;
}

if (widget.getTag() == "BTN_DEFAULT") {
_shadows = true;
setCheckBoxState("CB_SHADOWS", _shadows);
Expand Down
1 change: 1 addition & 0 deletions src/engines/kotor/gui/options/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class OptionsGraphicsMenu : public GUI {
bool _shadows;
bool _grass;

Common::ScopedPtr<GUI> _resolution;
Common::ScopedPtr<GUI> _advanced;
};

Expand Down
51 changes: 51 additions & 0 deletions src/engines/kotor/gui/options/resolution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* 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 graphics resolution menu.
*/

#include "src/engines/kotor/gui/options/resolution.h"

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

namespace Engines {

namespace KotOR {

OptionsResolutionMenu::OptionsResolutionMenu(Console *console) : GUI(console) {
load("optresolution");

WidgetPanel *guiPanel = getPanel("TGuiPanel");
guiPanel->setPosition(-guiPanel->getWidth()/2, -guiPanel->getHeight()/2, 0);
}

void OptionsResolutionMenu::callbackActive(Widget &widget) {
// TODO: Add changing of resolutions

if (widget.getTag() == "BTN_CANCEL") {
_returnCode = kReturnCodeAbort;
return;
}
}

} // End of namespace KotOR

} // End of namespace Engines
46 changes: 46 additions & 0 deletions src/engines/kotor/gui/options/resolution.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* 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 graphics resolution menu.
*/

#ifndef ENGINES_KOTOR_GUI_OPTIONS_RESOLUTION_H
#define ENGINES_KOTOR_GUI_OPTIONS_RESOLUTION_H

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

namespace Engines {

namespace KotOR {

class OptionsResolutionMenu : public GUI {
public:
OptionsResolutionMenu(::Engines::Console *console = 0);

protected:
void callbackActive(Widget &widget);
};

} // End of namespace KotOR

} // End of namespace Engines

#endif // ENGINES_KOTOR_GUI_OPTIONS_RESOLUTION_H
2 changes: 2 additions & 0 deletions src/engines/kotor/gui/options/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ src_engines_kotor_libkotor_la_SOURCES += \
src/engines/kotor/gui/options/graphicsadv.h \
src/engines/kotor/gui/options/sound.h \
src/engines/kotor/gui/options/soundadv.h \
src/engines/kotor/gui/options/resolution.h \
$(EMPTY)

src_engines_kotor_libkotor_la_SOURCES += \
Expand All @@ -41,4 +42,5 @@ src_engines_kotor_libkotor_la_SOURCES += \
src/engines/kotor/gui/options/graphicsadv.cpp \
src/engines/kotor/gui/options/sound.cpp \
src/engines/kotor/gui/options/soundadv.cpp \
src/engines/kotor/gui/options/resolution.cpp \
$(EMPTY)

0 comments on commit 55ecfd0

Please sign in to comment.