aboutsummaryrefslogtreecommitdiff
path: root/assets/dampflock4.blend
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2018-01-15 13:39:49 +0100
committerGitHub <noreply@github.com>2018-01-15 13:39:49 +0100
commit4049fca8cab7b211ba6096b2ac44ee3ea80da332 (patch)
treea435a6edccc777431ed33a58ec69432b0e11e1f2 /assets/dampflock4.blend
parent11da67f4264e7ed7b80c86f1441e4d2d948aff66 (diff)
downloadadvtrains-4049fca8cab7b211ba6096b2ac44ee3ea80da332.tar.gz
advtrains-4049fca8cab7b211ba6096b2ac44ee3ea80da332.tar.bz2
advtrains-4049fca8cab7b211ba6096b2ac44ee3ea80da332.zip
Revert assign_to_seat_group order on subway train
as train_operator on Linuxworks, it often happens that you accidentally manually drive a subway train. This is more effort to get to the drivers seat, but is how the behavior was for the last 6 months
Diffstat (limited to 'assets/dampflock4.blend')
0 files changed, 0 insertions, 0 deletions
38' href='#n138'>138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
/*
Part of Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>
Copyright (C) 2013 RealBadAngel, Maciej Kasatkin <mk@realbadangel.pl>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "guiVolumeChange.h"
#include "debug.h"
#include "guiButton.h"
#include "serialization.h"
#include <string>
#include <IGUICheckBox.h>
#include <IGUIButton.h>
#include <IGUIScrollBar.h>
#include <IGUIStaticText.h>
#include <IGUIFont.h>
#include "settings.h"

#include "gettext.h"

const int ID_soundText = 263;
const int ID_soundExitButton = 264;
const int ID_soundSlider = 265;
const int ID_soundMuteButton = 266;

GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env,
		gui::IGUIElement* parent, s32 id,
		IMenuManager *menumgr, ISimpleTextureSource *tsrc
):
	GUIModalMenu(env, parent, id, menumgr),
	m_tsrc(tsrc)
{
}

GUIVolumeChange::~GUIVolumeChange()
{
	removeChildren();
}

void GUIVolumeChange::removeChildren()
{
	if (gui::IGUIElement *e = getElementFromId(ID_soundText))
		e->remove();

	if (gui::IGUIElement *e = getElementFromId(ID_soundExitButton))
		e->remove();

	if (gui::IGUIElement *e = getElementFromId(ID_soundSlider))
		e->remove();

	if (gui::IGUIElement *e = getElementFromId(ID_soundMuteButton))
		e->remove();
}

void GUIVolumeChange::regenerateGui(v2u32 screensize)
{
	/*
		Remove stuff
	*/
	removeChildren();
	/*
		Calculate new sizes and positions
	*/
	const float s = m_gui_scale;
	DesiredRect = core::rect<s32>(
		screensize.X / 2 - 380 * s / 2,
		screensize.Y / 2 - 200 * s / 2,
		screensize.X / 2 + 380 * s / 2,
		screensize.Y / 2 + 200 * s / 2
	);
	recalculateAbsolutePosition(false);

	v2s32 size = DesiredRect.getSize();
	int volume = (int)(g_settings->getFloat("sound_volume") * 100);

	/*
		Add stuff
	*/
	{
		core::rect<s32> rect(0, 0, 160 * s, 20 * s);
		rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 70 * s);

		const wchar_t *text = wgettext("Sound Volume: ");
		core::stringw volume_text = text;
		delete [] text;

		volume_text += core::stringw(volume) + core::stringw("%");
		Environment->addStaticText(volume_text.c_str(), rect, false,
				true, this, ID_soundText);
	}
	{