Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Protected Attributes | Private Attributes
DisplayResConfirm Class Reference

#include <display_res_confirm.hpp>

Inheritance diagram for DisplayResConfirm:
Inheritance graph
[legend]
Collaboration diagram for DisplayResConfirm:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DisplayResConfirm (const bool FROM_WINDOW_)
 ~DisplayResConfirm ()
void select ()
void countdown ()
void handle (GameAction ga, int value)
virtual void update (float dt)
virtual void inputKeyboard (SDLKey, int)
void inputPointer (int x, int y)
void lockInput ()
void unlockInput ()
void TimeToString (const double time, char *s)

Protected Attributes

bool m_locked
int m_menu_id

Private Attributes

char m_count [60]
int m_counter
const bool FROM_WINDOW
SDL_TimerID m_timer

Detailed Description

Definition at line 27 of file display_res_confirm.hpp.


Constructor & Destructor Documentation

DisplayResConfirm::DisplayResConfirm ( const bool  FROM_WINDOW_)

Definition at line 44 of file display_res_confirm.cpp.

                                                              :
    FROM_WINDOW (FROM_WINDOW_)
{
    m_counter = 5; // Number of seconds in which to confirm

    widget_manager->switchOrder();
    widget_manager->addTitleWgt( WTOK_TITLE, 70, 7,
        _("Confirm Resolution Within 5 Seconds"));

    widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2);

    widget_manager->addTextButtonWgt( WTOK_APPLY_RES, 40, 7, _("Confirm Resolution") );

    widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2);

    widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7, _("Press <ESC> to Cancel") );
    widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );

    widget_manager->layout( WGT_AREA_ALL );

    m_timer = SDL_AddTimer(1000,timeout,NULL);
    if (m_timer == NULL)
    {
        std::cerr << "Warning: Timer could not be initialised!\n";
    }
}

Here is the call graph for this function:

Definition at line 72 of file display_res_confirm.cpp.

Here is the call graph for this function:


Member Function Documentation

void DisplayResConfirm::countdown ( ) [virtual]

Reimplemented from BaseGUI.

Definition at line 104 of file display_res_confirm.cpp.

{
    if (m_counter > 1)
    {
        m_counter--;
        snprintf(m_count, MAX_MESSAGE_LENGTH, _("Confirm Resolution Within %d Seconds"), m_counter);
        widget_manager->setWgtText( WTOK_TITLE, m_count );
    }
    else
    {
        SDL_RemoveTimer(m_timer);

        // blacklist the resolution
        std::ostringstream o;
        o << user_config->m_width << "x" << user_config->m_height;
        user_config->m_blacklist_res.push_back (o.str());

        if( FROM_WINDOW )
        {
            inputDriver->toggleFullscreen();
            user_config->m_prev_windowed = false;
            user_config->m_crashed = false;
            user_config->saveConfig();
        }


        menu_manager->popMenu();
    }
}

Here is the call graph for this function:

void DisplayResConfirm::handle ( GameAction  ga,
int  value 
) [virtual]

Reimplemented from BaseGUI.

Definition at line 134 of file display_res_confirm.cpp.

{
    switch ( ga )
    {
    case GA_LEAVE:
        if (value)
            break;
              SDL_RemoveTimer(m_timer);
        if (FROM_WINDOW)
        {
            inputDriver->toggleFullscreen();
            user_config->m_crashed = false;
            user_config->saveConfig();
        }
        menu_manager->popMenu();
        break;

    default:
        BaseGUI::handle(ga, value);
        break;
    }
}

Here is the call graph for this function:

void BaseGUI::inputKeyboard ( SDLKey  ,
int   
) [virtual, inherited]

Reimplemented in PlayerControls.

Definition at line 139 of file base_gui.cpp.

{
       // This method is not supposed to be called since BaseGUI does not
       // handle low-level keyboard input.
       assert(false);
}

Here is the caller graph for this function:

void BaseGUI::inputPointer ( int  x,
int  y 
) [inherited]

Definition at line 102 of file base_gui.cpp.

{
    if( m_locked ) return;

    const int PREV_SELECTED_WGT = widget_manager->getSelectedWgt();
    const int SELECTED_WGT = widget_manager->handlePointer( x, y );

    if( SELECTED_WGT != WidgetManager::WGT_NONE )
    {
        if( PREV_SELECTED_WGT != WidgetManager::WGT_NONE )
        {
            widget_manager->darkenWgtColor( PREV_SELECTED_WGT );
        }

        widget_manager->lightenWgtColor( SELECTED_WGT );
        widget_manager->pulseWgt( SELECTED_WGT );
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BaseGUI::lockInput ( ) [inline, inherited]

Definition at line 49 of file base_gui.hpp.

{ m_locked = true; }
void DisplayResConfirm::select ( ) [virtual]

Implements BaseGUI.

Definition at line 78 of file display_res_confirm.cpp.

Here is the call graph for this function:

void BaseGUI::TimeToString ( const double  time,
char *  s 
) [inherited]

Definition at line 130 of file base_gui.cpp.

{
    int min     = (int) floor ( TIME / 60.0 ) ;
    int sec     = (int) floor ( TIME - (double) ( 60 * min ) ) ;
    int tenths  = (int) floor ( 10.0f * (TIME - (double)(sec + 60* min)));
    sprintf ( s, "%d:%02d:%d", min,  sec,  tenths ) ;
}   // TimeToString

Here is the caller graph for this function:

void BaseGUI::unlockInput ( ) [inline, inherited]

Definition at line 50 of file base_gui.hpp.

{ m_locked = false; }
void BaseGUI::update ( float  dt) [virtual, inherited]

Reimplemented in RaceGUI, CharSel, HelpPageOne, GrandPrixEnd, LeaderResult, GrandPrixSelect, ChallengesMenu, StartRaceFeedback, and TrackSel.

Definition at line 123 of file base_gui.cpp.

{
    widget_manager->update(dt);
}   // update

Here is the call graph for this function:


Member Data Documentation

const bool DisplayResConfirm::FROM_WINDOW [private]

Definition at line 40 of file display_res_confirm.hpp.

char DisplayResConfirm::m_count[60] [private]

Definition at line 38 of file display_res_confirm.hpp.

Definition at line 39 of file display_res_confirm.hpp.

bool BaseGUI::m_locked [protected, inherited]

Definition at line 55 of file base_gui.hpp.

int BaseGUI::m_menu_id [protected, inherited]

Definition at line 56 of file base_gui.hpp.

SDL_TimerID DisplayResConfirm::m_timer [private]

Definition at line 42 of file display_res_confirm.hpp.


The documentation for this class was generated from the following files: