implements PLN-0081 shell hub packet migration
This commit is contained in:
@@ -5,7 +5,7 @@ use prometeu_hal::glyph_bank::GlyphBank;
|
||||
use prometeu_hal::scene_viewport_cache::{CachedTileEntry, SceneViewportCache};
|
||||
use prometeu_hal::scene_viewport_resolver::{LayerCopyRequest, ResolverUpdate};
|
||||
use prometeu_hal::sprite::Sprite;
|
||||
use prometeu_hal::{Game2DFramePacket, Gfx2dCommand, GfxBridge};
|
||||
use prometeu_hal::{Game2DFramePacket, Gfx2dCommand, GfxBridge, GfxUiCommand, ShellUiFramePacket};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Blending modes inspired by classic 16-bit hardware.
|
||||
@@ -714,6 +714,12 @@ impl Gfx {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_shell_ui_frame_packet(&mut self, packet: &ShellUiFramePacket) {
|
||||
for command in &packet.commands {
|
||||
self.apply_gfxui_command(command);
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_gfx2d_command(&mut self, command: &Gfx2dCommand) {
|
||||
match command {
|
||||
Gfx2dCommand::Clear { color } => self.clear(*color),
|
||||
@@ -738,6 +744,30 @@ impl Gfx {
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_gfxui_command(&mut self, command: &GfxUiCommand) {
|
||||
match command {
|
||||
GfxUiCommand::Clear { color } => self.clear(*color),
|
||||
GfxUiCommand::FillRect { rect, color } => {
|
||||
self.fill_rect(rect.x, rect.y, rect.w, rect.h, *color);
|
||||
}
|
||||
GfxUiCommand::DrawLine { x0, y0, x1, y1, color } => {
|
||||
self.draw_line(*x0, *y0, *x1, *y1, *color);
|
||||
}
|
||||
GfxUiCommand::DrawCircle { x, y, radius, color } => {
|
||||
self.draw_circle(*x, *y, *radius, *color);
|
||||
}
|
||||
GfxUiCommand::DrawDisc { x, y, radius, border_color, fill_color } => {
|
||||
self.draw_disc(*x, *y, *radius, *border_color, *fill_color);
|
||||
}
|
||||
GfxUiCommand::DrawSquare { rect, border_color, fill_color } => {
|
||||
self.draw_square(rect.x, rect.y, rect.w, rect.h, *border_color, *fill_color);
|
||||
}
|
||||
GfxUiCommand::DrawText { x, y, text, color } => {
|
||||
self.draw_text(*x, *y, text, *color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn populate_layer_buckets(&mut self) {
|
||||
for bucket in self.layer_buckets.iter_mut() {
|
||||
bucket.clear();
|
||||
|
||||
Reference in New Issue
Block a user