summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charcreatedialog.cpp3
-rw-r--r--src/gui/equipmentwindow.cpp3
-rw-r--r--src/gui/gui.cpp7
-rw-r--r--src/gui/sdlinput.cpp15
-rw-r--r--src/gui/setup_video.cpp116
-rw-r--r--src/gui/setup_video.h16
-rw-r--r--src/gui/viewport.cpp7
-rw-r--r--src/gui/widgets/resizegrip.cpp12
-rw-r--r--src/gui/widgets/window.cpp6
-rw-r--r--src/gui/windowmenu.cpp3
10 files changed, 41 insertions, 147 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 8fee148b..a36dfadf 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -148,6 +148,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
center();
setVisible(true);
mNameField->requestFocus();
+ setFixedGender(true, GENDER_MALE);
}
CharCreateDialog::~CharCreateDialog()
@@ -359,6 +360,8 @@ void CharCreateDialog::setFixedGender(bool fixed, Gender gender)
if (fixed)
{
mMale->setEnabled(false);
+ mMale->setVisible(false);
+ mFemale->setVisible(false);
mFemale->setEnabled(false);
}
}
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 85a4c766..9df8c98c 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -254,6 +254,9 @@ void EquipmentWindow::mouseMoved(gcn::MouseEvent &event)
int mouseX, mouseY;
SDL_GetMouseState(&mouseX, &mouseY);
+ mouseX /= graphics->getScale();
+ mouseY /= graphics->getScale();
+
// Show ItemTooltip
std::string slotName = getSlotName(x, y);
if (!slotName.empty())
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 78fc42fb..1b600a3d 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -112,7 +112,7 @@ Gui::Gui(Graphics *graphics):
// Set global font
const int fontSize = config.getValue("fontSize", 11);
- std::string fontFile = branding.getValue("font", "fonts/dejavusans.ttf");
+ std::string fontFile = branding.getValue("font", "fonts/DejaVuSerifCondensed.ttf");
std::string path = resman->getPath(fontFile);
try
@@ -127,7 +127,7 @@ Gui::Gui(Graphics *graphics):
}
// Set bold font
- fontFile = branding.getValue("boldFont", "fonts/dejavusans-bold.ttf");
+ fontFile = branding.getValue("boldFont", "fonts/DejaVuSerifCondensed-Bold.ttf");
path = resman->getPath(fontFile);
try
{
@@ -205,6 +205,9 @@ void Gui::draw()
int mouseX, mouseY;
Uint8 button = SDL_GetMouseState(&mouseX, &mouseY);
+ mouseX /= graphics->getScale();
+ mouseY /= graphics->getScale();
+
if ((Client::hasMouseFocus() || button & SDL_BUTTON(1))
&& mCustomCursor
&& mMouseCursorAlpha > 0.0f)
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 4ccb7580..46636d52 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -60,6 +60,8 @@
#include <guichan/exception.hpp>
+#include "graphics.h"
+
SDLInput::SDLInput()
{
mMouseInWindow = true;
@@ -73,14 +75,12 @@ bool SDLInput::isKeyQueueEmpty()
gcn::KeyInput SDLInput::dequeueKeyInput()
{
- gcn::KeyInput keyInput;
-
if (mKeyInputQueue.empty())
{
throw GCN_EXCEPTION("The queue is empty.");
}
- keyInput = mKeyInputQueue.front();
+ gcn::KeyInput keyInput = mKeyInputQueue.front();
mKeyInputQueue.pop();
return keyInput;
@@ -93,16 +93,19 @@ bool SDLInput::isMouseQueueEmpty()
gcn::MouseInput SDLInput::dequeueMouseInput()
{
- gcn::MouseInput mouseInput;
-
if (mMouseInputQueue.empty())
{
throw GCN_EXCEPTION("The queue is empty.");
}
- mouseInput = mMouseInputQueue.front();
+ gcn::MouseInput mouseInput = mMouseInputQueue.front();
mMouseInputQueue.pop();
+ // Scale the mouse input by the graphics scale ratio
+ int scale = graphics->getScale();
+ mouseInput.setX(mouseInput.getX() / scale);
+ mouseInput.setY(mouseInput.getY() / scale);
+
return mouseInput;
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 3c92aa31..6968e51c 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -28,7 +28,6 @@
#include "localplayer.h"
#include "log.h"
#include "main.h"
-#include "particle.h"
#include "gui/okdialog.h"
@@ -123,40 +122,10 @@ int ModeListModel::getIndexOf(const std::string &widthXHeightMode)
return -1;
}
-const char *Setup_Video::overlayDetailToString(int detail)
-{
- if (detail == -1)
- detail = config.getIntValue("OverlayDetail");
-
- switch (detail)
- {
- case 0: return _("off");
- case 1: return _("low");
- case 2: return _("high");
- }
- return "";
-}
-
-const char *Setup_Video::particleDetailToString(int detail)
-{
- if (detail == -1)
- detail = 3 - config.getIntValue("particleEmitterSkip");
-
- switch (detail)
- {
- case 0: return _("low");
- case 1: return _("medium");
- case 2: return _("high");
- case 3: return _("max");
- }
- return "";
-}
-
Setup_Video::Setup_Video():
mFullScreenEnabled(config.getBoolValue("screen")),
mOpenGLEnabled(config.getBoolValue("opengl")),
mCustomCursorEnabled(config.getBoolValue("customcursor")),
- mParticleEffectsEnabled(config.getBoolValue("particleeffects")),
mFps(config.getIntValue("fpslimit")),
mSDLTransparencyDisabled(config.getBoolValue("disableTransparency")),
mModeListModel(new ModeListModel),
@@ -165,17 +134,9 @@ Setup_Video::Setup_Video():
mOpenGLCheckBox(new CheckBox(_("OpenGL"), mOpenGLEnabled)),
mCustomCursorCheckBox(new CheckBox(_("Custom cursor"),
mCustomCursorEnabled)),
- mParticleEffectsCheckBox(new CheckBox(_("Particle effects"),
- mParticleEffectsEnabled)),
mFpsCheckBox(new CheckBox(_("FPS limit:"))),
mFpsSlider(new Slider(10, 120)),
mFpsLabel(new Label),
- mOverlayDetail(config.getIntValue("OverlayDetail")),
- mOverlayDetailSlider(new Slider(0, 2)),
- mOverlayDetailField(new Label),
- mParticleDetail(3 - config.getIntValue("particleEmitterSkip")),
- mParticleDetailSlider(new Slider(0, 3)),
- mParticleDetailField(new Label),
mDisableSDLTransparencyCheckBox(
new CheckBox(_("Disable transparency (Low CPU mode)"),
mSDLTransparencyDisabled))
@@ -188,9 +149,6 @@ Setup_Video::Setup_Video():
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
scrollArea->setSize(100, 200);
- overlayDetailLabel = new Label(_("Ambient FX:"));
- particleDetailLabel = new Label(_("Particle detail:"));
-
mModeList->setEnabled(true);
#ifndef USE_OPENGL
@@ -203,9 +161,6 @@ Setup_Video::Setup_Video():
mFpsSlider->setEnabled(mFps > 0);
mFpsCheckBox->setSelected(mFps > 0);
- overlayDetailLabel->setAlignment(Graphics::RIGHT);
- particleDetailLabel->setAlignment(Graphics::RIGHT);
-
// If the openGL Mode is enabled, disabling the transaprency
// is irrelevant.
mDisableSDLTransparencyCheckBox->setEnabled(!mOpenGLEnabled);
@@ -218,34 +173,18 @@ Setup_Video::Setup_Video():
// Set actions
mModeList->setActionEventId("videomode");
mCustomCursorCheckBox->setActionEventId("customcursor");
- mParticleEffectsCheckBox->setActionEventId("particleeffects");
mDisableSDLTransparencyCheckBox->setActionEventId("disableTransparency");
mFpsCheckBox->setActionEventId("fpslimitcheckbox");
mFpsSlider->setActionEventId("fpslimitslider");
- mOverlayDetailSlider->setActionEventId("overlaydetailslider");
- mOverlayDetailField->setActionEventId("overlaydetailfield");
mOpenGLCheckBox->setActionEventId("opengl");
- mParticleDetailSlider->setActionEventId("particledetailslider");
- mParticleDetailField->setActionEventId("particledetailfield");
// Set listeners
mModeList->addActionListener(this);
mCustomCursorCheckBox->addActionListener(this);
mOpenGLCheckBox->addActionListener(this);
- mParticleEffectsCheckBox->addActionListener(this);
mDisableSDLTransparencyCheckBox->addActionListener(this);
mFpsCheckBox->addActionListener(this);
mFpsSlider->addActionListener(this);
- mOverlayDetailSlider->addActionListener(this);
- mOverlayDetailField->addKeyListener(this);
- mParticleDetailSlider->addActionListener(this);
- mParticleDetailField->addKeyListener(this);
-
- mOverlayDetailField->setCaption(overlayDetailToString(mOverlayDetail));
- mOverlayDetailSlider->setValue(mOverlayDetail);
-
- mParticleDetailField->setCaption(particleDetailToString(mParticleDetail));
- mParticleDetailSlider->setValue(mParticleDetail);
// Do the layout
LayoutHelper h(this);
@@ -258,26 +197,10 @@ Setup_Video::Setup_Video():
place(2, 0, mFsCheckBox);
place(2, 1, mOpenGLCheckBox);
place(2, 2, mCustomCursorCheckBox);
-
- place = h.getPlacer(0, 1);
- place.getCell().setHAlign(LayoutCell::FILL);
-
- place(0, 0, space, 3);
- place(0, 1, mDisableSDLTransparencyCheckBox, 4);
-
- place(0, 2, mFpsCheckBox);
- place(1, 2, mFpsSlider, 2);
- place(3, 2, mFpsLabel);
-
- place(0, 3, mParticleEffectsCheckBox, 4);
-
- place(0, 4, particleDetailLabel);
- place(1, 4, mParticleDetailSlider, 2);
- place(3, 4, mParticleDetailField);
-
- place(0, 5, overlayDetailLabel);
- place(1, 5, mOverlayDetailSlider, 2);
- place(3, 5, mOverlayDetailField);
+ place(2, 3, mDisableSDLTransparencyCheckBox, 4);
+ place(2, 4, mFpsCheckBox);
+ place(3, 4, mFpsSlider, 2);
+ place(5, 4, mFpsLabel);
setDimension(gcn::Rectangle(0, 0, 370, 300));
}
@@ -402,8 +325,6 @@ void Setup_Video::apply()
// We sync old and new values at apply time
mFullScreenEnabled = config.getBoolValue("screen");
mCustomCursorEnabled = config.getBoolValue("customcursor");
- mParticleEffectsEnabled = config.getBoolValue("particleeffects");
- mOverlayDetail = config.getIntValue("OverlayDetail");
mOpenGLEnabled = config.getBoolValue("opengl");
mSDLTransparencyDisabled = config.getBoolValue("disableTransparency");
}
@@ -414,11 +335,8 @@ void Setup_Video::cancel()
mFsCheckBox->setSelected(mFullScreenEnabled);
mOpenGLCheckBox->setSelected(mOpenGLEnabled);
mCustomCursorCheckBox->setSelected(mCustomCursorEnabled);
- mParticleEffectsCheckBox->setSelected(mParticleEffectsEnabled);
mFpsSlider->setValue(mFps);
mFpsSlider->setEnabled(mFps > 0);
- mOverlayDetailSlider->setValue(mOverlayDetail);
- mParticleDetailSlider->setValue(mParticleDetail);
std::string text = mFpsCheckBox->isSelected() ? toString(mFps) : _("None");
mFpsLabel->setCaption(text);
mDisableSDLTransparencyCheckBox->setSelected(mSDLTransparencyDisabled);
@@ -432,7 +350,6 @@ void Setup_Video::cancel()
mModeList->setSelected(mModeListModel->getIndexOf(videoMode));
config.setValue("customcursor", mCustomCursorEnabled);
- config.setValue("particleeffects", mParticleEffectsEnabled);
config.setValue("opengl", mOpenGLEnabled);
config.setValue("disableTransparency", mSDLTransparencyDisabled);
}
@@ -445,31 +362,6 @@ void Setup_Video::action(const gcn::ActionEvent &event)
{
config.setValue("customcursor", mCustomCursorCheckBox->isSelected());
}
- else if (id == "particleeffects")
- {
- config.setValue("particleeffects",
- mParticleEffectsCheckBox->isSelected());
- Particle::enabled = mParticleEffectsCheckBox->isSelected();
-
- if (Game::instance())
- {
- new OkDialog(_("Particle Effect Settings Changed."),
- _("Changes will take effect on map change."));
- }
- }
- else if (id == "overlaydetailslider")
- {
- int val = (int) mOverlayDetailSlider->getValue();
- mOverlayDetailField->setCaption(overlayDetailToString(val));
- config.setValue("OverlayDetail", val);
- }
- else if (id == "particledetailslider")
- {
- int val = (int) mParticleDetailSlider->getValue();
- mParticleDetailField->setCaption(particleDetailToString(val));
- config.setValue("particleEmitterSkip", 3 - val);
- Particle::emitterSkip = 4 - val;
- }
else if (id == "fpslimitcheckbox" || id == "fpslimitslider")
{
int fps = (int) mFpsSlider->getValue();
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 7002a936..d09620fa 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -44,15 +44,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
void action(const gcn::ActionEvent &event);
- static const char *overlayDetailToString(int detail = -1);
-
- static const char *particleDetailToString(int detail = -1);
-
private:
bool mFullScreenEnabled;
bool mOpenGLEnabled;
bool mCustomCursorEnabled;
- bool mParticleEffectsEnabled;
int mFps;
bool mSDLTransparencyDisabled;
@@ -60,27 +55,16 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
//gcn::Label *scrollRadiusLabel;
//gcn::Label *scrollLazinessLabel;
- gcn::Label *overlayDetailLabel;
- gcn::Label *particleDetailLabel;
gcn::ListBox *mModeList;
gcn::CheckBox *mFsCheckBox;
gcn::CheckBox *mOpenGLCheckBox;
gcn::CheckBox *mCustomCursorCheckBox;
- gcn::CheckBox *mParticleEffectsCheckBox;
gcn::CheckBox *mFpsCheckBox;
gcn::Slider *mFpsSlider;
gcn::Label *mFpsLabel;
- int mOverlayDetail;
- gcn::Slider *mOverlayDetailSlider;
- gcn::Label *mOverlayDetailField;
-
- int mParticleDetail;
- gcn::Slider *mParticleDetailSlider;
- gcn::Label *mParticleDetailField;
-
gcn::CheckBox *mDisableSDLTransparencyCheckBox;
};
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 1b5b00c3..0aab399c 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -286,6 +286,10 @@ void Viewport::logic()
void Viewport::_followMouse()
{
Uint8 button = SDL_GetMouseState(&mMouseX, &mMouseY);
+
+ mMouseX /= graphics->getScale();
+ mMouseY /= graphics->getScale();
+
// If the left button is dragged
if (mPlayerFollowMouse && button & SDL_BUTTON(1))
{
@@ -313,6 +317,9 @@ void Viewport::_drawDebugPath(Graphics *graphics)
// Get the current mouse position
SDL_GetMouseState(&mMouseX, &mMouseY);
+ mMouseX /= graphics->getScale();
+ mMouseY /= graphics->getScale();
+
// Prepare the walkmask corresponding to the protocol
unsigned char walkMask;
switch (Net::getNetworkType())
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index da97ac69..7b37b282 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -58,11 +58,11 @@ ResizeGrip::~ResizeGrip()
void ResizeGrip::draw(gcn::Graphics *graphics)
{
- if (config.getFloatValue("guialpha") != mAlpha)
- {
- mAlpha = config.getFloatValue("guialpha");
- gripImage->setAlpha(mAlpha);
- }
+ //if (config.getFloatValue("guialpha") != mAlpha)
+ //{
+ // mAlpha = config.getFloatValue("guialpha");
+ // gripImage->setAlpha(mAlpha);
+ //}
- static_cast<Graphics*>(graphics)->drawImage(gripImage, 0, 0);
+ //static_cast<Graphics*>(graphics)->drawImage(gripImage, 0, 0);
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index c8788c75..406f55ef 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -68,8 +68,8 @@ Window::Window(const std::string &caption, bool modal, Window *parent,
instances++;
setFrameSize(0);
- setPadding(3);
- setTitleBarHeight(20);
+ setPadding(5);
+ setTitleBarHeight(25);
// Loads the skin
mSkin = Theme::instance()->load(skin);
@@ -123,7 +123,7 @@ void Window::draw(gcn::Graphics *graphics)
{
g->setColor(Theme::getThemeColor(Theme::TEXT));
g->setFont(getFont());
- g->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
+ g->drawText(getCaption(), 7, 10, gcn::Graphics::LEFT);
}
// Draw Close Button
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 12624bf1..f503c84c 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -62,8 +62,7 @@ WindowMenu::WindowMenu():
addButton(N_("Skills"), x, h, "button-icon-skills.png",
KeyboardConfig::KEY_WINDOW_SKILL);
- if (specialsWindow->hasSpecials())
- addButton(N_("Specials"), x, h, "button-icon-specials.png");
+ addButton(N_("Specials"), x, h, "button-icon-specials.png");
addButton(N_("Social"), x, h, "button-icon-social.png",
KeyboardConfig::KEY_WINDOW_SOCIAL);