summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-02 10:39:33 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-02 10:39:33 +0000
commite89ecd460dd2aa14aa7fd01292628fb74cb34692 (patch)
treee92c24b0677d30e81e6532b874b6afb0a363a63f /src
parent4e668b287b3c32d4f586febdd259983f2f0504c3 (diff)
downloadmana-e89ecd460dd2aa14aa7fd01292628fb74cb34692.tar.gz
mana-e89ecd460dd2aa14aa7fd01292628fb74cb34692.tar.bz2
mana-e89ecd460dd2aa14aa7fd01292628fb74cb34692.tar.xz
mana-e89ecd460dd2aa14aa7fd01292628fb74cb34692.zip
Less Image::setAlpha calls.
Diffstat (limited to 'src')
-rw-r--r--src/gui/progressbar.cpp24
-rw-r--r--src/gui/setup.cpp3
-rw-r--r--src/gui/setup.h1
-rw-r--r--src/gui/window.cpp7
-rw-r--r--src/log.cpp3
5 files changed, 15 insertions, 23 deletions
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 8b051cbb..e84c235e 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -35,7 +35,7 @@ ProgressBar::ProgressBar(float progress, int x, int y, int width, int height,
setY(y);
setWidth(width);
setHeight(height);
-
+
// Load dialog title bar image
ResourceManager *resman = ResourceManager::getInstance();
Image *dBorders = resman->getImage("graphics/gui/vscroll_grey.png");
@@ -45,24 +45,12 @@ ProgressBar::ProgressBar(float progress, int x, int y, int width, int height,
dLeftBorder = dBorders->getSubImage(0, 4, 4, 10);
dRightBorder = dBorders->getSubImage(7, 4, 4, 10);
dBottomBorder = dBorders->getSubImage(4, 15, 3, 4);
-
+
dTopLeftBorder = dBorders->getSubImage(0, 0, 4, 4);
dTopRightBorder = dBorders->getSubImage(7, 0, 4, 4);
dBottomRightBorder = dBorders->getSubImage(7, 15, 4, 4);
dBottomLeftBorder = dBorders->getSubImage(0, 15, 4, 4);
-
- dBackground->setAlpha(1.0f);
-
- dTopBorder->setAlpha(1.0f);
- dBottomBorder->setAlpha(1.0f);
- dLeftBorder->setAlpha(1.0f);
- dRightBorder->setAlpha(1.0f);
-
- dTopLeftBorder->setAlpha(1.0f);
- dTopRightBorder->setAlpha(1.0f);
- dBottomLeftBorder->setAlpha(1.0f);
- dBottomRightBorder->setAlpha(1.0f);
-
+
colorBar = Image::create(getWidth() - 8, getHeight() - 8);
if (colorBar) {
colorBar->fillWithColor(red, green, blue);
@@ -81,7 +69,7 @@ void ProgressBar::draw(gcn::Graphics *graphics)
{
int absx, absy;
getAbsolutePosition(absx, absy);
-
+
// We're drawing the bar itself first
// Background
dBackground->drawPattern(screen,
@@ -94,7 +82,7 @@ void ProgressBar::draw(gcn::Graphics *graphics)
dBottomLeftBorder->draw(screen, absx, absy + getHeight() - 4);
dBottomRightBorder->draw(screen,
absx+getWidth() - 4, absy+getHeight() - 4);
-
+
// The borders
dTopBorder->drawPattern(screen, absx + 4, absy, getWidth() - 8, 4);
dBottomBorder->drawPattern(screen, absx + 4, absy + getHeight() - 4,
@@ -104,7 +92,7 @@ void ProgressBar::draw(gcn::Graphics *graphics)
4, getHeight() - 8);
if (colorBar) {
- colorBar->draw(screen, 0, 0, absx + 4, absy + 4,
+ colorBar->draw(screen, 0, 0, absx + 4, absy + 4,
(int)(progress * float(getWidth() - 4)), getHeight() - 8);
}
}
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 13ba937d..4502dbac 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -32,6 +32,7 @@
#include "scrollarea.h"
#include "listbox.h"
#include "radiobutton.h"
+#include "slider.h"
#include "ok_dialog.h"
#include "../main.h"
#include <stdio.h>
@@ -106,6 +107,7 @@ Setup::Setup():
disabledRadio = new RadioButton("Disabled", "Modes", false);
applyButton = new Button("Apply");
cancelButton = new Button("Cancel");
+ //alphaSlider = new Slider(1.0);
// Set selections
last_sel = 0;
@@ -144,6 +146,7 @@ Setup::Setup():
//add(disabledRadio);
add(applyButton);
add(cancelButton);
+ //add(alphaSlider);
setLocationRelativeTo(getParent());
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 2bfab15e..a7ed422e 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -77,6 +77,7 @@ class Setup : public Window, public gcn::ActionListener {
gcn::ListBox *modeList;
gcn::Button *applyButton;
gcn::Button *cancelButton;
+ gcn::Slider *alphaSlider;
// Video selections
int last_sel, sel;
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 7eb8643f..ab37dae8 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -69,6 +69,10 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
// Load GUI alpha setting
guiAlpha = config.getValue("guialpha", 0.8f);
+
+ // Set GUI alpha level
+ dBackground->setAlpha(guiAlpha);
+ dBorders->setAlpha(guiAlpha);
}
Window::~Window()
@@ -100,9 +104,6 @@ void Window::draw(gcn::Graphics* graphics)
{
int x, y;
getAbsolutePosition(x, y);
-
- dBackground->setAlpha(guiAlpha);
- dBorders->setAlpha(guiAlpha);
((Graphics*)graphics)->drawImageRect(x, y, getWidth(), getHeight(),
border);
diff --git a/src/log.cpp b/src/log.cpp
index df92e49e..df7b4fd5 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -83,12 +83,11 @@ void Logger::log(const char *log_text, ...)
void Logger::error(const std::string &error_text)
{
-
+ log("Error: %s", error_text.c_str());
#ifdef WIN32
MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR | MB_OK);
#else
std::cerr << "Error: " << error_text << std::endl;
- log("Error: %s", error_text.c_str());
#endif
exit(1);
}