Commit a311c771 authored by Gerhard Stein's avatar Gerhard Stein

More Cleanups

parent 11640b49
......@@ -27,6 +27,7 @@ CGameLauncher::CGameLauncher()
m_chosenGame = -1;
m_ep1slot = -1;
mpLauncherDialog = new CGUIDialog(CRect<float>(0.1f, 0.1f, 0.8f, 0.8f));
mpLauncherDialog->initBackground();
}
////
......
......@@ -16,6 +16,8 @@ mpMenuDialog( new CGUIDialog(rect) )
std::string closeString;
CGUIButton* pButton;
mpMenuDialog->initBackground();
if(g_pBehaviorEngine->getEngine() == ENGINE_GALAXY)
{
CRect<float> rect(0.30f, 0.28f, 0.5f, 0.5f);
......@@ -32,6 +34,7 @@ mpMenuDialog( new CGUIDialog(rect) )
mpMenuDialog->addControl( pButton, CRect<float>(0.0f, 0.0f, 0.06f/rect.w, 0.06f/rect.h) );
}
pButton->setDown(true);
mpReturnButton = pButton;
}
......
......@@ -7,7 +7,6 @@
#include "CBaseMenu.h"
#include "SmartPointer.h"
#include "gui/CGUIDialog.h"
#include "engine/CEvent.h"
#ifndef CMAINMENU_H_
......
......@@ -13,7 +13,6 @@
#include "core/CBaseEngine.h"
#include "common/Menu/CProfilesMenu.h"
#include "engine/CEGAGraphics.h"
#include "gui/CGUIDialog.h"
#include "SmartPointer.h"
enum load_states{
......
......@@ -44,12 +44,12 @@ m_mustclose(false)
mRect.x = (1.0f - mRect.w)/2.0f;
mRect.y = (1.0f - mRect.h)/2.0f;
// now let's center the long text...
// now let's center that long text...
CRect<float> TextRect;
TextRect.x = 0.055f/mRect.w;
TextRect.y = 0.05f/mRect.h;
TextRect.w = 0.9f;
TextRect.h = 0.9f;
TextRect.w = 0.95f;
TextRect.h = 0.95f;
addControl( mpTextCtrl, TextRect );
......@@ -57,11 +57,13 @@ m_mustclose(false)
closeRect.x = mRect.x;
closeRect.y = mRect.y;
pButton->setRect(closeRect);
initBackground();
}
void CMessageBox::processLogic()
{
// TODO: Here we need to process the close logic, The (X) already work, but command must be caught here!
if(g_pInput->getPressedAnyCommand())
m_mustclose = true;
CGUIDialog::processLogic();
}
......
......@@ -12,10 +12,6 @@
#include "common/CBehaviorEngine.h"
#include "engine/CIntro.h"
#include "gui/CGUIDialog.h"
#include "gui/CGUIButton.h"
namespace vorticon
{
......
......@@ -12,57 +12,7 @@
CMessageBoxVort::CMessageBoxVort(const std::string& Text, bool lower, bool keymsg, bool leftbound) :
CMessageBox(Text, lower, keymsg, leftbound)
{
/*std::string buf;
if(m_keymsg)
{
m_Lines.push_back("");
buf = "Press any KEY/BUTTON ";
if( m_text_width<buf.size() )
m_text_width=buf.size();
else
{
size_t trail = m_text_width-buf.size();
buf.insert((size_t)0,trail,' ');
}
m_Lines.push_back(buf);
}
// try to center that dialog box
m_boxrect = g_pVideoDriver->getGameResolution().SDLRect();
int h = m_boxrect.h;
m_boxrect.x = m_boxrect.w/2;
m_boxrect.y = m_boxrect.h/2;
m_boxrect.h = (m_Lines.size()+2)*8;
m_boxrect.w = (m_text_width+2)*8;
m_boxrect.x -= m_boxrect.w/2;
if(!lower)
m_boxrect.y -= m_boxrect.h/2;
else
m_boxrect.y = h-m_boxrect.h;
if(leftbound) m_boxrect.x = 0;
SDL_Surface *tempsfc = SDL_CreateRGBSurface( SDL_SWSURFACE, m_boxrect.w, m_boxrect.h, 32, 0, 0, 0, 0 );
const SDL_Surface *blit = g_pVideoDriver->mp_VideoEngine->getBlitSurface();
mMsgBoxSfc = SDL_ConvertSurface( tempsfc, blit->format, blit->flags );
SDL_FreeSurface(tempsfc);
m_boxrect.h /= 8;
m_boxrect.w /= 8;
mp_DlgFrame = new CDlgFrame(m_boxrect.x, m_boxrect.y,
m_boxrect.w*8, m_boxrect.h*8, DLG_THEME_VORTICON);
*/
}
{}
// This function is used in your Ship need those parts.
// This special Messagebox can hold up to 4 images
......@@ -76,47 +26,3 @@ void CMessageBoxVort::addTileAt(Uint16 tile, Uint16 x, Uint16 y)
m_Tiles.push_back(tileholder);
}
//#define TWIRL_TIME 5
/*void CMessageBoxVort::process()
{
// Look, if somebody pressed a button, and close this dialog!
if(g_pInput->getPressedAnyCommand())
{
m_mustclose = true;
return;
}
// Draw the empty Dialog Box
mp_DlgFrame->draw(mMsgBoxSfc.get());
// Draw the Text on our surface
for( size_t i=0 ; i<m_Lines.size() ; i++)
g_pGfxEngine->getFont(1).drawFont(mMsgBoxSfc.get(), m_Lines[i], 8, ((i+1)*8) );
// Draw additional tiles on the surface if any where defined
for(size_t i=0 ; i<m_Tiles.size() ; i++)
{
g_pGfxEngine->getTileMap(1).drawTile(mMsgBoxSfc.get(), m_boxrect.x+m_Tiles[i].x,
m_boxrect.y+m_Tiles[i].y, m_Tiles[i].tile);
}
if(m_keymsg)
{
// Draw the twirl
if( m_twirltimer >= TWIRL_TIME )
{
m_twirltimer = 0;
if(m_twirlframe >= 7)
m_twirlframe=0;
else
m_twirlframe++;
}
else m_twirltimer++;
g_pGfxEngine->getCursor()->draw( mMsgBoxSfc.get(), m_twirlframe,
mp_DlgFrame->m_x+(mp_DlgFrame->m_w-16),
mp_DlgFrame->m_y+(mp_DlgFrame->m_h-16));
}
g_pVideoDriver->mDrawTasks.add( new BlitSurfaceTask( mMsgBoxSfc, NULL, &m_boxrect ) );
}*/
This diff is collapsed.
......@@ -185,15 +185,15 @@ void CGUIButton::drawNoStyle(SDL_Rect& lRect)
if( mButtonUp )
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00CFCFCF );
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00BFBFBF );
}
else if( mButtonDown )
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00DFDFDF );
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00CFCFCF );
}
else if( mHovered )
{
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00EFEFEF );
drawRect( blitsfc, &lRect, 1, 0x00BBBBBB, 0x00DFDFDF );
}
else
{
......
......@@ -49,6 +49,9 @@ public:
{ return mButtonUp; }
void setDown( const bool value )
{ mHovered = value; }
virtual void sendEvent(const InputCommands command) {};
......
......@@ -21,6 +21,21 @@ const unsigned int MAX_ELEMENTS_PER_PAGE = 7;
CGUIDialog::CGUIDialog(const CRect<float> &SrcRect) :
mRect(SrcRect),
mSelection(0)
{}
CGUIDialog::~CGUIDialog()
{
CVideoDriver *pVideoDriver = CVideoDriver::GetNoPtrChk();
if( pVideoDriver ) // This checks if the video object still exists, because if
{ // deleting drawing routine, it is not needed anymore
pVideoDriver->clearDrawingTasks();
}
}
void CGUIDialog::initBackground()
{
if( g_pBehaviorEngine->getEngine() == ENGINE_VORTICON )
{
......@@ -45,14 +60,6 @@ mSelection(0)
}
}
CGUIDialog::~CGUIDialog()
{
CVideoDriver *pVideoDriver = CVideoDriver::GetNoPtrChk();
if( pVideoDriver ) // This checks if the video object still exists, because if
{ // deleting drawing routine, it is not needed anymore
pVideoDriver->clearDrawingTasks();
}
}
......@@ -175,6 +182,8 @@ void CGUIDialog::fit()
void CGUIDialog::setRect(const CRect<float> &rect)
{
mRect = rect;
}
......
......@@ -29,6 +29,9 @@ public:
~CGUIDialog();
// Automatic Background draw function. It creates the background depending on what engine is currently running
void initBackground();
// Empty Background draw function. Just fills the Rect with a standard gray color
void initEmptyBackround();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment