mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Removed last of the BeginDrawing/EndDrawing calls;
Added english_number_ordinal script function; Working on symbols with a different aspect ratio (i.e. wider/smaller symbols) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@558 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -26,6 +26,8 @@ IMPLEMENT_REFLECTION(SymbolField) {
|
||||
|
||||
IMPLEMENT_REFLECTION(SymbolStyle) {
|
||||
REFLECT_BASE(Style);
|
||||
REFLECT(min_aspect_ratio);
|
||||
REFLECT(max_aspect_ratio);
|
||||
REFLECT(variations);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,13 @@ class SymbolField : public Field {
|
||||
/// The Style for a SymbolField
|
||||
class SymbolStyle : public Style {
|
||||
public:
|
||||
inline SymbolStyle(const SymbolFieldP& field) : Style(field) {}
|
||||
inline SymbolStyle(const SymbolFieldP& field)
|
||||
: Style(field)
|
||||
, min_aspect_ratio(1), max_aspect_ratio(1)
|
||||
{}
|
||||
DECLARE_STYLE_TYPE(Symbol);
|
||||
double min_aspect_ratio;
|
||||
double max_aspect_ratio; ///< Bounds for the symbol's aspect ratio
|
||||
|
||||
vector<SymbolVariationP> variations; ///< Different variantions of the same symbol
|
||||
|
||||
|
||||
@@ -6,6 +6,13 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
// VS 8 has the audacity to give a warning about fill_n
|
||||
// That is both STUPID and WRONG, so disable that warning
|
||||
// This has to be done before includes, because the warning is reported in standard headers!
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
#include <data/format/image_to_symbol.hpp>
|
||||
#include <gfx/bezier.hpp>
|
||||
#include <util/error.hpp>
|
||||
|
||||
@@ -280,6 +280,17 @@ IMPLEMENT_REFLECTION(Symbol) {
|
||||
REFLECT_IF_READING calculateBoundsNonRec();
|
||||
}
|
||||
|
||||
double Symbol::aspectRatio() const {
|
||||
double margin_x = min(0.4999, max(0., min(min_pos.x, 1-max_pos.x)));
|
||||
double margin_y = min(0.4999, max(0., min(min_pos.y, 1-max_pos.y)));
|
||||
double delta = 2 * (margin_y - margin_x);
|
||||
if (delta > 0) {
|
||||
return 1 / (1 - delta);
|
||||
} else {
|
||||
return 1 + delta;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Default symbol
|
||||
|
||||
// A default symbol part, a square, moved by d
|
||||
|
||||
@@ -257,6 +257,9 @@ class Symbol : public SymbolGroup {
|
||||
/// Actions performed on this symbol and the parts in it
|
||||
ActionStack actions;
|
||||
|
||||
/// Determine the aspect ratio best suited for this symbol
|
||||
double aspectRatio() const;
|
||||
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user