Advertisement
loloof64

Egui svg sample pieces_images

Sep 4th, 2022
1,720
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 2.88 KB | None | 0 0
  1. pub(crate) struct PiecesImages {
  2.     pub(crate) wp: egui_extras::RetainedImage,
  3.     pub(crate) wn: egui_extras::RetainedImage,
  4.     pub(crate) wb: egui_extras::RetainedImage,
  5.     pub(crate) wr: egui_extras::RetainedImage,
  6.     pub(crate) wq: egui_extras::RetainedImage,
  7.     pub(crate) wk: egui_extras::RetainedImage,
  8.     pub(crate) bp: egui_extras::RetainedImage,
  9.     pub(crate) bn: egui_extras::RetainedImage,
  10.     pub(crate) bb: egui_extras::RetainedImage,
  11.     pub(crate) br: egui_extras::RetainedImage,
  12.     pub(crate) bq: egui_extras::RetainedImage,
  13.     pub(crate) bk: egui_extras::RetainedImage,
  14. }
  15.  
  16. impl PiecesImages {
  17.     pub(crate) fn new() -> Self {
  18.         let wp = egui_extras::RetainedImage::from_svg_bytes(
  19.             "wp",
  20.             include_bytes!("./vectors/Chess_plt45.svg"),
  21.         )
  22.         .unwrap();
  23.         let wn = egui_extras::RetainedImage::from_svg_bytes(
  24.             "wn",
  25.             include_bytes!("./vectors/Chess_nlt45.svg"),
  26.         )
  27.         .unwrap();
  28.         let wb = egui_extras::RetainedImage::from_svg_bytes(
  29.             "wb",
  30.             include_bytes!("./vectors/Chess_blt45.svg"),
  31.         )
  32.         .unwrap();
  33.         let wr = egui_extras::RetainedImage::from_svg_bytes(
  34.             "wr",
  35.             include_bytes!("./vectors/Chess_rlt45.svg"),
  36.         )
  37.         .unwrap();
  38.         let wq = egui_extras::RetainedImage::from_svg_bytes(
  39.             "wq",
  40.             include_bytes!("./vectors/Chess_qlt45.svg"),
  41.         )
  42.         .unwrap();
  43.         let wk = egui_extras::RetainedImage::from_svg_bytes(
  44.             "wk",
  45.             include_bytes!("./vectors/Chess_klt45.svg"),
  46.         )
  47.         .unwrap();
  48.         let bp = egui_extras::RetainedImage::from_svg_bytes(
  49.             "bp",
  50.             include_bytes!("./vectors/Chess_pdt45.svg"),
  51.         )
  52.         .unwrap();
  53.         let bn = egui_extras::RetainedImage::from_svg_bytes(
  54.             "bn",
  55.             include_bytes!("./vectors/Chess_ndt45.svg"),
  56.         )
  57.         .unwrap();
  58.         let bb = egui_extras::RetainedImage::from_svg_bytes(
  59.             "bb",
  60.             include_bytes!("./vectors/Chess_bdt45.svg"),
  61.         )
  62.         .unwrap();
  63.         let br = egui_extras::RetainedImage::from_svg_bytes(
  64.             "br",
  65.             include_bytes!("./vectors/Chess_rdt45.svg"),
  66.         )
  67.         .unwrap();
  68.         let bq = egui_extras::RetainedImage::from_svg_bytes(
  69.             "bq",
  70.             include_bytes!("./vectors/Chess_qdt45.svg"),
  71.         )
  72.         .unwrap();
  73.         let bk = egui_extras::RetainedImage::from_svg_bytes(
  74.             "bk",
  75.             include_bytes!("./vectors/Chess_kdt45.svg"),
  76.         )
  77.         .unwrap();
  78.  
  79.         Self {
  80.             wp,
  81.             wn,
  82.             wb,
  83.             wr,
  84.             wq,
  85.             wk,
  86.             bp,
  87.             bn,
  88.             bb,
  89.             br,
  90.             bq,
  91.             bk,
  92.         }
  93.     }
  94. }
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement