feat: add card regions to declare image slice regions for DFCs

This commit is contained in:
Brendan Hagan
2022-08-13 22:43:42 -04:00
parent 05855b812a
commit 6435055d53
15 changed files with 92 additions and 4 deletions
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: 关键词 keyword: 关键词
keywords: 关键词 keywords: 关键词
#_ADD pack: pack type #_ADD pack: pack type
#_ADD card region: card region
#_ADD card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: 图形 shape: 图形
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: 關鍵詞 keyword: 關鍵詞
keywords: 關鍵詞 keywords: 關鍵詞
#_ADD pack: pack type #_ADD pack: pack type
#_ADD card region: card region
#_ADD card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: 圖形 shape: 圖形
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: keyword keyword: keyword
keywords: keywords keywords: keywords
pack: pack type pack: pack type
card region: card region
card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: shape shape: shape
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: keyword keyword: keyword
keywords: keywords keywords: keywords
pack: pack type pack: pack type
card region: card region
card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: shape shape: shape
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: keyword keyword: keyword
keywords: keywords keywords: keywords
pack: pack type pack: pack type
card region: card region
card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: shape shape: shape
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: palabra clave keyword: palabra clave
keywords: palabras clave keywords: palabras clave
pack: mazo pack: mazo
#_ADD card region: card region
#_ADD card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: forma shape: forma
+2
View File
@@ -898,6 +898,8 @@ type:
circle: cercle circle: cercle
ellipse: ellipse ellipse: ellipse
pack: type de pack pack: type de pack
#_ADD card region: card region
#_ADD card regions: card regions
square: carré square: carré
rectangle: rectangle rectangle: rectangle
triangle: triangle triangle: triangle
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: parola-chiave keyword: parola-chiave
keywords: parole chiave keywords: parole chiave
pack: tipo busta pack: tipo busta
#_ADD card region: card region
#_ADD card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: forma shape: forma
+2
View File
@@ -889,6 +889,8 @@ type:
keyword: キーワード keyword: キーワード
keywords: キーワード keywords: キーワード
#_ADD pack: pack type #_ADD pack: pack type
#_ADD card region: card region
#_ADD card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: 形 shape: 形
+2
View File
@@ -924,6 +924,8 @@ type:
keyword: słowo kluczowe (keyword) keyword: słowo kluczowe (keyword)
keywords: słowa kluczowe (keywords) keywords: słowa kluczowe (keywords)
pack: rodzaj paczki (pack type) pack: rodzaj paczki (pack type)
#_ADD card region: card region
#_ADD card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: kształt shape: kształt
+2
View File
@@ -891,6 +891,8 @@ type:
keyword: palavra-chave keyword: palavra-chave
keywords: palavras-chaves keywords: palavras-chaves
pack: tipo de pacote pack: tipo de pacote
#_ADD card region: card region
#_ADD card regions: card regions
# Symbol editor shapes # Symbol editor shapes
shape: forma shape: forma
+25
View File
@@ -0,0 +1,25 @@
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) Twan van Laarhoven and the other MSE developers |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#include <util/prec.hpp>
#include <data/card_region.hpp>
CardRegion::CardRegion()
: name("")
, x(0.0)
, y(0.0)
, width(0)
, height(0)
{}
CardRegion::~CardRegion() {}
IMPLEMENT_REFLECTION(CardRegion) {
REFLECT(name);
REFLECT(x);
REFLECT(y);
REFLECT(width);
REFLECT(height);
}
+34
View File
@@ -0,0 +1,34 @@
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) Twan van Laarhoven and the other MSE developers |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#pragma once
#include <util/prec.hpp>
#include <util/reflect.hpp>
#include <script/scriptable.hpp>
DECLARE_POINTER_TYPE(CardRegion);
class CardRegion : public IntrusivePtrBase<CardRegion> {
public:
CardRegion();
virtual ~CardRegion();
String name;
double x, y;
int width, height;
private:
DECLARE_REFLECTION();
};
inline String type_name(const CardRegion&) {
return _TYPE_("card region");
}
inline String type_name(const vector<CardRegionP>&) {
return _TYPE_("card regions");
}
+2 -1
View File
@@ -97,7 +97,8 @@ IMPLEMENT_REFLECTION(StyleSheet) {
REFLECT(card_width); REFLECT(card_width);
REFLECT(card_height); REFLECT(card_height);
REFLECT(card_dpi); REFLECT(card_dpi);
REFLECT(card_background); REFLECT(card_background);
REFLECT(card_regions);
REFLECT(init_script); REFLECT(init_script);
// styling // styling
REFLECT(styling_fields); REFLECT(styling_fields);
+9 -3
View File
@@ -11,12 +11,17 @@
#include <util/prec.hpp> #include <util/prec.hpp>
#include <util/io/package.hpp> #include <util/io/package.hpp>
#include <util/real_point.hpp> #include <util/real_point.hpp>
#include <script/scriptable.hpp> #include <script/scriptable.hpp>
// This isn't strictly needed for this file,
// but CardRegion needs to be referenced from _somewhere_ in the codebase for compilation reasons.
// Eventually if somewhere else is using the type then this can be removed.
#include <data/card_region.hpp>
DECLARE_POINTER_TYPE(Game); DECLARE_POINTER_TYPE(Game);
DECLARE_POINTER_TYPE(StyleSheet); DECLARE_POINTER_TYPE(StyleSheet);
DECLARE_POINTER_TYPE(Field); DECLARE_POINTER_TYPE(Field);
DECLARE_POINTER_TYPE(Style); DECLARE_POINTER_TYPE(Style);
DECLARE_POINTER_TYPE(CardRegion);
// ----------------------------------------------------------------------------- : StyleSheet // ----------------------------------------------------------------------------- : StyleSheet
@@ -33,7 +38,8 @@ public:
double card_width; ///< The width of a card in pixels double card_width; ///< The width of a card in pixels
double card_height; ///< The height of a card in pixels double card_height; ///< The height of a card in pixels
double card_dpi; ///< The resolution of a card in dots per inch double card_dpi; ///< The resolution of a card in dots per inch
Color card_background; ///< The background color of cards Color card_background; ///< The background color of cards
vector<CardRegionP> card_regions;
/// The styling for card fields /// The styling for card fields
/** The indices should correspond to the card_fields in the Game */ /** The indices should correspond to the card_fields in the Game */
IndexMap<FieldP, StyleP> card_style; IndexMap<FieldP, StyleP> card_style;