Skip to content

Commit eeaf691

Browse files
committed
Quicktypes
1 parent 461037d commit eeaf691

File tree

6 files changed

+115
-6
lines changed

6 files changed

+115
-6
lines changed

docs/quicktype/LdtkJson.cpp

+37
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ namespace quicktype {
809809

810810
private:
811811
bool active;
812+
double alpha;
812813
bool break_on_match;
813814
double chance;
814815
Checker checker;
@@ -845,6 +846,10 @@ namespace quicktype {
845846
bool & get_mutable_active() { return active; }
846847
void set_active(const bool & value) { this->active = value; }
847848

849+
const double & get_alpha() const { return alpha; }
850+
double & get_mutable_alpha() { return alpha; }
851+
void set_alpha(const double & value) { this->alpha = value; }
852+
848853
/**
849854
* When TRUE, the rule will prevent other rules to be applied in the same cell if it matches
850855
* (TRUE by default).
@@ -1137,11 +1142,13 @@ namespace quicktype {
11371142
bool parallax_scaling;
11381143
int64_t px_offset_x;
11391144
int64_t px_offset_y;
1145+
bool render_in_world_view;
11401146
std::vector<std::string> required_tags;
11411147
double tile_pivot_x;
11421148
double tile_pivot_y;
11431149
boost::optional<int64_t> tileset_def_uid;
11441150
Type layer_definition_type;
1151+
boost::optional<std::string> ui_color;
11451152
int64_t uid;
11461153

11471154
public:
@@ -1290,6 +1297,14 @@ namespace quicktype {
12901297
int64_t & get_mutable_px_offset_y() { return px_offset_y; }
12911298
void set_px_offset_y(const int64_t & value) { this->px_offset_y = value; }
12921299

1300+
/**
1301+
* If TRUE, the content of this layer will be used when rendering levels in a simplified way
1302+
* for the world view
1303+
*/
1304+
const bool & get_render_in_world_view() const { return render_in_world_view; }
1305+
bool & get_mutable_render_in_world_view() { return render_in_world_view; }
1306+
void set_render_in_world_view(const bool & value) { this->render_in_world_view = value; }
1307+
12931308
/**
12941309
* An array of tags to filter Entities that can be added to this layer
12951310
*/
@@ -1330,6 +1345,12 @@ namespace quicktype {
13301345
Type & get_mutable_layer_definition_type() { return layer_definition_type; }
13311346
void set_layer_definition_type(const Type & value) { this->layer_definition_type = value; }
13321347

1348+
/**
1349+
* User defined color for the UI
1350+
*/
1351+
boost::optional<std::string> get_ui_color() const { return ui_color; }
1352+
void set_ui_color(boost::optional<std::string> value) { this->ui_color = value; }
1353+
13331354
/**
13341355
* Unique Int identifier
13351356
*/
@@ -1886,13 +1907,21 @@ namespace quicktype {
18861907
virtual ~TileInstance() = default;
18871908

18881909
private:
1910+
double a;
18891911
std::vector<int64_t> d;
18901912
int64_t f;
18911913
std::vector<int64_t> px;
18921914
std::vector<int64_t> src;
18931915
int64_t t;
18941916

18951917
public:
1918+
/**
1919+
* Alpha/opacity of the tile (0-1, defaults to 1)
1920+
*/
1921+
const double & get_a() const { return a; }
1922+
double & get_mutable_a() { return a; }
1923+
void set_a(const double & value) { this->a = value; }
1924+
18961925
/**
18971926
* Internal data used by the editor.<br/> For auto-layer tiles: `[ruleId, coordId]`.<br/>
18981927
* For tile-layer tiles: `[coordId]`.
@@ -3323,6 +3352,7 @@ namespace quicktype {
33233352

33243353
inline void from_json(const json & j, AutoLayerRuleDefinition& x) {
33253354
x.set_active(j.at("active").get<bool>());
3355+
x.set_alpha(j.at("alpha").get<double>());
33263356
x.set_break_on_match(j.at("breakOnMatch").get<bool>());
33273357
x.set_chance(j.at("chance").get<double>());
33283358
x.set_checker(j.at("checker").get<Checker>());
@@ -3355,6 +3385,7 @@ namespace quicktype {
33553385
inline void to_json(json & j, const AutoLayerRuleDefinition & x) {
33563386
j = json::object();
33573387
j["active"] = x.get_active();
3388+
j["alpha"] = x.get_alpha();
33583389
j["breakOnMatch"] = x.get_break_on_match();
33593390
j["chance"] = x.get_chance();
33603391
j["checker"] = x.get_checker();
@@ -3440,11 +3471,13 @@ namespace quicktype {
34403471
x.set_parallax_scaling(j.at("parallaxScaling").get<bool>());
34413472
x.set_px_offset_x(j.at("pxOffsetX").get<int64_t>());
34423473
x.set_px_offset_y(j.at("pxOffsetY").get<int64_t>());
3474+
x.set_render_in_world_view(j.at("renderInWorldView").get<bool>());
34433475
x.set_required_tags(j.at("requiredTags").get<std::vector<std::string>>());
34443476
x.set_tile_pivot_x(j.at("tilePivotX").get<double>());
34453477
x.set_tile_pivot_y(j.at("tilePivotY").get<double>());
34463478
x.set_tileset_def_uid(get_stack_optional<int64_t>(j, "tilesetDefUid"));
34473479
x.set_layer_definition_type(j.at("type").get<Type>());
3480+
x.set_ui_color(get_stack_optional<std::string>(j, "uiColor"));
34483481
x.set_uid(j.at("uid").get<int64_t>());
34493482
}
34503483

@@ -3471,11 +3504,13 @@ namespace quicktype {
34713504
j["parallaxScaling"] = x.get_parallax_scaling();
34723505
j["pxOffsetX"] = x.get_px_offset_x();
34733506
j["pxOffsetY"] = x.get_px_offset_y();
3507+
j["renderInWorldView"] = x.get_render_in_world_view();
34743508
j["requiredTags"] = x.get_required_tags();
34753509
j["tilePivotX"] = x.get_tile_pivot_x();
34763510
j["tilePivotY"] = x.get_tile_pivot_y();
34773511
j["tilesetDefUid"] = x.get_tileset_def_uid();
34783512
j["type"] = x.get_layer_definition_type();
3513+
j["uiColor"] = x.get_ui_color();
34793514
j["uid"] = x.get_uid();
34803515
}
34813516

@@ -3649,6 +3684,7 @@ namespace quicktype {
36493684
}
36503685

36513686
inline void from_json(const json & j, TileInstance& x) {
3687+
x.set_a(j.at("a").get<double>());
36523688
x.set_d(j.at("d").get<std::vector<int64_t>>());
36533689
x.set_f(j.at("f").get<int64_t>());
36543690
x.set_px(j.at("px").get<std::vector<int64_t>>());
@@ -3658,6 +3694,7 @@ namespace quicktype {
36583694

36593695
inline void to_json(json & j, const TileInstance & x) {
36603696
j = json::object();
3697+
j["a"] = x.get_a();
36613698
j["d"] = x.get_d();
36623699
j["f"] = x.get_f();
36633700
j["px"] = x.get_px();

docs/quicktype/LdtkJson.cs

+22
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,13 @@ public partial class LayerDefinition
932932
[JsonProperty("pxOffsetY")]
933933
public long PxOffsetY { get; set; }
934934

935+
/// <summary>
936+
/// If TRUE, the content of this layer will be used when rendering levels in a simplified way
937+
/// for the world view
938+
/// </summary>
939+
[JsonProperty("renderInWorldView")]
940+
public bool RenderInWorldView { get; set; }
941+
935942
/// <summary>
936943
/// An array of tags to filter Entities that can be added to this layer
937944
/// </summary>
@@ -968,6 +975,12 @@ public partial class LayerDefinition
968975
[JsonProperty("type")]
969976
public TypeEnum LayerDefinitionType { get; set; }
970977

978+
/// <summary>
979+
/// User defined color for the UI
980+
/// </summary>
981+
[JsonProperty("uiColor")]
982+
public string UiColor { get; set; }
983+
971984
/// <summary>
972985
/// Unique Int identifier
973986
/// </summary>
@@ -1015,6 +1028,9 @@ public partial class AutoLayerRuleDefinition
10151028
[JsonProperty("active")]
10161029
public bool Active { get; set; }
10171030

1031+
[JsonProperty("alpha")]
1032+
public double Alpha { get; set; }
1033+
10181034
/// <summary>
10191035
/// When TRUE, the rule will prevent other rules to be applied in the same cell if it matches
10201036
/// (TRUE by default).
@@ -1766,6 +1782,12 @@ public partial class LayerInstance
17661782
/// </summary>
17671783
public partial class TileInstance
17681784
{
1785+
/// <summary>
1786+
/// Alpha/opacity of the tile (0-1, defaults to 1)
1787+
/// </summary>
1788+
[JsonProperty("a")]
1789+
public double A { get; set; }
1790+
17691791
/// <summary>
17701792
/// Internal data used by the editor.<br/> For auto-layer tiles: `[ruleId, coordId]`.<br/>
17711793
/// For tile-layer tiles: `[coordId]`.

docs/quicktype/LdtkJson.go

+8
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ type LayerDefinition struct {
396396
// Y offset of the layer, in pixels (IMPORTANT: this should be added to the `LayerInstance`
397397
// optional offset)
398398
PxOffsetY int64 `json:"pxOffsetY"`
399+
// If TRUE, the content of this layer will be used when rendering levels in a simplified way
400+
// for the world view
401+
RenderInWorldView bool `json:"renderInWorldView"`
399402
// An array of tags to filter Entities that can be added to this layer
400403
RequiredTags []string `json:"requiredTags"`
401404
// If the tiles are smaller or larger than the layer grid, the pivot value will be used to
@@ -412,6 +415,8 @@ type LayerDefinition struct {
412415
// Type of the layer as Haxe Enum Possible values: `IntGrid`, `Entities`, `Tiles`,
413416
// `AutoLayer`
414417
LayerDefinitionType Type `json:"type"`
418+
// User defined color for the UI
419+
UIColor *string `json:"uiColor"`
415420
// Unique Int identifier
416421
Uid int64 `json:"uid"`
417422
}
@@ -433,6 +438,7 @@ type AutoLayerRuleGroup struct {
433438
type AutoLayerRuleDefinition struct {
434439
// If FALSE, the rule effect isn't applied, and no tiles are generated.
435440
Active bool `json:"active"`
441+
Alpha float64 `json:"alpha"`
436442
// When TRUE, the rule will prevent other rules to be applied in the same cell if it matches
437443
// (TRUE by default).
438444
BreakOnMatch bool `json:"breakOnMatch"`
@@ -732,6 +738,8 @@ type LayerInstance struct {
732738

733739
// This structure represents a single tile from a given Tileset.
734740
type TileInstance struct {
741+
// Alpha/opacity of the tile (0-1, defaults to 1)
742+
A float64 `json:"a"`
735743
// Internal data used by the editor.<br/> For auto-layer tiles: `[ruleId, coordId]`.<br/>
736744
// For tile-layer tiles: `[coordId]`.
737745
D []int64 `json:"d"`

docs/quicktype/LdtkJson.js

+4
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ const typeMap = {
247247
], false),
248248
"AutoLayerRuleDefinition": o([
249249
{ json: "active", js: "active", typ: true },
250+
{ json: "alpha", js: "alpha", typ: 3.14 },
250251
{ json: "breakOnMatch", js: "breakOnMatch", typ: true },
251252
{ json: "chance", js: "chance", typ: 3.14 },
252253
{ json: "checker", js: "checker", typ: r("Checker") },
@@ -396,11 +397,13 @@ const typeMap = {
396397
{ json: "parallaxScaling", js: "parallaxScaling", typ: true },
397398
{ json: "pxOffsetX", js: "pxOffsetX", typ: 0 },
398399
{ json: "pxOffsetY", js: "pxOffsetY", typ: 0 },
400+
{ json: "renderInWorldView", js: "renderInWorldView", typ: true },
399401
{ json: "requiredTags", js: "requiredTags", typ: a("") },
400402
{ json: "tilePivotX", js: "tilePivotX", typ: 3.14 },
401403
{ json: "tilePivotY", js: "tilePivotY", typ: 3.14 },
402404
{ json: "tilesetDefUid", js: "tilesetDefUid", typ: u(undefined, u(0, null)) },
403405
{ json: "type", js: "type", typ: r("Type") },
406+
{ json: "uiColor", js: "uiColor", typ: u(undefined, u(null, "")) },
404407
{ json: "uid", js: "uid", typ: 0 },
405408
], false),
406409
"IntGridValueDefinition": o([
@@ -498,6 +501,7 @@ const typeMap = {
498501
{ json: "visible", js: "visible", typ: true },
499502
], false),
500503
"TileInstance": o([
504+
{ json: "a", js: "a", typ: 3.14 },
501505
{ json: "d", js: "d", typ: a(0) },
502506
{ json: "f", js: "f", typ: 0 },
503507
{ json: "px", js: "px", typ: a(0) },

0 commit comments

Comments
 (0)