Added 'symbol_variation' script function

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@101 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-09 16:31:22 +00:00
parent 86328aaeec
commit c130916465
8 changed files with 110 additions and 37 deletions
+13
View File
@@ -45,6 +45,19 @@ InputStreamP StyleSheet::openIconFile() {
}
}
StyleP StyleSheet::styleFor(const FieldP& field) {
if (card_style.containsKey(field)) {
return card_style[field];
} else if (set_info_style.containsKey(field)) {
return set_info_style[field];
} else if (styling_style.containsKey(field)) {
return styling_style[field];
} else {
throw InternalError(_("Can not find styling for field '")+field->name+_("'in stylesheet"));
}
}
IMPLEMENT_REFLECTION(StyleSheet) {
// < 0.3.0 didn't use card_ prefix
tag.addAlias(300, _("width"), _("card width"));
+3
View File
@@ -50,6 +50,9 @@ class StyleSheet : public Packaged {
inline RealRect getCardRect() const { return RealRect(0, 0, card_width, card_height); }
/// Return the style for a given field, it is not specified what type of field this is.
StyleP styleFor(const FieldP& field);
/// Load a StyleSheet, given a Game and the name of the StyleSheet
static StyleSheetP byGameAndName(const Game& game, const String& name);
/// name of the package without the game name
+20
View File
@@ -163,6 +163,26 @@ IMPLEMENT_REFLECTION(Symbol) {
REFLECT(parts);
}
// ----------------------------------------------------------------------------- : Default symbol
// A default symbol part, a square, moved by d
SymbolPartP default_symbol_part(double d) {
SymbolPartP part = new_shared<SymbolPart>();
part->points.push_back(new_shared2<ControlPoint>(d + .2, d + .2));
part->points.push_back(new_shared2<ControlPoint>(d + .2, d + .8));
part->points.push_back(new_shared2<ControlPoint>(d + .8, d + .8));
part->points.push_back(new_shared2<ControlPoint>(d + .8, d + .2));
part->name = _("Square");
return part;
}
// A default symbol, a square
SymbolP default_symbol() {
SymbolP symbol = new_shared<Symbol>();
symbol->parts.push_back(default_symbol_part(0));
return symbol;
}
// ----------------------------------------------------------------------------- : SymbolView
SymbolView::SymbolView() {}
+2
View File
@@ -162,6 +162,8 @@ class Symbol {
DECLARE_REFLECTION();
};
/// A default symbol: a square
SymbolP default_symbol();
// ----------------------------------------------------------------------------- : SymbolView