コード例 #1
0
// UnitColorView
//---------------------------------------------------------------------------
UnitColorView::UnitColorView() : View()
{
    setSearchName("UnitColorView");
    setTitle("Selects Your Unit Color");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setVisible(false);

    Surface unitSurface;

    moveTo(400, 200);

    packedBody.load("units/pics/pak/TitaHNSD.pak");
    packedBody.setFPS(12);

    packedTurret.load("units/pics/pak/TitaTNSD.pak");
    packedTurret.setFPS(8);

    grassSurface.loadBMP("pics/grass.bmp");

    fuckingSurface.create(packedTurret.getWidth(), packedTurret.getHeight(), 1);
    fuckingSurface.fill(0);

    resizeClientArea(packedTurret.getWidth(), packedTurret.getHeight());

    int size = packedTurret.getWidth() / 2;
    addButtonCenterText(iXY(0, 0), size, "Up", "", bIncreaseBrightness);
    addButtonCenterText(iXY(size, 0), size, "Down", "", bDecreaseBrightness);

    setGrayColorTable();
    rebuildGrayColorTable();

} // end UnitColorView::UnitColorView
コード例 #2
0
void InterfaceView::initButtons()
{
    OptionsTemplateView::initButtons();

    int xTextStart       = bodyTextRect.min.x;
    int x                = xTextStart;
    int y                = bodyTextRect.min.y;
    int yOffset          =  15;

    int arrowButtonWidth =  16;

    // Settings
    //----------------------------------------------------------------------

    x = xTextStart;
    addLabel(iXY(x, y), "OPTION                                               SETTING", viewHeadingColor);
    y += yOffset;

    x = xTextStart;
    addLabel(iXY(x, y), "Scroll Rate", Color::white);
    x = optionsMeterStartX;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseScrollRate);
    x += optionsMeterWidth + arrowButtonWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseScrollRate);
    y += yOffset;
}
コード例 #3
0
// LibView
//---------------------------------------------------------------------------
LibView::LibView() : GameTemplateView()
{
    setSearchName("LibView");
    setTitle("Lib Stats");
    setSubTitle(" - F5");

    setAllowResize(false);
    setAllowMove(true);
    setDisplayStatusBar(false);
    setVisible(false);

    moveTo(0, 0);
    resize(325, 375);

    addButtonCenterText(iXY((getClientRect().getSize().x / 3) * 0, 0), getClientRect().getSize().x / 3, "Surface", "", bSurfaceInfo);
    addButtonCenterText(iXY((getClientRect().getSize().x / 3) * 1, 0), getClientRect().getSize().x / 3, "Particles", "", bParticleInfo);
    addButtonCenterText(iXY((getClientRect().getSize().x / 3) * 2, 0), getClientRect().getSize().x / 3, "Environment", "", bEnvironmentInfo);

    checkBoxAllowParticleGeneration.setLabel("Allow Particle Generation");
    checkBoxAllowParticleGeneration.setLocation(0, 15);
    checkBoxAllowParticleGeneration.setState(Particle2D::getCreateParticles());
    add(&checkBoxAllowParticleGeneration);

    checkBoxAllowTimeSlice.setLabel("Allow Time Slice");
    checkBoxAllowTimeSlice.setLocation(0, 30);
    checkBoxAllowTimeSlice.setState(gTimeSliceFlag);
    add(&checkBoxAllowTimeSlice);

    checkBoxAllowSpanBlitting.setLabel("Allow Blended Span Blitting");
    checkBoxAllowSpanBlitting.setLocation(0, 45);
    checkBoxAllowSpanBlitting.setState(allowSpanBlitting);
    add(&checkBoxAllowSpanBlitting);

    checkBoxParticlesCanHaveSmoke.setLabel("Allow Explosion Particle Smoke");
    checkBoxParticlesCanHaveSmoke.setLocation(0, 60);
    checkBoxParticlesCanHaveSmoke.setState(ParticleInterface::gParticlesCanHaveSmoke);
    add(&checkBoxParticlesCanHaveSmoke);

    checkBoxSolidColorExplosionParticles.setLabel("Solid Color Explosion Particles");
    checkBoxSolidColorExplosionParticles.setLocation(0, 75);
    checkBoxSolidColorExplosionParticles.setState(ParticleInterface::gSolidColorExplosionParticles);
    add(&checkBoxSolidColorExplosionParticles);

    checkBoxParticleInterfaceSim.setLabel("Particle Interface Sim");
    checkBoxParticleInterfaceSim.setLocation(0, 90);
    checkBoxParticleInterfaceSim.setState(ParticleInterface::gTestSim);
    add(&checkBoxParticleInterfaceSim);

    checkBoxSolidBackground.setLabel("Solid Background");
    checkBoxSolidBackground.setLocation(0, 105);
    checkBoxSolidBackground.setState(GameView::gDrawSolidBackground);
    add(&checkBoxSolidBackground);

    checkBoxDrawExplosionParticleCount.setLabel("Draw Explosion Particle Count");
    checkBoxDrawExplosionParticleCount.setLocation(0, 120);
    checkBoxDrawExplosionParticleCount.setState(ParticleInterface::gDrawExplosionParticleCount);
    add(&checkBoxDrawExplosionParticleCount);

} // end LibView::LibView
コード例 #4
0
IRCLobbyView::IRCLobbyView() 
    : View()
{
    lobby_connection=0;
    change_name=0;
    skipChatLines=0;
    lobby_view_height=184;
    total_displayed_servers=0;
    setSearchName("IRCLobbyView");
    setTitle("Lobby");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setVisible(false);
    topViewableItem=0;

    moveTo(iXY(bodyTextRect.max.x-440, bodyTextRect.min.y + 170));

    iXY  area_size = iXY(440, lobby_view_height);
    resizeClientArea(area_size);

    int chat_y=lobby_view_height-(Surface::getFontHeight()*2);
    addButtonCenterText(iXY(getClientRect().getSizeX()-80, chat_y), 80,  "Refresh", "", buttonRefresh);
    szChat.init("  ", 255,39);
    cInputField* input = addInputField(iXY(4, chat_y), &szChat, "", true);
    input->setReturnAction(chatReturnPressed);

    server_list_end_y=(Surface::getFontHeight()*6);
    chat_list_end_y=getClientRect().getSizeY()-(Surface::getFontHeight()*2);
    server_list_end_x=(getClientRect().getSizeX()-12);

    iXY size(12, 12);
    iXY pos(getClientRect().getSizeX() - size.x, 0);
    serverUpButton.setLabel("-");
    serverUpButton.setBounds(iRect(pos, pos + size));
    add(&serverUpButton);

    pos.y= server_list_end_y-size.y;
    serverDownButton.setLabel("+");
    serverDownButton.setBounds(iRect(pos, pos + size));
    add(&serverDownButton);

    pos.y+=size.y;
    chatUpButton.setLabel("-");
    chatUpButton.setBounds(iRect(pos, pos + size));
    add(&chatUpButton);

    pos.y = chat_list_end_y-size.y;
    chatDownButton.setLabel("+");
    chatDownButton.setBounds(iRect(pos, pos + size));
    add(&chatDownButton);

    // XXX ugly ugly ugly
    if(!lobby_view)
        lobby_view = this;
} 
コード例 #5
0
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);
}
コード例 #6
0
CodeStatsView::CodeStatsView() : GameTemplateView()
{
    setSearchName("CodeStatsView");
    setTitle("CodeStatsView");
    setSubTitle(" - F4");

    setAllowResize(false);
    setAllowMove(true);
    setDisplayStatusBar(true);
    setVisible(false);

    moveTo(iXY(0, 0));

    iXY  area_size = iXY(280, 280) ;
    long bXOffset;
    INFO_AREA_Y_OFFSET = 2;

    resizeClientArea(area_size);

    bXOffset = area_size.x / 3;
    addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), bXOffset,  "Net", "", buttonNetwork);
    addButtonCenterText(iXY(bXOffset, INFO_AREA_Y_OFFSET), bXOffset, "Sprite", "", buttonSorter);
    addButtonCenterText(iXY(bXOffset*2, INFO_AREA_Y_OFFSET), bXOffset, "Unit", "", buttonUnit);

    INFO_AREA_Y_OFFSET += 18;
    addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), area_size.x, "Path", "", buttonPathing);

    INFO_AREA_Y_OFFSET += 18;
    bXOffset = area_size.x / 3;
    addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), bXOffset,  "Debug", "", buttonDebug);
    addButtonCenterText(iXY(bXOffset, INFO_AREA_Y_OFFSET), bXOffset, "Sample", "", buttonSample);
    addButtonCenterText(iXY(bXOffset*2, INFO_AREA_Y_OFFSET), bXOffset, "NetLog", "", bNetLog );

    INFO_AREA_Y_OFFSET += 18;
    /*
       addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), 20, "+", "", bPlusPacketSize );
    addButtonCenterText(iXY(25, INFO_AREA_Y_OFFSET), 20, "-", "", bMinusPacketSize );
    addButtonCenterText(iXY(50, INFO_AREA_Y_OFFSET), 20, "0", "", bMinusPacketSize );
    addButtonCenterText(iXY(65, INFO_AREA_Y_OFFSET), 20, "1", "", bMinusPacketSize );

    addButtonCenterText(iXY(45, INFO_AREA_Y_OFFSET), 40, "Send", "", bSend );

       INFO_AREA_Y_OFFSET += 18;
       INFO_AREA_Y_OFFSET += 18;
       */

    display_mode = _display_mode_network_stats;

} // end CodeStatsView::CodeStatsView
コード例 #7
0
void
LoadingView::init()
{
    setSearchName("LoadingView");
    setTitle("Loading Progress");
    setSubTitle("");
    
    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setBordered(false);

    resize(640, 480);
    
    addButtonCenterText(iXY(628 - 60, 302 - 15), 60, "Abort", "Cancel the joining of this game.", bAbort);
    
}
コード例 #8
0
// init
//---------------------------------------------------------------------------
void LobbyView::init()
{
    setSearchName("LobbyView");
    setTitle("Join Lobby");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setBordered(false);

    background.create(628 - 179, 302 - 153, 1);
    background.fill(0);

    moveTo(0, 0);
    resize(640, 480);

    addButtonCenterText(iXY(628 - 60, 302 - 15), 60, "Abort", "Cancel the joining of this game.", bAbort);

    currentline = 0;
} // end LobbyView::init
コード例 #9
0
void
LoadingView::init()
{
    setSearchName("LoadingView");
    setTitle("Loading Progress");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setBordered(false);
    need_password = false;
    password_str.init("", 31,31);

    resize(800, 600);

    addButtonCenterText(iXY(340, 15), 100, "Abort", "Cancel the joining of this game.", bAbort);


    okButton = Button::createTextButton("OK", "Enter", iXY(340,100), 100);
    passwordLabel = new Label(340, 68, "Game Password", Color::white);

}
コード例 #10
0
// addVehicleButtons
//---------------------------------------------------------------------------
void HostJoinTemplateView::addVehicleButtons(const iXY &pos)
{
    // Add the vehicle buttons.
    // Get the dimensions of the buttons to draw.
    Surface tempSurface;
    if (!tempSurface.loadTIL("pics/vehicleSelectionMenu/light.til")) {
        throw Exception("ERROR: Unable to open pics/vehicleSelectionMenu/light.til to find the size to make the buttons.");
    }

    iXY buttonSize(tempSurface.getPix());
    int arrowButtonWidth =  16;

    int x;
    int y;

    x = pos.x;

    y = pos.y;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/humvee.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/light.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/medium.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/heavy.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/missle.til", "", 0);
    x += buttonSize.x + 1;

    // Draw the arrows to change the numbers.
    x = pos.x;
    y = pos.y + buttonSize.y;

    x = pos.x + (buttonSize.x + 1) * 0;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseHumvee);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseHumvee);

    x = pos.x + (buttonSize.x + 1) * 1;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseLightTank);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseLightTank);

    x = pos.x + (buttonSize.x + 1) * 2;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseMediumTank);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseMediumTank);

    x = pos.x + (buttonSize.x + 1) * 3;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseHeavyTank);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseHeavyTank);

    x = pos.x + (buttonSize.x + 1) * 4;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseMissleLauncher);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseMissleLauncher);


} // end HostJoinTemplateView::addVehicleButtons
コード例 #11
0
// GameToolbarView
//--------------------------------------------------------------------------
GameToolbarView::GameToolbarView() : GameTemplateView()
{
	setSearchName("GameToolbarView");
	setTitle("Toolbar - TAB");
	setSubTitle("");

	setAllowResize(false);
	setAllowMove(false);
	setDisplayStatusBar(false);
	setVisible(false);

	moveTo(iXY(0, 0));
	resizeClientArea(117, 100);

	iXY       pos(0, 0);
	const int yOffset     = 15;
	int       buttonSizeX = getClientRect().getSizeX();

	addButtonCenterText(pos, buttonSizeX - (15 + 1) * 2 - 1, "Mini Map", "Toggle the visibility of the mini map", bToggleMiniMap);
	pos.x = buttonSizeX - (15 + 1) * 2;
	addButton(pos, "-", "", bDecreaseMiniMapSize);
	pos.x += 15 + 1;
	addButton(pos, "+", "", bIncreaseMiniMapSize);
	pos.x += 15 + 1;

	pos.x = 0;
	pos.y += yOffset;
	buttonSizeX = getClientRect().getSizeX() / 2;
	addButtonCenterText(pos, buttonSizeX, "Info", "Toggle the visibility of the mini map", bToggleInfo);
	pos.x += buttonSizeX + 1;
	addButtonCenterText(pos, buttonSizeX, "Rank", "Toggle the visibility of the rank view", bToggleRankView);
	pos.y += yOffset;
	pos.x = 0;
	buttonSizeX = getClientRect().getSizeX();
	addButtonCenterText(pos, buttonSizeX, "MSG All", "", bSendMessageAll);
	pos.y += yOffset;
	addButtonCenterText(pos, buttonSizeX, "MSG Allies", "", bSendMessageAllies);
	pos.y += yOffset;
	addButtonCenterText(pos, buttonSizeX, "MSG Enemies", "", bSendMessageEnemies);
	pos.y += yOffset;

	pos.x = 0;
	addLabel(iXY(pos.x + 2, pos.y + 3), "Group", Color::white);
	pos.x += 48 + 1 + 4;

	addButton(pos, "1", "", bSetGroup1);
	pos.x += 15 + 1;
	addButton(pos, "2", "", bSetGroup2);
	pos.x += 15 + 1;
	addButton(pos, "3", "", bSetGroup3);
	pos.x += 15 + 1;
	addButton(pos, "4", "", bSetGroup4);
	pos.x += 15 + 1;

	pos.x = 0;
	pos.y += yOffset;
	addLabel(iXY(pos.x + 2, pos.y + 3), "Recall", Color::white);
	pos.x += 48 + 1 + 4;

	addButton(pos, "1", "", bRecallGroup1);
	pos.x += 15 + 1;
	addButton(pos, "2", "", bRecallGroup2);
	pos.x += 15 + 1;
	addButton(pos, "3", "", bRecallGroup3);
	pos.x += 15 + 1;
	addButton(pos, "4", "", bRecallGroup4);
	pos.x += 15 + 1;
	pos.y += yOffset;

	buttonSizeX = getClientRect().getSizeX() / 2;

	pos.x = 0;
	addButtonCenterText(pos, buttonSizeX, "Damage", "", bToggleDrawUnitDamage);
	pos.x += buttonSizeX + 1;
	addButtonCenterText(pos, buttonSizeX, "Flags", "", bToggleDrawUnitFlags);
	//pos.x += buttonSizeX + 1;
	//addButtonCenterText(pos, buttonSizeX, "RL", "", bToggleDrawUnitReload);

	pos.y += yOffset;

	resizeClientArea(iXY(117, pos.y));
	
	// Start it in the bottom-left corner.
	moveTo(iXY(10000, 10000));

} // end GameToolbarView::GameToolbarView
コード例 #12
0
// 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
コード例 #13
0
// addMeterButtons
//---------------------------------------------------------------------------
void HostOptionsView::addMeterButtons(const iXY &pos)
{
    const int yOffset          = 15;
    const int arrowButtonWidth = 16;

    int x;
    int y = pos.y;

    int xTextStart    = pos.x;
    int xControlStart = 270;

    x = xTextStart;
    add( new Label(x, y, "Max Players", windowTextColor, windowTextColorShadow, true) );
    x += xControlStart;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreasePlayerCount);
    x += arrowButtonWidth + meterWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreasePlayerCount);
    y += yOffset;

    x = xTextStart;
    add( new Label(x, y, "Game Max Unit Count", windowTextColor, windowTextColorShadow, true) );
    x += xControlStart;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseMaxUnitCount);
    x += arrowButtonWidth + meterWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseMaxUnitCount);
    y += yOffset;
    /*
    	x = xTextStart;
    	//addLabelShadowed(iXY(x, y), "Player Respawn Unit Count", windowTextColor, windowTextColorShadow);
    	x += xControlStart;
    	addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseRespawnCount);
    	x += arrowButtonWidth + meterWidth;
    	addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseRespawnCount);
    	y += yOffset;
    */
    //x = xTextStart;
    //addLabelShadowed(iXY(x, y), "Allow Allies", windowTextColor, windowTextColorShadow);
    //x += xControlStart;
    //addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bSetAllowAlliesFalse);
    //x += arrowButtonWidth + meterWidth;
    //addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bSetAllowAlliesTrue);
    //y += yOffset;
    //
    //x = xTextStart;
    //addLabelShadowed(iXY(x, y), "Spawn Placement", windowTextColor, windowTextColorShadow);
    //x += xControlStart;
    //addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bPreviousSpawnPlacement);
    //x += arrowButtonWidth + meterWidth;
    //addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bNextSpawnPlacement);
    //y += yOffset;

    x = xTextStart;
    add( new Label( x, y, "Objective Capture Percent", windowTextColor, windowTextColorShadow, true) );
    x += xControlStart;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseObjectiveCapturePercent);
    x += arrowButtonWidth + meterWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseObjectiveCapturePercent);
    y += yOffset;

    x = xTextStart;
    add( new Label( x, y, "Time Limit", windowTextColor, windowTextColorShadow, true) );
    x += xControlStart;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseTimeLimit);
    x += arrowButtonWidth + meterWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseTimeLimit);
    y += yOffset;

    x = xTextStart;
    add( new Label( x, y, "Frag Limit", windowTextColor, windowTextColorShadow, true) );
    x += xControlStart;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseFragLimit);
    x += arrowButtonWidth + meterWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseFragLimit);
    y += yOffset;

    const int minWidth = 150;
    int xChoiceOffset = 2;

    choiceGameType.setName("Game Type");
    choiceGameType.addItem("Objective");
    choiceGameType.addItem("Frag Limit");
    choiceGameType.addItem("Time Limit");
    choiceGameType.setMinWidth(minWidth);
    choiceGameType.setLocation(xChoiceOffset, 100);
    choiceGameType.select( getGameTypeString() );
    add(&choiceGameType);
    xChoiceOffset += minWidth + 123;

    choiceCloudCoverage.setName("Cloud Coverage");
    choiceCloudCoverage.addItem("Clear");
    choiceCloudCoverage.addItem("Broken");
    choiceCloudCoverage.addItem("Partly Cloudy");
    choiceCloudCoverage.addItem("Overcast");
    choiceCloudCoverage.addItem("Extremely Cloudy");
    choiceCloudCoverage.setMinWidth(minWidth);
    choiceCloudCoverage.setLocation(xChoiceOffset, 100);
    choiceCloudCoverage.select(cloudCoverageCount);
    add(&choiceCloudCoverage);
    xChoiceOffset += minWidth + 13;

    choiceWindSpeed.setName("Wind Speed");
    choiceWindSpeed.addItem("Calm");
    choiceWindSpeed.addItem("Breezy");
    choiceWindSpeed.addItem("Brisk");
    choiceWindSpeed.addItem("Heavy");
    choiceWindSpeed.addItem("Typhoon");
    choiceWindSpeed.setMinWidth(minWidth);
    choiceWindSpeed.setLocation(xChoiceOffset, 100);
    choiceWindSpeed.select(windSpeed);
    add(&choiceWindSpeed);
    xChoiceOffset += minWidth + 10;

    checkPublic.setLabel("Public");
    checkPublic.setState(GameConfig::server_public);
    checkPublic.setLocation(2, 125);
    add(&checkPublic);

    checkPowerUp.setLabel("PowerUps");
    checkPowerUp.setState(GameConfig::game_powerups);
    checkPowerUp.setLocation(120, 125);
    add(&checkPowerUp);


    /*
    	x = xTextStart;
    	//addLabelShadowed(iXY(x, y), "Allow Fog Of War", windowTextColor, windowTextColorShadow);
    	x += xControlStart;
    	addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bSetAllowFogOfWarFalse);
    	x += arrowButtonWidth + meterWidth;
    	addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bSetAllowFogOfWarTrue);
    */
} // end HostOptionsView::addMeterButtons
コード例 #14
0
void SoundView::initButtons()
{
    OptionsTemplateView::initButtons();

    int xTextStart       = bodyTextRect.min.x;
    int x                = xTextStart;
    int y                = bodyTextRect.min.y;
    int yOffset          =  15;
    int arrowButtonWidth =  16;

    // Settings
    //----------------------------------------------------------------------

    x = xTextStart;
    add( new Label( x, y, "OPTION                                               SETTING", viewHeadingColor) );
    y += yOffset;
    //
    
    x = xTextStart;
    add( new Label( x, y, "Sound Status", Color::white) );
    checkBoxSoundEnabled = new CheckBox();
    checkBoxSoundEnabled->setLabel(gameconfig->enablesound?"Enabled":"Disabled");
    checkBoxSoundEnabled->setState(gameconfig->enablesound);
    x += Surface::getTextLength("Sound Status: ");
    checkBoxSoundEnabled->setLocation(x, y-2);
    checkBoxSoundEnabled->stateChanged.connect(this, &SoundView::onSoundCheckBoxModified);
    add(checkBoxSoundEnabled);
    y += yOffset;

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

    y += yOffset; // add a little separation
    x = xTextStart;
    add( new Label( x, y, "Music Status", Color::white) );
    checkBoxMusicEnabled = new CheckBox();
    checkBoxMusicEnabled->setLabel(gameconfig->enablemusic?"Enabled":"Disabled");
    checkBoxMusicEnabled->setState(gameconfig->enablemusic);
    x += Surface::getTextLength("Music Status: ");
    checkBoxMusicEnabled->setLocation(x, y-2);
    checkBoxMusicEnabled->stateChanged.connect(this, &SoundView::onMusicCheckBoxModified);
    add(checkBoxMusicEnabled);
    y += yOffset;

    x = xTextStart;
    add( new Label( x, y, "Music Volume", Color::white) );
    x = optionsMeterStartX;
    addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", bDecreaseMusicVolume);
    x += optionsMeterWidth + arrowButtonWidth;
    addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", bIncreaseMusicVolume);
    y += yOffset;

    //
    //x = xTextStart;
    //addLabel(iXY(x, y), "Unit Acknowledgement", Color::white);
    //x = optionsMeterStartX;
    //addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", 0);
    //x += optionsMeterWidth + arrowButtonWidth;
    //addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", 0);
    //y += yOffset;
    //
    //x = xTextStart;
    //addLabel(iXY(x, y), "Ambient Sounds", Color::white);
    //x = optionsMeterStartX;
    //addButtonCenterText(iXY(x - 1, y), arrowButtonWidth, "<", "", 0);
    //x += optionsMeterWidth + arrowButtonWidth;
    //addButtonCenterText(iXY(x + 1, y), arrowButtonWidth, ">", "", 0);
    //y += yOffset;
}