Ready/not Ready/brb in colors; labels can have colors now
This commit is contained in:
parent
846dd4769b
commit
5648080095
|
@ -247,9 +247,10 @@ void GraphicComponent::resetFade(){
|
||||||
const int GraphicLabel::defH= 20;
|
const int GraphicLabel::defH= 20;
|
||||||
const int GraphicLabel::defW= 70;
|
const int GraphicLabel::defW= 70;
|
||||||
|
|
||||||
void GraphicLabel::init(int x, int y, int w, int h, bool centered){
|
void GraphicLabel::init(int x, int y, int w, int h, bool centered, Vec3f textColor){
|
||||||
GraphicComponent::init(x, y, w, h);
|
GraphicComponent::init(x, y, w, h);
|
||||||
this->centered= centered;
|
this->centered= centered;
|
||||||
|
this->textColor=textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
|
@ -113,13 +113,15 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool centered;
|
bool centered;
|
||||||
|
Vec3f textColor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init(int x, int y, int w=defW, int h=defH, bool centered= false);
|
void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=Vec3f(1.f, 1.f, 1.f));
|
||||||
|
|
||||||
bool getCentered() const {return centered;}
|
bool getCentered() const {return centered;}
|
||||||
|
|
||||||
void setCentered(bool centered) {this->centered= centered;}
|
void setCentered(bool centered) {this->centered= centered;}
|
||||||
|
Vec3f getTextColor() const {return textColor;}
|
||||||
|
void setTextColor(Vec3f color) {this->textColor= color;}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
|
@ -1243,8 +1243,9 @@ void Renderer::renderTextShadow(const string &text, const Font2D *font,const Vec
|
||||||
// ============= COMPONENTS =============================
|
// ============= COMPONENTS =============================
|
||||||
|
|
||||||
void Renderer::renderLabel(const GraphicLabel *label) {
|
void Renderer::renderLabel(const GraphicLabel *label) {
|
||||||
Vec4f *colorWithAlpha = NULL;
|
Vec3f labelColor=label->getTextColor();
|
||||||
renderLabel(label,colorWithAlpha);
|
Vec4f colorWithAlpha = Vec4f(labelColor.x,labelColor.y,labelColor.z,GraphicComponent::getFade());
|
||||||
|
renderLabel(label,&colorWithAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::renderLabel(const GraphicLabel *label,const Vec3f *color) {
|
void Renderer::renderLabel(const GraphicLabel *label,const Vec3f *color) {
|
||||||
|
|
|
@ -138,10 +138,9 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
|
|
||||||
//create
|
//create
|
||||||
buttonDisconnect.registerGraphicComponent(containerName,"buttonDisconnect");
|
buttonDisconnect.registerGraphicComponent(containerName,"buttonDisconnect");
|
||||||
buttonDisconnect.init(450, 180, 125);
|
buttonDisconnect.init(350, 180, 125);
|
||||||
|
|
||||||
|
|
||||||
buttonPlayNow.registerGraphicComponent(containerName,"buttonPlayNow");
|
|
||||||
buttonPlayNow.init(525, 180, 125);
|
|
||||||
|
|
||||||
|
|
||||||
xoffset=170;
|
xoffset=170;
|
||||||
|
@ -281,7 +280,8 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
|
|
||||||
|
|
||||||
listBoxPlayerStatus.registerGraphicComponent(containerName,"listBoxPlayerStatus");
|
listBoxPlayerStatus.registerGraphicComponent(containerName,"listBoxPlayerStatus");
|
||||||
listBoxPlayerStatus.init(10, 600, 150);
|
//listBoxPlayerStatus.init(10, 600, 150);
|
||||||
|
listBoxPlayerStatus.init(525, 180, 125);
|
||||||
playerStatuses.push_back(lang.get("PlayerStatusSetup"));
|
playerStatuses.push_back(lang.get("PlayerStatusSetup"));
|
||||||
playerStatuses.push_back(lang.get("PlayerStatusBeRightBack"));
|
playerStatuses.push_back(lang.get("PlayerStatusBeRightBack"));
|
||||||
playerStatuses.push_back(lang.get("PlayerStatusReady"));
|
playerStatuses.push_back(lang.get("PlayerStatusReady"));
|
||||||
|
@ -348,7 +348,6 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
||||||
|
|
||||||
//texts
|
//texts
|
||||||
buttonDisconnect.setText(lang.get("Return"));
|
buttonDisconnect.setText(lang.get("Return"));
|
||||||
buttonPlayNow.setText(lang.get("PlayNow"));
|
|
||||||
|
|
||||||
controlItems.push_back(lang.get("Closed"));
|
controlItems.push_back(lang.get("Closed"));
|
||||||
controlItems.push_back(lang.get("CpuEasy"));
|
controlItems.push_back(lang.get("CpuEasy"));
|
||||||
|
@ -576,84 +575,66 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
if (initialSettingsReceivedFromServer == false) return;
|
if (initialSettingsReceivedFromServer == false) return;
|
||||||
|
|
||||||
// Only allow changes after we get game settings from the server
|
// Only allow changes after we get game settings from the server
|
||||||
if(clientInterface->isConnected() == true) {
|
if(clientInterface->isConnected() == true){
|
||||||
if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) {
|
int myCurrentIndex= -1;
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
for(int i= 0; i < GameConstants::maxPlayers; ++i){// find my current index by looking at editable listBoxes
|
||||||
soundRenderer.playFx(coreData.getClickSoundC());
|
if(listBoxFactions[i].getEditable()){
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
myCurrentIndex= i;
|
||||||
}
|
|
||||||
else {
|
|
||||||
int myCurrentIndex=-1;
|
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i)
|
|
||||||
{// find my current index by looking at editable listBoxes
|
|
||||||
if(listBoxFactions[i].getEditable()){
|
|
||||||
myCurrentIndex=i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (myCurrentIndex!=-1)
|
}
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i)
|
if(myCurrentIndex != -1)
|
||||||
{
|
for(int i= 0; i < GameConstants::maxPlayers; ++i){
|
||||||
if(listBoxFactions[i].getEditable()) {
|
if(listBoxFactions[i].getEditable()){
|
||||||
if(listBoxFactions[i].mouseClick(x, y)) {
|
if(listBoxFactions[i].mouseClick(x, y)){
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
|
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
|
||||||
if(clientInterface->isConnected()) {
|
if(clientInterface->isConnected()){
|
||||||
clientInterface->setGameSettingsReceived(false);
|
clientInterface->setGameSettingsReceived(false);
|
||||||
clientInterface->sendSwitchSetupRequest(
|
clientInterface->sendSwitchSetupRequest(listBoxFactions[i].getSelectedItem(), i, -1,
|
||||||
listBoxFactions[i].getSelectedItem(),i,-1,
|
listBoxTeams[i].getSelectedItemIndex(), getHumanPlayerName(),
|
||||||
listBoxTeams[i].getSelectedItemIndex(),
|
getNetworkPlayerStatus(), switchSetupRequestFlagType);
|
||||||
getHumanPlayerName(),
|
switchSetupRequestFlagType= ssrft_None;
|
||||||
getNetworkPlayerStatus(),
|
|
||||||
switchSetupRequestFlagType);
|
|
||||||
switchSetupRequestFlagType=ssrft_None;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(listBoxTeams[i].getEditable()) {
|
if(listBoxTeams[i].getEditable()){
|
||||||
if(listBoxTeams[i].mouseClick(x, y)) {
|
if(listBoxTeams[i].mouseClick(x, y)){
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
if(clientInterface->isConnected()) {
|
if(clientInterface->isConnected()){
|
||||||
clientInterface->setGameSettingsReceived(false);
|
clientInterface->setGameSettingsReceived(false);
|
||||||
clientInterface->sendSwitchSetupRequest(
|
clientInterface->sendSwitchSetupRequest(listBoxFactions[i].getSelectedItem(), i, -1,
|
||||||
listBoxFactions[i].getSelectedItem(),i,-1,
|
listBoxTeams[i].getSelectedItemIndex(), getHumanPlayerName(),
|
||||||
listBoxTeams[i].getSelectedItemIndex(),
|
getNetworkPlayerStatus(), switchSetupRequestFlagType);
|
||||||
getHumanPlayerName(),
|
switchSetupRequestFlagType= ssrft_None;
|
||||||
getNetworkPlayerStatus(),
|
|
||||||
switchSetupRequestFlagType);
|
|
||||||
switchSetupRequestFlagType=ssrft_None;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((listBoxControls[i].getSelectedItemIndex() == ctNetwork) &&
|
if((listBoxControls[i].getSelectedItemIndex() == ctNetwork) && (labelNetStatus[i].getText()
|
||||||
(labelNetStatus[i].getText() == GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME)) {
|
== GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME)){
|
||||||
if(grabSlotButton[i].mouseClick(x, y) ) {
|
if(grabSlotButton[i].mouseClick(x, y)){
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
clientInterface->setGameSettingsReceived(false);
|
clientInterface->setGameSettingsReceived(false);
|
||||||
settingsReceivedFromServer=false;
|
settingsReceivedFromServer= false;
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] sending a switchSlot request from %d to %d\n",__FILE__,__FUNCTION__,__LINE__,clientInterface->getGameSettings()->getThisFactionIndex(),i);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] sending a switchSlot request from %d to %d\n",__FILE__,__FUNCTION__,__LINE__,clientInterface->getGameSettings()->getThisFactionIndex(),i);
|
||||||
clientInterface->sendSwitchSetupRequest(
|
clientInterface->sendSwitchSetupRequest(listBoxFactions[myCurrentIndex].getSelectedItem(),
|
||||||
listBoxFactions[myCurrentIndex].getSelectedItem(),
|
myCurrentIndex, i, listBoxTeams[myCurrentIndex].getSelectedItemIndex(),
|
||||||
myCurrentIndex,i,
|
labelPlayerNames[myCurrentIndex].getText(), getNetworkPlayerStatus(),
|
||||||
listBoxTeams[myCurrentIndex].getSelectedItemIndex(),
|
switchSetupRequestFlagType);
|
||||||
labelPlayerNames[myCurrentIndex].getText(),
|
|
||||||
getNetworkPlayerStatus(),
|
|
||||||
switchSetupRequestFlagType);
|
|
||||||
labelPlayerNames[myCurrentIndex].setText("");
|
labelPlayerNames[myCurrentIndex].setText("");
|
||||||
labelPlayerNames[i].setText("");
|
labelPlayerNames[i].setText("");
|
||||||
switchSetupRequestFlagType=ssrft_None;
|
switchSetupRequestFlagType= ssrft_None;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(labelPlayerNames[i].mouseClick(x, y) && ( activeInputLabel != &labelPlayerNames[i] )){
|
if(labelPlayerNames[i].mouseClick(x, y) && (activeInputLabel != &labelPlayerNames[i])){
|
||||||
if(i == clientInterface->getPlayerIndex()) {
|
if(i == clientInterface->getPlayerIndex()){
|
||||||
setActiveInputLabel(&labelPlayerNames[i]);
|
setActiveInputLabel(&labelPlayerNames[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(listBoxPlayerStatus.mouseClick(x,y)) {
|
if(listBoxPlayerStatus.mouseClick(x,y)) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -708,7 +689,6 @@ void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms) {
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonDisconnect.mouseMove(x, y);
|
buttonDisconnect.mouseMove(x, y);
|
||||||
buttonPlayNow.mouseMove(x, y);
|
|
||||||
|
|
||||||
bool editingPlayerName = false;
|
bool editingPlayerName = false;
|
||||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||||
|
@ -731,6 +711,7 @@ void MenuStateConnectedGame::mouseMove(int x, int y, const MouseState *ms) {
|
||||||
listBoxAllowObservers.mouseMove(x, y);
|
listBoxAllowObservers.mouseMove(x, y);
|
||||||
listBoxTileset.mouseMove(x, y);
|
listBoxTileset.mouseMove(x, y);
|
||||||
listBoxTechTree.mouseMove(x, y);
|
listBoxTechTree.mouseMove(x, y);
|
||||||
|
listBoxPlayerStatus.mouseMove(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuStateConnectedGame::render() {
|
void MenuStateConnectedGame::render() {
|
||||||
|
@ -755,7 +736,6 @@ void MenuStateConnectedGame::render() {
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
renderer.renderButton(&buttonDisconnect);
|
renderer.renderButton(&buttonDisconnect);
|
||||||
//renderer.renderButton(&buttonPlayNow);
|
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
@ -1512,12 +1492,15 @@ void MenuStateConnectedGame::update() {
|
||||||
switch(gameSettings->getNetworkPlayerStatuses(i)) {
|
switch(gameSettings->getNetworkPlayerStatuses(i)) {
|
||||||
case npst_BeRightBack:
|
case npst_BeRightBack:
|
||||||
labelPlayerStatus[slot].setText(lang.get("PlayerStatusBeRightBack"));
|
labelPlayerStatus[slot].setText(lang.get("PlayerStatusBeRightBack"));
|
||||||
|
labelPlayerStatus[slot].setTextColor(Vec3f(1.f, 0.8f, 0.f));
|
||||||
break;
|
break;
|
||||||
case npst_Ready:
|
case npst_Ready:
|
||||||
labelPlayerStatus[slot].setText(lang.get("PlayerStatusReady"));
|
labelPlayerStatus[slot].setText(lang.get("PlayerStatusReady"));
|
||||||
|
labelPlayerStatus[slot].setTextColor(Vec3f(0.f, 1.f, 0.f));
|
||||||
break;
|
break;
|
||||||
case npst_PickSettings:
|
case npst_PickSettings:
|
||||||
labelPlayerStatus[slot].setText(lang.get("PlayerStatusSetup"));
|
labelPlayerStatus[slot].setText(lang.get("PlayerStatusSetup"));
|
||||||
|
labelPlayerStatus[slot].setTextColor(Vec3f(1.f, 0.f, 0.f));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
labelPlayerStatus[slot].setText("");
|
labelPlayerStatus[slot].setText("");
|
||||||
|
|
|
@ -41,7 +41,6 @@ enum FTPMessageType {
|
||||||
class MenuStateConnectedGame: public MenuState, public FTPClientCallbackInterface {
|
class MenuStateConnectedGame: public MenuState, public FTPClientCallbackInterface {
|
||||||
private:
|
private:
|
||||||
GraphicButton buttonDisconnect;
|
GraphicButton buttonDisconnect;
|
||||||
GraphicButton buttonPlayNow;
|
|
||||||
GraphicLabel labelControl;
|
GraphicLabel labelControl;
|
||||||
GraphicLabel labelRMultiplier;
|
GraphicLabel labelRMultiplier;
|
||||||
GraphicLabel labelFaction;
|
GraphicLabel labelFaction;
|
||||||
|
|
|
@ -527,6 +527,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
||||||
playerStatuses.push_back(lang.get("PlayerStatusBeRightBack"));
|
playerStatuses.push_back(lang.get("PlayerStatusBeRightBack"));
|
||||||
playerStatuses.push_back(lang.get("PlayerStatusReady"));
|
playerStatuses.push_back(lang.get("PlayerStatusReady"));
|
||||||
listBoxPlayerStatus.setItems(playerStatuses);
|
listBoxPlayerStatus.setItems(playerStatuses);
|
||||||
|
listBoxPlayerStatus.setSelectedItemIndex(2,true);
|
||||||
|
listBoxPlayerStatus.setVisible(false);
|
||||||
|
|
||||||
// write hint to console:
|
// write hint to console:
|
||||||
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||||
|
@ -1559,12 +1561,15 @@ void MenuStateCustomGame::update() {
|
||||||
switch(gameSettings.getNetworkPlayerStatuses(slotIndex)) {
|
switch(gameSettings.getNetworkPlayerStatuses(slotIndex)) {
|
||||||
case npst_BeRightBack:
|
case npst_BeRightBack:
|
||||||
labelPlayerStatus[i].setText(lang.get("PlayerStatusBeRightBack"));
|
labelPlayerStatus[i].setText(lang.get("PlayerStatusBeRightBack"));
|
||||||
|
labelPlayerStatus[i].setTextColor(Vec3f(1.f, 0.8f, 0.f));
|
||||||
break;
|
break;
|
||||||
case npst_Ready:
|
case npst_Ready:
|
||||||
labelPlayerStatus[i].setText(lang.get("PlayerStatusReady"));
|
labelPlayerStatus[i].setText(lang.get("PlayerStatusReady"));
|
||||||
|
labelPlayerStatus[i].setTextColor(Vec3f(0.f, 1.f, 0.f));
|
||||||
break;
|
break;
|
||||||
case npst_PickSettings:
|
case npst_PickSettings:
|
||||||
labelPlayerStatus[i].setText(lang.get("PlayerStatusSetup"));
|
labelPlayerStatus[i].setText(lang.get("PlayerStatusSetup"));
|
||||||
|
labelPlayerStatus[i].setTextColor(Vec3f(1.f, 0.f, 0.f));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
labelPlayerStatus[i].setText("");
|
labelPlayerStatus[i].setText("");
|
||||||
|
@ -1595,13 +1600,16 @@ void MenuStateCustomGame::update() {
|
||||||
switch(serverInterface->getSlot(i)->getNetworkPlayerStatus()) {
|
switch(serverInterface->getSlot(i)->getNetworkPlayerStatus()) {
|
||||||
case npst_BeRightBack:
|
case npst_BeRightBack:
|
||||||
labelPlayerStatus[i].setText(lang.get("PlayerStatusBeRightBack"));
|
labelPlayerStatus[i].setText(lang.get("PlayerStatusBeRightBack"));
|
||||||
|
labelPlayerStatus[i].setTextColor(Vec3f(1.f, 0.8f, 0.f));
|
||||||
break;
|
break;
|
||||||
case npst_Ready:
|
case npst_Ready:
|
||||||
labelPlayerStatus[i].setText(lang.get("PlayerStatusReady"));
|
labelPlayerStatus[i].setText(lang.get("PlayerStatusReady"));
|
||||||
|
labelPlayerStatus[i].setTextColor(Vec3f(0.f, 1.f, 0.f));
|
||||||
break;
|
break;
|
||||||
case npst_PickSettings:
|
case npst_PickSettings:
|
||||||
default:
|
default:
|
||||||
labelPlayerStatus[i].setText(lang.get("PlayerStatusSetup"));
|
labelPlayerStatus[i].setText(lang.get("PlayerStatusSetup"));
|
||||||
|
labelPlayerStatus[i].setTextColor(Vec3f(1.f, 0.f, 0.f));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue