@@ -1116,7 +1116,7 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data,std::string element) {
1116
1116
void GUIFormSpecMenu::parseImageButton (parserData* data,std::string element,std::string type) {
1117
1117
std::vector<std::string> parts = split (element,' ;' );
1118
1118
1119
- if ((parts.size () == 5 ) || (parts.size () == 7 )) {
1119
+ if ((parts.size () == 5 ) || (parts.size () == 7 ) || (parts. size () == 8 ) ) {
1120
1120
std::vector<std::string> v_pos = split (parts[0 ],' ,' );
1121
1121
std::vector<std::string> v_geom = split (parts[1 ],' ,' );
1122
1122
std::string image_name = parts[2 ];
@@ -1136,13 +1136,19 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std:
1136
1136
bool noclip = false ;
1137
1137
bool drawborder = true ;
1138
1138
1139
- if ((parts.size () = = 7 )) {
1139
+ if ((parts.size () > = 7 )) {
1140
1140
if (parts[5 ] == " true" )
1141
1141
noclip = true ;
1142
1142
1143
1143
if (parts[6 ] == " false" )
1144
1144
drawborder = false ;
1145
1145
}
1146
+
1147
+ std::string pressed_image_name = " " ;
1148
+
1149
+ if ((parts.size () == 8 )) {
1150
+ pressed_image_name = parts[7 ];
1151
+ }
1146
1152
1147
1153
core::rect<s32> rect = core::rect<s32>(pos.X , pos.Y , pos.X +geom.X , pos.Y +geom.Y );
1148
1154
@@ -1169,21 +1175,31 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std:
1169
1175
spec.is_exit = true ;
1170
1176
1171
1177
video::ITexture *texture = 0 ;
1178
+ video::ITexture *pressed_texture = 0 ;
1172
1179
// if there's no gamedef specified try to get direct
1173
1180
// TODO check for possible texture leak
1174
- if (m_gamedef != 0 )
1181
+ if (m_gamedef != 0 ) {
1175
1182
texture = m_gamedef->tsrc ()->getTexture (image_name);
1176
- else {
1183
+ if ((parts.size () == 8 )) {
1184
+ pressed_texture = m_gamedef->tsrc ()->getTexture (pressed_image_name);
1185
+ }
1186
+ } else {
1177
1187
if (fs::PathExists (image_name)) {
1178
1188
texture = Environment->getVideoDriver ()->getTexture (image_name.c_str ());
1179
1189
m_Textures.push_back (texture);
1180
1190
}
1191
+ if (fs::PathExists (pressed_image_name)) {
1192
+ pressed_texture = Environment->getVideoDriver ()->getTexture (pressed_image_name.c_str ());
1193
+ m_Textures.push_back (pressed_texture);
1194
+ }
1181
1195
}
1196
+ if (parts.size () < 8 )
1197
+ pressed_texture = texture;
1182
1198
1183
1199
gui::IGUIButton *e = Environment->addButton (rect, this , spec.fid , spec.flabel .c_str ());
1184
1200
e->setUseAlphaChannel (true );
1185
1201
e->setImage (texture);
1186
- e->setPressedImage (texture );
1202
+ e->setPressedImage (pressed_texture );
1187
1203
e->setScaleImage (true );
1188
1204
e->setNotClipped (noclip);
1189
1205
e->setDrawBorder (drawborder);
0 commit comments