mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 04:43:58 +02:00
now you are "forced" to say "ready" when you are connected :-D
This commit is contained in:
@@ -290,14 +290,16 @@ bool GraphicButton::mouseMove(int x, int y){
|
|||||||
const int GraphicListBox::defH= 22;
|
const int GraphicListBox::defH= 22;
|
||||||
const int GraphicListBox::defW= 140;
|
const int GraphicListBox::defW= 140;
|
||||||
|
|
||||||
void GraphicListBox::init(int x, int y, int w, int h){
|
void GraphicListBox::init(int x, int y, int w, int h, Vec3f textColor){
|
||||||
GraphicComponent::init(x, y, w, h);
|
GraphicComponent::init(x, y, w, h);
|
||||||
|
|
||||||
|
this->textColor=textColor;
|
||||||
graphButton1.init(x, y, 22, h);
|
graphButton1.init(x, y, 22, h);
|
||||||
graphButton2.init(x+w-22, y, 22, h);
|
graphButton2.init(x+w-22, y, 22, h);
|
||||||
graphButton1.setText("<");
|
graphButton1.setText("<");
|
||||||
graphButton2.setText(">");
|
graphButton2.setText(">");
|
||||||
selectedItemIndex=-1;
|
selectedItemIndex=-1;
|
||||||
|
lighted=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//queryes
|
//queryes
|
||||||
|
@@ -170,9 +170,11 @@ private:
|
|||||||
GraphicButton graphButton1, graphButton2;
|
GraphicButton graphButton1, graphButton2;
|
||||||
vector<string> items;
|
vector<string> items;
|
||||||
int selectedItemIndex;
|
int selectedItemIndex;
|
||||||
|
bool lighted;
|
||||||
|
Vec3f textColor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init(int x, int y, int w=defW, int h=defH);
|
void init(int x, int y, int w=defW, int h=defH, Vec3f textColor=Vec3f(1.f, 1.f, 1.f));
|
||||||
|
|
||||||
int getItemCount() const {return items.size();}
|
int getItemCount() const {return items.size();}
|
||||||
string getItem(int index) const {return items[index];}
|
string getItem(int index) const {return items[index];}
|
||||||
@@ -180,12 +182,17 @@ public:
|
|||||||
string getSelectedItem() const {return items[selectedItemIndex];}
|
string getSelectedItem() const {return items[selectedItemIndex];}
|
||||||
const GraphicButton *getButton1() const {return &graphButton1;}
|
const GraphicButton *getButton1() const {return &graphButton1;}
|
||||||
const GraphicButton *getButton2() const {return &graphButton2;}
|
const GraphicButton *getButton2() const {return &graphButton2;}
|
||||||
|
bool getLighted() const {return lighted;}
|
||||||
|
void setLighted(bool lighted) {this->lighted= lighted;}
|
||||||
|
Vec3f getTextColor() const {return textColor;}
|
||||||
|
void setTextColor(Vec3f color) {this->textColor= color;}
|
||||||
|
|
||||||
void pushBackItem(string item);
|
void pushBackItem(string item);
|
||||||
void setItems(const vector<string> &items);
|
void setItems(const vector<string> &items);
|
||||||
void setSelectedItemIndex(int index, bool errorOnMissing=true);
|
void setSelectedItemIndex(int index, bool errorOnMissing=true);
|
||||||
void setSelectedItem(string item, bool errorOnMissing=true);
|
void setSelectedItem(string item, bool errorOnMissing=true);
|
||||||
void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
|
|
||||||
virtual void setY(int y);
|
virtual void setY(int y);
|
||||||
|
|
||||||
virtual bool mouseMove(int x, int y);
|
virtual bool mouseMove(int x, int y);
|
||||||
|
@@ -1717,11 +1717,57 @@ void Renderer::renderListBox(const GraphicListBox *listBox) {
|
|||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
GraphicLabel label;
|
GraphicLabel label;
|
||||||
label.init(listBox->getX(), listBox->getY(), listBox->getW(), listBox->getH(), true);
|
label.init(listBox->getX(), listBox->getY(), listBox->getW(), listBox->getH(), true,listBox->getTextColor());
|
||||||
label.setText(listBox->getText());
|
label.setText(listBox->getText());
|
||||||
label.setFont(listBox->getFont());
|
label.setFont(listBox->getFont());
|
||||||
renderLabel(&label);
|
renderLabel(&label);
|
||||||
|
|
||||||
|
|
||||||
|
//lighting
|
||||||
|
|
||||||
|
bool renderLighted= (listBox->getLighted());
|
||||||
|
|
||||||
|
|
||||||
|
if(renderLighted) {
|
||||||
|
float anim= GraphicComponent::getAnim();
|
||||||
|
if(anim>0.5f) anim= 1.f-anim;
|
||||||
|
|
||||||
|
Vec3f color=listBox->getTextColor();
|
||||||
|
int x= listBox->getX()+listBox->getButton1()->getW();
|
||||||
|
int y= listBox->getY();
|
||||||
|
int h= listBox->getH();
|
||||||
|
int w= listBox->getW()-listBox->getButton1()->getW()-listBox->getButton2()->getW();
|
||||||
|
|
||||||
|
const int lightSize= 0;
|
||||||
|
const Vec4f color1= Vec4f(color.x, color.y, color.z, 0.1f+anim*0.5f);
|
||||||
|
const Vec4f color2= Vec4f(color.x, color.y, color.z, 0.3f+anim);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
|
|
||||||
|
glColor4fv(color2.ptr());
|
||||||
|
glVertex2f(x+w/2, y+h/2);
|
||||||
|
|
||||||
|
glColor4fv(color1.ptr());
|
||||||
|
glVertex2f(x-lightSize, y-lightSize);
|
||||||
|
|
||||||
|
glColor4fv(color1.ptr());
|
||||||
|
glVertex2f(x+w+lightSize, y-lightSize);
|
||||||
|
|
||||||
|
glColor4fv(color1.ptr());
|
||||||
|
glVertex2f(x+w+lightSize, y+h+lightSize);
|
||||||
|
|
||||||
|
glColor4fv(color1.ptr());
|
||||||
|
glVertex2f(x+w+lightSize, y+h+lightSize);
|
||||||
|
|
||||||
|
glColor4fv(color1.ptr());
|
||||||
|
glVertex2f(x-lightSize, y+h+lightSize);
|
||||||
|
|
||||||
|
glColor4fv(color1.ptr());
|
||||||
|
glVertex2f(x-lightSize, y-lightSize);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -285,6 +285,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);
|
listBoxPlayerStatus.init(525, 180, 125);
|
||||||
|
listBoxPlayerStatus.setTextColor(Vec3f(1.0f,0.f,0.f));
|
||||||
|
listBoxPlayerStatus.setLighted(true);
|
||||||
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"));
|
||||||
@@ -690,6 +692,22 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
soundRenderer.playFx(coreData.getClickSoundC());
|
soundRenderer.playFx(coreData.getClickSoundC());
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
if(getNetworkPlayerStatus()==npst_PickSettings)
|
||||||
|
{
|
||||||
|
listBoxPlayerStatus.setTextColor(Vec3f(1.0f,0.0f,0.0f));
|
||||||
|
listBoxPlayerStatus.setLighted(true);
|
||||||
|
}
|
||||||
|
else if(getNetworkPlayerStatus()==npst_BeRightBack)
|
||||||
|
{
|
||||||
|
listBoxPlayerStatus.setTextColor(Vec3f(1.0f,1.0f,0.0f));
|
||||||
|
listBoxPlayerStatus.setLighted(true);
|
||||||
|
}
|
||||||
|
else if(getNetworkPlayerStatus()==npst_Ready)
|
||||||
|
{
|
||||||
|
listBoxPlayerStatus.setTextColor(Vec3f(0.0f,1.0f,0.0f));
|
||||||
|
listBoxPlayerStatus.setLighted(false);
|
||||||
|
}
|
||||||
|
|
||||||
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
|
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
|
||||||
if(clientInterface->isConnected()) {
|
if(clientInterface->isConnected()) {
|
||||||
clientInterface->setGameSettingsReceived(false);
|
clientInterface->setGameSettingsReceived(false);
|
||||||
|
Reference in New Issue
Block a user