Add dialog allowing you to alter the scenario's graphics sheets from within the scenario editor
- You can copy/paste images into the sheet, or import/export to/from png files Also: - Picture controls in the dialog engine have a new "scaled" flag; if set, the picture will be scaled into the provided bounds rather than overflowing. Currently, only full sheets honour the setting.
This commit is contained in:
@@ -105,6 +105,10 @@ template<> pair<string,cPict*> cDialog::parse(Element& who /*pict*/){
|
||||
std::string val;
|
||||
attr->GetValue(&val);
|
||||
if(val == "true") custom = true;
|
||||
}else if(name == "scaled"){
|
||||
std::string val;
|
||||
attr->GetValue(&val);
|
||||
if(val == "true") p.second->setFormat(TXT_WRAP, false);
|
||||
}else if(name == "size"){
|
||||
std::string val;
|
||||
attr->GetValue(&val);
|
||||
|
@@ -92,12 +92,14 @@ bool cPict::triggerClickHandler(cDialog& me, std::string id, eKeyMod mods){
|
||||
void cPict::setFormat(eFormat prop, short val) throw(xUnsupportedProp){
|
||||
if(prop == TXT_FRAME) drawFramed = val;
|
||||
else if(prop == TXT_FRAMESTYLE) frameStyle = val;
|
||||
else if(prop == TXT_WRAP) drawScaled = !val;
|
||||
else throw xUnsupportedProp(prop);
|
||||
}
|
||||
|
||||
short cPict::getFormat(eFormat prop) throw(xUnsupportedProp){
|
||||
if(prop == TXT_FRAME) return drawFramed;
|
||||
else if(prop == TXT_FRAMESTYLE) return frameStyle;
|
||||
else if(prop == TXT_WRAP) return !drawScaled;
|
||||
else throw xUnsupportedProp(prop);
|
||||
}
|
||||
|
||||
@@ -828,8 +830,10 @@ void cPict::drawFullSheet(short num, rectangle to_rect){
|
||||
rectangle from_rect;
|
||||
std::shared_ptr<sf::Texture> from_gw = getSheet(SHEET_FULL, num);
|
||||
from_rect = rectangle(*from_gw);
|
||||
to_rect.right = to_rect.left + (from_rect.right - from_rect.left);
|
||||
to_rect.bottom = to_rect.top + (from_rect.bottom - from_rect.top);
|
||||
if(!drawScaled) {
|
||||
to_rect.right = to_rect.left + (from_rect.right - from_rect.left);
|
||||
to_rect.bottom = to_rect.top + (from_rect.bottom - from_rect.top);
|
||||
}
|
||||
rect_draw_some_item(*from_gw, from_rect, *inWindow, to_rect);
|
||||
}
|
||||
|
||||
|
@@ -87,7 +87,7 @@ private:
|
||||
static short animFrame;
|
||||
pic_num_t picNum;
|
||||
ePicType picType;
|
||||
bool clickable, drawFramed;
|
||||
bool clickable, drawFramed, drawScaled;
|
||||
void drawPresetTer(short num, rectangle to_rect);
|
||||
void drawPresetTerAnim(short num, rectangle to_rect);
|
||||
void drawPresetMonstSm(short num, rectangle to_rect);
|
||||
|
Reference in New Issue
Block a user