We're going to add a method...
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
// - can have a back face which is less manipulable (if image has 2 faces)
use crate::prelude::*;
+use crate::*; // to get ambassador_impls, macro resolution trouble
const QTY_FONT_SIZE: f64 = 6.;
}
}
-#[dyn_upcast]
-impl OutlineTrait for Banknote {
- delegate!{
- to self.image {
- fn outline_path(&self, scale: f64) -> Result<Html, IE>;
- fn thresh_dragraise(&self) -> Result<Option<Coord>, IE>;
- fn bbox_approx(&self) -> Result<Rect, IE>;
- }
- }
+impl_via_ambassador!{
+ #[dyn_upcast]
+ impl OutlineTrait for Banknote { image }
}
#[dyn_upcast]
// There is NO WARRANTY.
use crate::prelude::*;
+use crate::*; // to get ambassador_impls, macro resolution trouble
pub const CORE_DESC : HtmlLit = Html::lit("a play/pickup deck");
pub const DISABLED_DESC: HtmlLit = Html::lit("a play/pickup deck (disabled)");
}
use State::*;
-#[dyn_upcast]
-impl OutlineTrait for Deck {
- delegate!{
- to self.shape {
- fn outline_path(&self, scale: f64) -> Result<Html,IE>;
- fn thresh_dragraise(&self) -> Result<Option<Coord>,IE>;
- fn bbox_approx(&self) -> Result<Rect, IE>;
- }
- }
+impl_via_ambassador!{
+ #[dyn_upcast]
+ impl OutlineTrait for Deck { shape }
}
#[typetag::serde(name="PickupDeck")]
// There is NO WARRANTY.
use crate::prelude::*;
+use crate::*; // to get ambassador_impls, macro resolution trouble
pub const UNCLAIMED_HAND_DESC: &str = "a hand repository";
fn dummy() -> Self { default() }
}
-#[dyn_upcast]
-impl OutlineTrait for Hand {
- delegate!{
- to self.shape {
- fn outline_path(&self, scale: f64) -> Result<Html,IE>;
- fn thresh_dragraise(&self) -> Result<Option<Coord>,IE>;
- fn bbox_approx(&self) -> Result<Rect, IE>;
- }
- }
+impl_via_ambassador!{
+ #[dyn_upcast]
+ impl OutlineTrait for Hand { shape }
}
impl piece_specs::OwnedCommon {
// pieces
use crate::prelude::*;
+use crate::*; // to get ambassador_impls, macro resolution trouble
use piece_specs::SimpleCommon;
// There is NO WARRANTY.
use crate::prelude::*;
+use crate::*; // to get ambassador_impls, macro resolution trouble
pub use crate::shapelib_toml::*;
pub use crate::prelude::GoodItemName; // not sure why this is needed
//==================== impls for ItemInertForOcculted ====================
-#[dyn_upcast]
-impl OutlineTrait for ItemInertForOcculted { delegate! { to self.outline {
- fn outline_path(&self, scale: f64) -> Result<Html, IE>;
- fn thresh_dragraise(&self) -> Result<Option<Coord>, IE>;
- fn bbox_approx(&self) -> Result<Rect, IE>;
-}}}
+impl_via_ambassador!{
+ #[dyn_upcast]
+ impl OutlineTrait for ItemInertForOcculted { outline }
+}
#[dyn_upcast]
impl PieceBaseTrait for ItemInertForOcculted {
fn nfaces(&self) -> RawFaceId { 1 }
//==================== Item ====================
-#[dyn_upcast]
-impl OutlineTrait for Item { delegate! { to self.outline {
- fn outline_path(&self, scale: f64) -> Result<Html, IE>;
- fn thresh_dragraise(&self) -> Result<Option<Coord>, IE>;
- fn bbox_approx(&self) -> Result<Rect, IE>;
-}}}
+impl_via_ambassador!{
+ #[dyn_upcast]
+ impl OutlineTrait for Item { outline }
+}
impl Item {
#[throws(IE)]