Exemple #1
0
int Lobby::runScene(){
	RenderManager::getRenderManager()->setBackground("Lobby_bg.png");

	// number of players in lobby
	createPlayerCount();

	// creating buttons
	createButtons();
	createClassButts();
	createSlots();

	
	while (true){
		updateLobby();
		checkButtons();
		changePlayerSelectionImage();
		// try to start the game if everyone is ready
		if (numPlayers == numPlayersReady) {
			NetworkManager::sInstance->TryReadyGame();
		}
		// start the game
		if (NetworkManager::sInstance->GetState() >= NetworkManager::NMS_Starting){
			removeAllButtons();
			SceneManager::GetSceneManager()->AssembleScene();
			return SCENE_GAME;
		}
	}
}
void
DisconectedView::init()
{
    removeAllButtons();

    setBordered(true);
    setAllowResize(false);

    resize(screen->getWidth(),screen->getHeight());
    moveTo(0,0);

    int bsize = Surface::getTextLength(" ") * 8;
    addButtonCenterText(iXY((getClientRect().getSizeX()/2)-(bsize/2),
                (getClientRect().getSizeY()/2)+(Surface::getFontHeight() * 2)),
                bsize, "Ok", "", buttonOk);
}
// init
//---------------------------------------------------------------------------
void AreYouSureResignView::init()
{
    removeAllButtons();

    setBordered(false);
    setAllowResize(false);
    setDisplayStatusBar(false);

    resize(screen->getPix());
    moveTo(0,0);

    int x = (getClientRect().getSize().x - (141 * 2 + 20)) / 2;
    int y = getClientRect().getSize().y/2 + 30;
    addSpecialButton(	iXY(x, y),
                      "YES",
                      bYES);

    x += 141 + 10;
    addSpecialButton(	iXY(x, y),
                      "NO",
                      bNO);

} // end AreYouSureResignView::init
// init
//---------------------------------------------------------------------------
void AreYouSureExitView::init()
{
    removeAllButtons();

    setBordered(false);
    setAllowResize(false);
    setDisplayStatusBar(false);

    moveTo(0, 0);
    resize(SCREEN_PIX);

    int x = (getClientRect().getSize().x - (141 * 2 + 20)) / 2;
    int y = SCREEN_YCENTER + 30;
    addSpecialButton(	iXY(x, y),
                      "YES",
                      bYES);

    x += 141 + 10;
    addSpecialButton(	iXY(x, y),
                      "NO",
                      bNO);

} // end AreYouSureExitView::init
// initButtons
//---------------------------------------------------------------------------
void OptionsTemplateView::initButtons()
{
    removeAllButtons();
    removeComponents();

    MenuTemplateView::initButtons();

    int xTextStart       = bodyTextRect.min.x;
    int x                = xTextStart;
    int y                = bodyTextRect.min.y;
    int yOffset          =  17;
    int arrowButtonWidth =  16;
    int col              = 200;
    // Settings
    //----------------------------------------------------------------------
    int minWidth = 19 * 8;

    add( new Separator( bodyTextRect.min.x, y, bodyTextRect.max.x,  "VISUAL", componentActiveTextColor) );
    y += yOffset;
    x = xTextStart;
    checkBoxFullscreen = new CheckBox();
    checkBoxFullscreen->setLabel("Fullscreen");
    checkBoxFullscreen->setLocation(x+ col, y);
    checkBoxFullscreen->setStateChangedCallback(this);
    add(checkBoxFullscreen);
    y += yOffset;
    x = xTextStart;
    checkBoxDrawAllShadows = new CheckBox();
    checkBoxDrawAllShadows->setLabel("Draw All Shadows");
    checkBoxDrawAllShadows->setState(GameConfig::video_shadows);
    checkBoxDrawAllShadows->setLocation(x+ col, y);
    checkBoxDrawAllShadows->setStateChangedCallback(this);
    add(checkBoxDrawAllShadows);

    x = xTextStart;
    char res_str[20];
    choiceResolution = new Choice();
    choiceResolution->setName("Resolution");
    choiceResolution->addItem("current");
    SDL_Rect** modes = SDL_ListModes(0, SDL_FULLSCREEN);
    int cur_mode = 0;
    if ( modes && modes != (SDL_Rect**)-1 )
    {
        while ( modes[cur_mode] )
        {
            if ((modes[cur_mode]->w > 799) && (modes[cur_mode]->h > 599) ) 
            {
                snprintf(res_str,sizeof(res_str),"%dx%d", modes[cur_mode]->w, modes[cur_mode]->h);
                res_str[sizeof(res_str)-1] = 0;
                choiceResolution->addItem(res_str);
            }
            ++cur_mode;
        }
    }

    choiceResolution->setLocation(x, y-3);
    choiceResolution->select(0);
    choiceResolution->setMinWidth(minWidth);
    choiceResolution->setStateChangedCallback(this);
    add(choiceResolution);
    current_width = 0;
    current_height = 0;
    y += yOffset;

    x = xTextStart;
    checkBoxBlendSmoke = new CheckBox();
    checkBoxBlendSmoke->setLabel("Blend Smoke");
    checkBoxBlendSmoke->setState(GameConfig::video_blendsmoke);
    checkBoxBlendSmoke->setLocation(x+ col, y);
    checkBoxBlendSmoke->setStateChangedCallback(this);
    add(checkBoxBlendSmoke);
    y += yOffset;
 
#ifdef _WIN32
    x = xTextStart;
    checkBoxUseDirectX = new CheckBox();
    checkBoxUseDirectX->setLabel("Use DirectX");
    checkBoxUseDirectX->setState(GameConfig::video_usedirectx);
    checkBoxUseDirectX->setLocation(x+ col, y);
    checkBoxUseDirectX->setStateChangedCallback(this);
    add(checkBoxUseDirectX);
#endif

    x = xTextStart;
    choiceMiniMapUnitSize = new Choice();
    choiceMiniMapUnitSize->setName("Mini Map Unit Size");
    choiceMiniMapUnitSize->addItem("Small");
    choiceMiniMapUnitSize->addItem("Large");
    choiceMiniMapUnitSize->setLocation(x, y);
    choiceMiniMapUnitSize->select(gameconfig->radar_unitsize);
    choiceMiniMapUnitSize->setMinWidth(minWidth);
    choiceMiniMapUnitSize->setStateChangedCallback(this);
    add(choiceMiniMapUnitSize);
    y += yOffset*2;
   
// VISUAL OPTIONS
    add( new Separator( bodyTextRect.min.x, y, bodyTextRect.max.x,  "INTERFACE", componentActiveTextColor) );

    y += yOffset;
    x = xTextStart;
    add( new Label( x, y+3, "Scroll Rate:", windowTextColor) );
    x += optionsMeterStartX;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseScrollRate);
    x += optionsMeterWidth + arrowButtonWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseScrollRate);
    y += yOffset*3;

// SOUND OPTIONS

    add( new Separator( bodyTextRect.min.x, y, bodyTextRect.max.x,  "SOUND", componentActiveTextColor) );

    y += yOffset;
    x = xTextStart;
    add( new Label( x, y, "Sound Status:", windowTextColor) );
    checkBoxSoundEnabled = new CheckBox();
    checkBoxSoundEnabled->setLabel(gameconfig->enablesound?"Enabled":"Disabled");
    checkBoxSoundEnabled->setState(gameconfig->enablesound);
    x += optionsMeterStartX;
    checkBoxSoundEnabled->setLocation(x, y-2);
    checkBoxSoundEnabled->setStateChangedCallback(this);
    add(checkBoxSoundEnabled);
    y += yOffset;

    x = xTextStart;
    add( new Label( x, y+3, "Sound Volume:", windowTextColor) );
    x += optionsMeterStartX;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseSoundVolume);
    x += optionsMeterWidth + arrowButtonWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseSoundVolume);
    y += yOffset;

    y += yOffset; 
    x = xTextStart;
    add( new Label( x, y, "Music Status:", windowTextColor) );
    checkBoxMusicEnabled = new CheckBox();
    checkBoxMusicEnabled->setLabel(gameconfig->enablemusic?"Enabled":"Disabled");
    checkBoxMusicEnabled->setState(gameconfig->enablemusic);
    x += optionsMeterStartX;
    checkBoxMusicEnabled->setLocation(x, y-2);
    checkBoxMusicEnabled->setStateChangedCallback(this);
    add(checkBoxMusicEnabled);
    y += yOffset;

    x = xTextStart;
    add( new Label( x, y+3, "Music Volume:", windowTextColor) );
    x += optionsMeterStartX;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseMusicVolume);
    x += optionsMeterWidth + arrowButtonWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseMusicVolume);
    y += yOffset;
} // end OptionsTemplateView::initButtons
Exemple #6
0
LobbyMenu::~LobbyMenu(){
	removeAllButtons();
	removePlayerCount();
	SceneManager::GetSceneManager()->AssembleScene();
}
Exemple #7
0
void CNativeToolbar::createToolbar(rho_param *p)
{
    if (!rho_rhodesapp_check_mode() || !rho_wmsys_has_touchscreen() )
        return;

    int bar_type = TOOLBAR_TYPE;
    m_rgbBackColor = RGB(220,220,220);
    m_rgbMaskColor = RGB(255,255,255);
    m_nHeight = MIN_TOOLBAR_HEIGHT;

	rho_param *params = NULL;
    switch (p->type) 
    {
        case RHO_PARAM_ARRAY:
            params = p;
            break;
        case RHO_PARAM_HASH: 
            {
                for (int i = 0, lim = p->v.hash->size; i < lim; ++i) 
                {
                    const char *name = p->v.hash->name[i];
                    rho_param *value = p->v.hash->value[i];
                    
                    if (strcasecmp(name, "background_color") == 0) 
					    m_rgbBackColor = getColorFromString(value->v.string);
                    else if (strcasecmp(name, "mask_color") == 0) 
					    m_rgbMaskColor = getColorFromString(value->v.string);
                    else if (strcasecmp(name, "view_height") == 0) 
					    m_nHeight = atoi(value->v.string);
                    else if (strcasecmp(name, "buttons") == 0 || strcasecmp(name, "tabs") == 0) 
                        params = value;
                }
            }
            break;
        default: {
            LOG(ERROR) + "Unexpected parameter type for create_nativebar, should be Array or Hash";
            return;
        }
    }
    
    if (!params) {
        LOG(ERROR) + "Wrong parameters for create_nativebar";
        return;
    }

    int size = params->v.array->size;
    if ( size == 0 )
    {
        removeToolbar();
        return;
    }

    if ( m_hWnd )
    {
        removeAllButtons();
    }else
    {
        RECT rcToolbar;
        rcToolbar.left = 0;
        rcToolbar.right = 0;
        rcToolbar.top = 0;
        rcToolbar.bottom = m_nHeight;
        Create(getAppWindow().m_hWnd, rcToolbar, NULL, WS_CHILD|CCS_NOPARENTALIGN|CCS_NORESIZE|CCS_NOMOVEY|CCS_BOTTOM|CCS_NODIVIDER |
            TBSTYLE_FLAT |TBSTYLE_LIST|TBSTYLE_TRANSPARENT ); //TBSTYLE_AUTOSIZE

        SetButtonStructSize();
    }

    for (int i = 0; i < size; ++i) 
    {
        rho_param *hash = params->v.array->value[i];
        if (hash->type != RHO_PARAM_HASH) {
            LOG(ERROR) + "Unexpected type of array item for create_nativebar, should be Hash";
            return;
        }
        
        const char *label = NULL;
        const char *action = NULL;
        const char *icon = NULL;
        const char *colored_icon = NULL;
		int  nItemWidth = 0;

        for (int j = 0, lim = hash->v.hash->size; j < lim; ++j) 
        {
            const char *name = hash->v.hash->name[j];
            rho_param *value = hash->v.hash->value[j];
            if (value->type != RHO_PARAM_STRING) {
                LOG(ERROR) + "Unexpected '" + name + "' type, should be String";
                return;
            }
            
            if (strcasecmp(name, "label") == 0)
                label = value->v.string;
            else if (strcasecmp(name, "action") == 0)
                action = value->v.string;
            else if (strcasecmp(name, "icon") == 0)
                icon = value->v.string;
            else if (strcasecmp(name, "colored_icon") == 0)
                colored_icon = value->v.string;
            else if (strcasecmp(name, "width") == 0)
                nItemWidth = atoi(value->v.string);
        }
        
        if (label == NULL && bar_type == TOOLBAR_TYPE)
            label = "";
        
        if ( label == NULL || action == NULL) {
            LOG(ERROR) + "Illegal argument for create_nativebar";
            return;
        }
        if ( strcasecmp(action, "forward") == 0 && rho_conf_getBool("jqtouch_mode") )
            continue;

        m_arButtons.addElement( new CToolbarBtn(label, action, icon, nItemWidth) );
	}

    CSize sizeMax = getMaxImageSize();
    m_nHeight = max(m_nHeight, sizeMax.cy+MIN_TOOLBAR_IDENT);
    int nBtnSize = m_nHeight-MIN_TOOLBAR_IDENT;
    SetButtonSize(max(nBtnSize,sizeMax.cx), max(nBtnSize,sizeMax.cy));
    SetBitmapSize(sizeMax.cx, sizeMax.cy);
    m_listImages.Create(sizeMax.cx, sizeMax.cy, ILC_MASK|ILC_COLOR32, m_arButtons.size(), 0);
    SetImageList(m_listImages);

    for ( int i = 0; i < (int)m_arButtons.size(); i++ )
        addToolbarButton( *m_arButtons.elementAt(i), i );

    AutoSize();

    alignSeparatorWidth();

    ShowWindow(SW_SHOW);

#if defined (OS_WINDOWS)
    RECT rcWnd;
    getAppWindow().GetWindowRect(&rcWnd);
    getAppWindow().SetWindowPos( 0, 0,0,rcWnd.right-rcWnd.left-1,rcWnd.bottom-rcWnd.top, SWP_NOMOVE|SWP_NOZORDER|SWP_FRAMECHANGED);
    getAppWindow().SetWindowPos( 0, 0,0,rcWnd.right-rcWnd.left,rcWnd.bottom-rcWnd.top, SWP_NOMOVE|SWP_NOZORDER|SWP_FRAMECHANGED);
#else
    getAppWindow().SetWindowPos( 0, 0,0,0,0, SWP_NOMOVE|SWP_NOZORDER|SWP_NOSIZE|SWP_FRAMECHANGED);
#endif
}
Exemple #8
0
void CNativeToolbar::OnFinalMessage(HWND /*hWnd*/)
{
    removeAllButtons();
}