2016-10-05 16:03:29 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2015 Dimok
|
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
|
|
|
#include "SplashScreen.h"
|
|
|
|
#include "gui/GuiTrigger.h"
|
|
|
|
#include "gui/GuiController.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor for the GuiButton class.
|
|
|
|
*/
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
SplashScreen::SplashScreen(GuiImageData *img) {
|
2016-10-05 16:03:29 +02:00
|
|
|
img_real = new GuiImage(img);
|
|
|
|
img_real->setAlignment(ALIGN_CENTER | ALIGN_CENTER);
|
|
|
|
img_real->setPosition(0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor for the GuiButton class.
|
|
|
|
*/
|
2020-07-05 13:34:13 +02:00
|
|
|
SplashScreen::~SplashScreen() {
|
|
|
|
state = 0;
|
|
|
|
delete (img_real);
|
2016-10-05 16:03:29 +02:00
|
|
|
}
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
void SplashScreen::setSplashImageData(GuiImageData *img) {
|
2016-10-05 16:03:29 +02:00
|
|
|
img_real->setImageData(img);
|
|
|
|
}
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
void SplashScreen::FadeExit() {
|
|
|
|
trasparency = 1.0f;
|
|
|
|
state = 1;
|
|
|
|
img_real->setAlpha(trasparency);
|
2016-10-05 16:03:29 +02:00
|
|
|
}
|
2020-07-05 13:34:13 +02:00
|
|
|
|
|
|
|
void SplashScreen::FadeEnter() {
|
|
|
|
trasparency = 0.0f;
|
|
|
|
state = 2;
|
|
|
|
img_real->setAlpha(trasparency);
|
2016-10-05 16:03:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draw the button on screen
|
|
|
|
*/
|
2020-07-05 13:34:13 +02:00
|
|
|
void SplashScreen::draw(CVideo *v) {
|
|
|
|
if (state != 0) {
|
|
|
|
switch (state) {
|
|
|
|
case 1:
|
|
|
|
if (trasparency > 0.0f) {
|
|
|
|
trasparency = trasparency - 0.05f;
|
|
|
|
img_real->setAlpha(trasparency);
|
|
|
|
} else state = 0;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (trasparency < 1.0f) {
|
|
|
|
trasparency = trasparency + 0.05f;
|
|
|
|
img_real->setAlpha(trasparency);
|
|
|
|
} else state = 0;
|
|
|
|
break;
|
2016-10-05 16:03:29 +02:00
|
|
|
}
|
2020-07-05 13:34:13 +02:00
|
|
|
}
|
2016-10-05 16:03:29 +02:00
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
if (!this->isVisible())
|
|
|
|
return;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
// draw images
|
|
|
|
img_real->draw(v);
|
2016-10-05 16:03:29 +02:00
|
|
|
}
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
void SplashScreen::update(GuiController *c) {
|
2016-10-05 16:03:29 +02:00
|
|
|
|
|
|
|
}
|