summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorMajin Sniper <majinsniper@gmx.de>2009-02-20 00:19:52 +0100
committerIra Rice <irarice@gmail.com>2009-02-20 08:35:25 -0700
commitb2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9 (patch)
treeb7583428f7462c5a6711dfa7d92b43076ea8f29b /src/gui
parent00bbc2186302fe4365f08903a209e03bb8feb4c5 (diff)
downloadmana-client-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.tar.gz
mana-client-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.tar.bz2
mana-client-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.tar.xz
mana-client-b2eb8daa8c39bcfd5fbd3a76dbbc432b43c561a9.zip
Added a pickup notification as particle effect. Also make a ui option to enable/disable this effect (default is off) and another option to disable the pickup notification in the chat log (default is on).
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.cpp1
-rw-r--r--src/gui/gui.h8
-rw-r--r--src/gui/setup_video.cpp41
-rw-r--r--src/gui/setup_video.h6
-rw-r--r--src/gui/truetypefont.cpp3
-rw-r--r--src/gui/truetypefont.h2
6 files changed, 53 insertions, 8 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 4b5c375d..ed85fa8f 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -113,6 +113,7 @@ Gui::Gui(Graphics *graphics):
{
const int fontSize = (int)config.getValue("fontSize", 11);
mGuiFont = new TrueTypeFont(path, fontSize);
+ mInfoParicleFont = new TrueTypeFont(path, fontSize, 1);
}
catch (gcn::Exception e)
{
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 0c6529bd..e19a0a87 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -78,6 +78,13 @@ class Gui : public gcn::Gui
{ return mGuiFont; }
/**
+ * Return the Font used for "Info Particles", i.e. ones showing, what
+ * you picked up, etc.
+ */
+ gcn::Font* getInfoParticleFont() const
+ { return mInfoParicleFont; }
+
+ /**
* Sets whether a custom cursor should be rendered.
*/
void setUseCustomCursor(bool customCursor);
@@ -108,6 +115,7 @@ class Gui : public gcn::Gui
private:
GuiConfigListener *mConfigListener;
gcn::Font *mGuiFont; /**< The global GUI font */
+ gcn::Font *mInfoParicleFont; /**< Font for Info Paricles*/
bool mCustomCursor; /**< Show custom cursor */
ImageSet *mMouseCursors; /**< Mouse cursor images */
float mMouseCursorAlpha;
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 8b21582e..35c58ecd 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -110,6 +110,8 @@ Setup_Video::Setup_Video():
mCustomCursorEnabled(config.getValue("customcursor", true)),
mParticleEffectsEnabled(config.getValue("particleeffects", true)),
mNameEnabled(config.getValue("showownname", false)),
+ mPickupChatEnabled(config.getValue("showpickupchat", true)),
+ mPickupParticleEnabled(config.getValue("showpickupparticle", false)),
mOpacity(config.getValue("guialpha", 0.8)),
mFps((int) config.getValue("fpslimit", 0)),
mSpeechMode((int) config.getValue("speech", 3)),
@@ -137,7 +139,11 @@ Setup_Video::Setup_Video():
mOverlayDetailField(new gcn::Label("")),
mParticleDetail(3 - (int) config.getValue("particleEmitterSkip", 1)),
mParticleDetailSlider(new Slider(0, 3)),
- mParticleDetailField(new gcn::Label(""))
+ mParticleDetailField(new gcn::Label("")),
+ mPickupNotifyLabel(new gcn::Label(_("Show pickup notification"))),
+ mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)),
+ mPickupParticleCheckBox(new CheckBox(_("as particle"),
+ mPickupParticleEnabled))
{
setOpaque(false);
@@ -170,6 +176,8 @@ Setup_Video::Setup_Video():
mModeList->setActionEventId("videomode");
mCustomCursorCheckBox->setActionEventId("customcursor");
mParticleEffectsCheckBox->setActionEventId("particleeffects");
+ mPickupChatCheckBox->setActionEventId("pickupchat");
+ mPickupParticleCheckBox->setActionEventId("pickupparticle");
mNameCheckBox->setActionEventId("showownname");
mAlphaSlider->setActionEventId("guialpha");
mFpsCheckBox->setActionEventId("fpslimitcheckbox");
@@ -187,6 +195,8 @@ Setup_Video::Setup_Video():
mModeList->addActionListener(this);
mCustomCursorCheckBox->addActionListener(this);
mParticleEffectsCheckBox->addActionListener(this);
+ mPickupChatCheckBox->addActionListener(this);
+ mPickupParticleCheckBox->addActionListener(this);
mNameCheckBox->addActionListener(this);
mAlphaSlider->addActionListener(this);
mFpsCheckBox->addActionListener(this);
@@ -261,11 +271,14 @@ Setup_Video::Setup_Video():
ContainerPlacer place = h.getPlacer(0, 0);
place(0, 0, scrollArea, 1, 6).setPadding(2);
- place(1, 0, mFsCheckBox, 3);
- place(1, 1, mOpenGLCheckBox, 3);
- place(1, 2, mCustomCursorCheckBox, 3);
- place(1, 3, mNameCheckBox, 3);
- place(1, 4, mParticleEffectsCheckBox, 3);
+ place(1, 0, mFsCheckBox, 2);
+ place(3, 0, mOpenGLCheckBox, 1);
+ place(1, 1, mCustomCursorCheckBox, 3);
+ place(1, 2, mNameCheckBox, 3);
+ place(1, 3, mParticleEffectsCheckBox, 3);
+ place(1, 4, mPickupNotifyLabel, 3);
+ place(1, 5, mPickupChatCheckBox, 1);
+ place(2, 5, mPickupParticleCheckBox, 2);
place(0, 6, mAlphaSlider);
place(0, 7, mFpsSlider);
@@ -355,6 +368,8 @@ void Setup_Video::apply()
mOpacity = config.getValue("guialpha", 0.8);
mOverlayDetail = (int) config.getValue("OverlayDetail", 2);
mOpenGLEnabled = config.getValue("opengl", false);
+ mPickupChatEnabled = config.getValue("showpickupchat", true);
+ mPickupParticleEnabled = config.getValue("showpickupparticle", false);
}
int Setup_Video::updateSlider(gcn::Slider *slider, gcn::TextField *field,
@@ -401,6 +416,9 @@ void Setup_Video::cancel()
config.setValue("showownname", mNameEnabled ? true : false);
config.setValue("guialpha", mOpacity);
config.setValue("opengl", mOpenGLEnabled ? true : false);
+ config.setValue("showpickupchat", mPickupChatEnabled ? true : false);
+ config.setValue("showpickupparticle", mPickupParticleEnabled ?
+ true : false);
}
void Setup_Video::action(const gcn::ActionEvent &event)
@@ -434,6 +452,17 @@ void Setup_Video::action(const gcn::ActionEvent &event)
new OkDialog(_("Particle effect settings changed"),
_("Restart your client or change maps for the change to take effect."));
}
+ else if (event.getId() == "pickupchat")
+ {
+ config.setValue("showpickupchat", mPickupChatCheckBox->isSelected()
+ ? true : false);
+ }
+ else if (event.getId() == "pickupparticle")
+ {
+ config.setValue("showpickupparticle",
+ mPickupParticleCheckBox->isSelected()
+ ? true : false);
+ }
else if (event.getId() == "speech")
{
int val = (int) mSpeechSlider->getValue();
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 525e8941..b491cf23 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -53,6 +53,8 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
bool mCustomCursorEnabled;
bool mParticleEffectsEnabled;
bool mNameEnabled;
+ bool mPickupChatEnabled;
+ bool mPickupParticleEnabled;
double mOpacity;
int mFps;
int mSpeechMode;
@@ -95,6 +97,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
int mParticleDetail;
gcn::Slider *mParticleDetailSlider;
gcn::Label *mParticleDetailField;
+
+ gcn::Label *mPickupNotifyLabel;
+ gcn::CheckBox *mPickupChatCheckBox;
+ gcn::CheckBox *mPickupParticleCheckBox;
};
#endif
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index 24c60caf..e50fb457 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -78,7 +78,7 @@ typedef std::list<TextChunk>::iterator CacheIterator;
static int fontCounter;
-TrueTypeFont::TrueTypeFont(const std::string& filename, int size)
+TrueTypeFont::TrueTypeFont(const std::string &filename, int size, int style)
{
if (fontCounter == 0 && TTF_Init() == -1)
{
@@ -88,6 +88,7 @@ TrueTypeFont::TrueTypeFont(const std::string& filename, int size)
++fontCounter;
mFont = TTF_OpenFont(filename.c_str(), size);
+ TTF_SetFontStyle (mFont, style);
if (!mFont)
{
diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h
index 35e8270f..085aa226 100644
--- a/src/gui/truetypefont.h
+++ b/src/gui/truetypefont.h
@@ -49,7 +49,7 @@ class TrueTypeFont : public gcn::Font
* @param filename Font filename.
* @param size Font size.
*/
- TrueTypeFont(const std::string& filename, int size);
+ TrueTypeFont(const std::string &filename, int size, int style = 0);
/**
* Destructor.