// actionPerformed
//---------------------------------------------------------------------------
void HostOptionsView::actionPerformed(mMouseEvent me)
{
    if (me.getSource()==&checkPublic) {
        if ( getVisible() ) {
            GameConfig::server_public = checkPublic.getState();
        }
    } else if (me.getSource()==&checkPowerUp) {
        if ( getVisible() ) {
            GameConfig::game_powerups = checkPowerUp.getState();
        }
    } else if (me.getSource()==&choiceWindSpeed) {
        windSpeed = choiceWindSpeed.getSelectedIndex();

        updateWindSpeedString();
    } else if (me.getSource()==&choiceCloudCoverage) {
        cloudCoverageCount = choiceCloudCoverage.getSelectedIndex();

        updateGameConfigCloudCoverage();
    } else if (me.getSource()==&choiceGameType) {
        if ( getVisible() ) {
            gameType = choiceGameType.getSelectedIndex();

            updateGameConfigGameType();
        }
    }
} // end HostOptionsView::actionPerformed
void IRCLobbyView::actionPerformed(mMouseEvent me)
{
    static const int chat_scroll_lines=8;
    static const int server_scroll_lines=3;
    if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED) {
        if (me.getSource(serverUpButton)) {
            topViewableItem-=server_scroll_lines;
            if (topViewableItem < 0) {
                topViewableItem = 0;
            }
        } else if (me.getSource(serverDownButton)) {
            int max_size=lobby_connection->game_servers->size()-1;
            topViewableItem+=server_scroll_lines;
            if (topViewableItem >= max_size) {
                topViewableItem = max_size;
            }
        } else if (me.getSource(chatUpButton)) {
            skipChatLines+=chat_scroll_lines;
            if(skipChatLines>=((int)lobby_connection->chat_messages.size())) {
                skipChatLines=((int)lobby_connection->chat_messages.size())-1;
            }
        } else if (me.getSource(chatDownButton)) {
            skipChatLines-=chat_scroll_lines;
            if (skipChatLines <= 0) {
                skipChatLines = 0;
            }
        }
    }
}
// actionPerformed
//---------------------------------------------------------------------------
void CheckBox::actionPerformed(const mMouseEvent &me)
{
	if (	me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED &&
			(me.getModifiers() & InputEvent::BUTTON1_MASK))
	{
		state = !state;
	}

} // end CheckBox::actionPerformed
Esempio n. 4
0
// actionPerformed
//---------------------------------------------------------------------------
void Button::actionPerformed(const mMouseEvent &me)
{
    if (me.getID() == mMouseEvent::MOUSE_EVENT_ENTERED
                || me.getID() == mMouseEvent::MOUSE_EVENT_RELEASED) {
        bstate = BOVER;
        textColor = Color::yellow;
    } else if (me.getID() == mMouseEvent::MOUSE_EVENT_EXITED) {
        bstate = BNORMAL;
        textColor = Color::white;
    } else if (me.getID() == mMouseEvent::MOUSE_EVENT_PRESSED) {
        bstate = BPRESSED;
        textColor = Color::red;
        clicked();
    }
} // end Button::actionPerformed
// actionPerformed
//--------------------------------------------------------------------------
void HelpScrollView::actionPerformed(mMouseEvent me)
{
    if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED) {
        if (me.getSource(upButton)) {
            if (--topViewableItem < 0) {
                topViewableItem = 0;
            }
        } else if (me.getSource(downButton)) {
            if (++topViewableItem >= text.getCount() - maxViewableItems) {
                topViewableItem = text.getCount() - maxViewableItems;
            }
        }
    }

} // end HelpScrollView::actionPerformed
// actionPerformed
//---------------------------------------------------------------------------
void GetSessionHostView::actionPerformed(mMouseEvent me)
{
	if (me.getID() == mMouseEvent::MOUSE_EVENT_EXITED)
	{
		highlightedItem = -1;
	}

} // end GetSessionHostView::actionPerformed
Esempio n. 7
0
// actionPerformed
//---------------------------------------------------------------------------
void Button::actionPerformed(const mMouseEvent &me)
{
    if (me.getID() == mMouseEvent::MOUSE_EVENT_ENTERED
                || me.getID() == mMouseEvent::MOUSE_EVENT_RELEASED) {
        bstate = BOVER;
        textColor = Color::red;
        dirty = true; // draw text in red
    } else if (me.getID() == mMouseEvent::MOUSE_EVENT_EXITED) {
        bstate = BNORMAL;
        textColor = Color::white;
        dirty = true; // draw defaults;
    } else if (me.getID() == mMouseEvent::MOUSE_EVENT_PRESSED) {
        bstate = BPRESSED;
        textColor = Color::yellow;
        dirty = true;
    }
} // end Button::actionPerformed
Esempio n. 8
0
// actionPerformed
//---------------------------------------------------------------------------
void Button::actionPerformed(const mMouseEvent &me)
{
	if (me.getID() == mMouseEvent::MOUSE_EVENT_ENTERED)
	{
		highlighted = true;
	}

	if (me.getID() == mMouseEvent::MOUSE_EVENT_EXITED)
	{
		highlighted = false;
	}

	if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED)
	{
		clicked = true;
	} else
	{
		clicked = false;
	}

} // end Button::actionPerformed
Esempio n. 9
0
// actionPerformed
//---------------------------------------------------------------------------
void
Button::actionPerformed(const mMouseEvent &me)
{
    if (me.getID() == mMouseEvent::MOUSE_EVENT_ENTERED
                || me.getID() == mMouseEvent::MOUSE_EVENT_RELEASED)
    {
        bstate = BOVER;
        dirty = true; // draw text in red
    }
    else if (me.getID() == mMouseEvent::MOUSE_EVENT_EXITED)
    {
        bstate = BNORMAL;
        dirty = true; // draw defaults;
    }
    else if (me.getID() == mMouseEvent::MOUSE_EVENT_PRESSED)
    {
        bstate = BPRESSED;
        dirty = true;
    }
    else if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED)
    {
        ((View *)parent)->onComponentClicked(this);
    }
} // end Button::actionPerformed
Esempio n. 10
0
// actionPerformed
//---------------------------------------------------------------------------
void LibView::actionPerformed(mMouseEvent me)
{
    if (me.getSource(checkBoxAllowParticleGeneration)) {
        Particle2D::setCreateParticles(checkBoxAllowParticleGeneration.getState());
    } else if (me.getSource(checkBoxAllowTimeSlice)) {
        gTimeSliceFlag = checkBoxAllowTimeSlice.getState();
    } else if (me.getSource(checkBoxAllowSpanBlitting)) {
        allowSpanBlitting = checkBoxAllowSpanBlitting.getState();
    } else if (me.getSource(checkBoxParticlesCanHaveSmoke)) {
        ParticleInterface::gParticlesCanHaveSmoke = checkBoxParticlesCanHaveSmoke.getState();
    } else if (me.getSource(checkBoxSolidColorExplosionParticles)) {
        ParticleInterface::gSolidColorExplosionParticles = checkBoxSolidColorExplosionParticles.getState();
    } else if (me.getSource(checkBoxParticleInterfaceSim)) {
        ParticleInterface::gTestSim = checkBoxParticleInterfaceSim.getState();
    } else if (me.getSource(checkBoxSolidBackground)) {
        GameView::gDrawSolidBackground = checkBoxSolidBackground.getState();
    } else if (me.getSource(checkBoxDrawExplosionParticleCount)) {
        ParticleInterface::gDrawExplosionParticleCount = checkBoxDrawExplosionParticleCount.getState();
    }

} // end LibView::actionPerformed
    void actionPerformed( const mMouseEvent &e)
    {
        if ( e.getID() == mMouseEvent::MOUSE_EVENT_CLICKED )
        {
            bimage.frameToBuffer(GameConfig::player_flag_data,
                                 sizeof(GameConfig::player_flag_data));

            UpdatePlayerFlag upf;
            memcpy(upf.player_flag,
                   GameConfig::player_flag_data,
                   sizeof(GameConfig::player_flag_data));

            CLIENT->sendMessage(&upf, sizeof(upf));

            Desktop::setVisibility("GFlagSelectionView", false);
            COMMAND_PROCESSOR.Flagtimer.reset();
//            PlayerInterface::getLocalPlayer()->setStateActive();
        }
        else
        {
            Button::actionPerformed(e);
        }
    }
// actionPerformed
//---------------------------------------------------------------------------
void VehicleSelectionView::actionPerformed(mMouseEvent me)
{
    if (me.getID() == mMouseEvent::MOUSE_EVENT_CLICKED) {
        if (me.getSource(buttonStaticDisplay)) {
            if (buttonStaticDisplay.getLabel() == "On") {
                buttonStaticDisplay.setLabel("Off");
            } else {
                buttonStaticDisplay.setLabel("On");
            }

            VehicleSelectionView::displayMiniProductionStatus = !VehicleSelectionView::displayMiniProductionStatus;
        }

        if (me.getSource(buttonPower)) {
            if (buttonPower.getLabel() == "On") {
                buttonPower.setLabel("Off");
            } else {
                buttonPower.setLabel("On");
            }

            vsvUnitGenOn = !vsvUnitGenOn;
            changeMade   = true;
            sendOutpostStatus();
        }

        if (me.getSource(buttonOk)) {
            Desktop::setVisibilityNoDoAnything("VehicleSelectionView", false);
            sendOutpostStatus();
            changeMade = false;
        }
    } else if (me.getID() == mMouseEvent::MOUSE_EVENT_ENTERED) {
        if (me.getSource(abstractButtonValentine)) {
            highlightedUnitType = _unit_type_valentine;
        }
        if (me.getSource(abstractButtonLeopard)) {
            highlightedUnitType = _unit_type_leopard;
        }
        if (me.getSource(abstractButtonAbrams)) {
            highlightedUnitType = _unit_type_abrams;
        }
        if (me.getSource(abstractButtonHammerhead)) {
            highlightedUnitType = _unit_type_hammerhead;
        }
        if (me.getSource(abstractButtonLynx)) {
            highlightedUnitType = _unit_type_lynx;
        }
        if (me.getSource(abstractButtonM109)) {
            highlightedUnitType = _unit_type_m109;
        }
        if (me.getSource(abstractButtonSpahpanzer)) {
            highlightedUnitType = _unit_type_spahpanzer;
        }
        if (me.getSource(abstractButtonScorpion)) {
            highlightedUnitType = _unit_type_scorpion;
        }
        if (me.getSource(abstractButtonHumvee)) {
            highlightedUnitType = _unit_type_humvee;
        }
        if (me.getSource(abstractButtonArcher)) {
            highlightedUnitType = _unit_type_archer;
        }
    }

} // end VehicleSelectionView::actionPerformed