mvlabat / bevy_egui

This crate provides an Egui integration for the Bevy game engine. 🇺🇦 Please support the Ukrainian army: https://savelife.in.ua/en/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Converting between bevy and egui types

ThomasAlban opened this issue · comments

Is there currently any easy way to convert between Bevy and Egui's types (such as Vec2, Vec3, Pos2, Rect, etc)?
In my code I often find myself needing to do things like this:

let rect = egui::Rect {
  min: Pos2 {
    x: viewport_rect.min.x,
    y: viewport_rect.min.y,
  },
  max: Pos2 {
    x: viewport_rect.max.x,
    y: viewport_rect.max.y,
  },
};

It would be nice if bevy_egui implemented easy ways to convert (if it doesn't already and I'm not missing it!)