summaryrefslogblamecommitdiff
path: root/src/lowlevel/objects.draft.rs
blob: 9416e27b1356170883c130db010d550bbbaa7aeb (plain) (tree)



























































































                                                                                                                                                                                                 
enum TextHAlign {
    Left,
    Center,
    Right,
    Justify,
}

impl Default for TextHAlign {
    fn default() -> Self {
        TextHAlign::Left
    }
}

enum TextVAlign {
    Top,
    Center,
    Bottom,
}

impl Default for TextVAlign {
    fn default() -> Self {
        TextVAlign::Top
    }
}

enum Object {
    Tile {
        gid: usize,
    },
    Ellipse,
    Point,
    Polygon {
        points: Vec<(i64, i64)>,
    },
    Polyline {
        points: Vec<(i64, i64)>,
    },
    Text {
        /// The font family used (defaults to “sans-serif”)
        fonfamily: String,
        /// The size of the font in pixels (not using points, because other sizes in the TMX format are also using pixels) (defaults to 16)
        pixelsize: u32,

        /// Whether word wrapping is enabled (1) or disabled (0). (defaults to 0)
        wrap: bool,

        /// Color of the text in #AARRGGBB or #RRGGBB format (defaults to #000000)
        color: rgb::RGBA8,

        /// Whether the font is bold (1) or not (0). (defaults to 0)
        bold: bool,
        /// Whether the font is italic (1) or not (0). (defaults to 0)
        italic: bool,
        /// Whether a line should be drawn below the text (1) or not (0). (defaults to 0)
        underline: bool,
        /// Whether a line should be drawn through the text (1) or not (0). (defaults to 0)
        strikeout: bool,
        /// Whether kerning should be used while rendering the text (1) or not (0). (defaults to 1)
        kerning: bool,

        /// Horizontal alignment of the text within the object ( left, center, right or justify, defaults to left) (since Tiled 1.2.1)
        halign: TextHAlign,
        /// Vertical alignment of the text within the object ( top, center or bottom, defaults to top)
        valign: TextVAlign,
    },
}

struct BaseObject {
    object: Object,
    /// Unique ID of the object. Each object that is placed on a map gets a unique id. Even if an object was deleted, no object gets the same ID. Can not be changed in Tiled. (since Tiled 0.11)
    id: usize,
    /// The name of the object. An arbitrary string. (defaults to “”)
    name: String,
    /// The type of the object. An arbitrary string. (defaults to “”)
    r#type: String,
    /// The x coordinate of the object in pixels. (defaults to 0)
    x: u64,
    /// The y coordinate of the object in pixels. (defaults to 0)
    y: u64,
    /// The width of the object in pixels. (defaults to 0)
    width: u64,
    /// The height of the object in pixels. (defaults to 0)
    height: u64,
    /// The rota�on of the object in degrees clockwise around (x, y). (defaults to 0)
    rotation: ?,
    /// Whether the object is shown (1) or hidden (0). (defaults to 1)
    visible: bool,
    /// A reference to a template file. (op�onal)
    template: Option<String>
}

// todo ask in tiled discord if representation is ok