Commit 321ca024 authored by Gerhard Stein's avatar Gerhard Stein

Small graphical and control polishes

parent 4f1fad3c
......@@ -125,21 +125,10 @@ void CMenuController::process()
// If you click, then open the menu
if(!g_pInput->m_EventList.empty())
if( g_pInput->mouseClicked() && mMenuStack.empty() )
{
if( MouseMoveEvent *mouseevent = g_pInput->m_EventList.occurredEvent<MouseMoveEvent>() )
{
// Here we check if the mouse-cursor/Touch entry clicked on our Button
if(mouseevent->Type == MOUSEEVENT_BUTTONUP && mMenuStack.empty())
{
openMainMenu();
}
g_pInput->m_EventList.pop_Event();
}
openMainMenu();
}
}
void CMenuController::popBackMenu()
......
......@@ -22,6 +22,7 @@
#include "mode/CGamePassiveMode.h"
#include "sdl/CVideoDriver.h"
#include "sdl/input/CInput.h"
#include "arguments.h"
......@@ -118,8 +119,18 @@ void CGameControl::process()
}
}
// Process the game control object
// Process the game control object if no effects are being processed
mpEngine->process();
gpMenuController->process();
if(!g_pGfxEngine->runningEffect())
{
gpMenuController->process();
}
else // but if some Command is triggered, cancel the effect
{
if( g_pInput->getPressedAnyCommand() || g_pInput->mouseClicked() )
{
g_pGfxEngine->killEffect();
}
}
}
......@@ -15,13 +15,18 @@
#include <list>
class CEventContainer {
class CEventContainer
{
public:
size_t size() { return m_EventList.size(); }
bool empty() { return m_EventList.empty(); }
void clear() { m_EventList.clear(); }
void add(const SmartPointer<CEvent>& ev) { m_EventList.push_back(ev); }
std::list< SmartPointer<CEvent> >::iterator erase(std::list< SmartPointer<CEvent> >::iterator &it)
{ return m_EventList.erase(it); }
std::list< SmartPointer<CEvent> >::iterator begin() { return m_EventList.begin(); }
std::list< SmartPointer<CEvent> >::iterator end() { return m_EventList.end(); }
template<typename T> T* occurredEvent();
void pop_Event() { m_EventList.pop_front(); }
......
......@@ -90,10 +90,12 @@ void CPlayGameGalaxy::process()
{
processInput();
const bool msgboxactive = !mMessageBoxes.empty();
// Trigger the Status screen here
if(m_Inventory.showStatus())
{
if(g_pInput->getPressedAnyCommand())
if( g_pInput->getPressedAnyButtonCommand(0) )
{
g_pSound->playSound(SOUND_STATUS_SLIDE_OUT);
m_Inventory.toggleStatusScreen();
......@@ -101,7 +103,7 @@ void CPlayGameGalaxy::process()
}
else
{
if(g_pInput->getPressedCommand(IC_STATUS))
if(!msgboxactive && g_pInput->getPressedCommand(IC_STATUS))
{
g_pSound->playSound(SOUND_STATUS_SLIDE_IN);
m_Inventory.toggleStatusScreen();
......@@ -109,12 +111,11 @@ void CPlayGameGalaxy::process()
}
if(g_pInput->getPressedCommand(IC_STATUS))
/*if( !msgboxactive && g_pInput->getPressedCommand(IC_STATUS) )
{
m_Inventory.toggleStatusScreen();
}
const bool msgboxactive = !mMessageBoxes.empty();
}*/
// process Page if one is open. Could be one of the finale scenes
//if(m_Page.isActive())
......@@ -145,9 +146,8 @@ void CPlayGameGalaxy::process()
pMB->process();
if(pMB->isFinished())
{
mMessageBoxes.pop_front();
}
mMessageBoxes.pop_front();
return;
}
......
......@@ -125,9 +125,10 @@ void CMessageBoxGalaxy::initText(const SDL_Rect &rect)
void CMessageBoxGalaxy::process()
{
// Look, if somebody pressed a button, and close this dialog!
if(g_pInput->getPressedAnyCommand())
if( g_pInput->getPressedAnyButtonCommand(0) )
{
mMustClose = true;
g_pInput->flushCommands();
return;
}
......
This diff is collapsed.
......@@ -115,7 +115,6 @@ void CGfxEngine::freeBitmaps(std::vector<CBitmap> &Bitmap)
{
while ( !Bitmap.empty() )
{
CBitmap &bitmap = Bitmap.back();
Bitmap.pop_back();
}
}
......@@ -124,7 +123,6 @@ void CGfxEngine::freeSprites()
{
while( !Sprite.empty() )
{
CSprite &sprite = Sprite.back();
Sprite.pop_back();
}
}
......
......@@ -136,19 +136,20 @@ void CGUIButton::processLogic()
void CGUIButton::drawVorticonStyle(SDL_Rect& lRect)
{
if(!mEnabled)
return;
SDL_Surface *blitsfc = g_pVideoDriver->getBlitSurface();
// Now lets draw the text of the button
CFont &Font = g_pGfxEngine->getFont(mFontID);
Font.drawFont( blitsfc, mText, lRect.x+24, lRect.y, false );
drawTwirl(lRect);
if(mEnabled)
{
CFont &Font = g_pGfxEngine->getFont(mFontID);
Font.drawFont( blitsfc, mText, lRect.x+24, lRect.y, false );
drawTwirl(lRect);
}
else
{
CFont &Font = g_pGfxEngine->getFont(0);
Font.drawFont( blitsfc, mText, lRect.x+24, lRect.y, true );
}
}
......
......@@ -385,6 +385,8 @@ bool CInput::readNewEvent(Uint8 device, int command)
#endif
memset(&lokalInput, 0, sizeof(stInputCommand));
if(!m_EventList.empty())
m_EventList.clear();
while( SDL_PollEvent( &Event ) )
{
......@@ -1088,6 +1090,29 @@ bool CInput::getPulsedCommand(int player, int command, int msec)
return false;
}
bool CInput::mouseClicked()
{
// If you click, then open the menu
std::list< SmartPointer<CEvent> >::iterator it = m_EventList.begin();
for( ; it != m_EventList.end() ; it++ )
{
if( MouseMoveEvent *mouseevent = dynamic_cast<MouseMoveEvent*> (it->get()) )
{
// Here we check if the mouse-cursor/Touch entry clicked on our Button
if(mouseevent->Type == MOUSEEVENT_BUTTONUP)
{
m_EventList.erase(it);
return true;
}
}
}
return false;
}
bool CInput::getPressedAnyCommand()
{
bool retval = false;
......
......@@ -163,6 +163,7 @@ public:
bool getPressedAnyKey(void);
void sendKey(int key);
bool mouseClicked();
bool getPressedAnyCommand();
bool getPulsedCommand(int command, int msec);
bool getPulsedCommand(int player, int command, int msec);
......
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