Checkpoint

This commit is contained in:
Antonio Scandurra 2023-10-03 14:48:08 +02:00
parent dcaf4c905f
commit 12ba10bc2c
6 changed files with 196 additions and 24 deletions

View file

@ -180,14 +180,30 @@ pub trait PlatformTextSystem: Send + Sync {
) -> Vec<usize>;
}
pub trait PlatformSpriteSystem<Key> {
pub trait PlatformAtlas<Key> {
fn get_or_insert_with(
&self,
key: Key,
build: impl FnOnce() -> (Size<DevicePixels>, Vec<u8>),
) -> MonochromeSprite;
) -> AtlasTile;
fn clear(&self);
}
#[derive(Clone, Debug)]
#[repr(C)]
pub struct AtlasTile {
pub(crate) texture_id: AtlasTextureId,
pub(crate) tile_id: TileId,
pub(crate) bounds_in_atlas: Bounds<DevicePixels>,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub(crate) struct AtlasTextureId(pub(crate) usize);
pub(crate) type TileId = etagere::AllocId;
pub trait PlatformInputHandler {
fn selected_text_range(&self) -> Option<Range<usize>>;
fn marked_text_range(&self) -> Option<Range<usize>>;