81 lines
3.2 KiB
Rust
81 lines
3.2 KiB
Rust
use crate::color::Color;
|
|
use crate::scene_viewport_cache::SceneViewportCache;
|
|
use crate::scene_viewport_resolver::ResolverUpdate;
|
|
use crate::sprite::Sprite;
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
pub enum BlendMode {
|
|
None,
|
|
Half,
|
|
HalfPlus,
|
|
HalfMinus,
|
|
Full,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
#[repr(i32)]
|
|
pub enum GfxOpStatus {
|
|
Ok = 0,
|
|
AssetNotFound = 1,
|
|
InvalidSpriteIndex = 2,
|
|
ArgRangeInvalid = 3,
|
|
BankInvalid = 4,
|
|
}
|
|
|
|
pub trait GfxBridge {
|
|
fn size(&self) -> (usize, usize);
|
|
fn front_buffer(&self) -> &[u16];
|
|
fn clear(&mut self, color: Color);
|
|
fn fill_rect_blend(&mut self, x: i32, y: i32, w: i32, h: i32, color: Color, mode: BlendMode);
|
|
fn fill_rect(&mut self, x: i32, y: i32, w: i32, h: i32, color: Color);
|
|
fn draw_pixel(&mut self, x: i32, y: i32, color: Color);
|
|
fn draw_line(&mut self, x0: i32, y0: i32, x1: i32, y1: i32, color: Color);
|
|
fn draw_circle(&mut self, xc: i32, yc: i32, r: i32, color: Color);
|
|
fn draw_circle_points(&mut self, xc: i32, yc: i32, x: i32, y: i32, color: Color);
|
|
fn fill_circle(&mut self, xc: i32, yc: i32, r: i32, color: Color);
|
|
fn draw_circle_lines(&mut self, xc: i32, yc: i32, x: i32, y: i32, color: Color);
|
|
fn draw_disc(&mut self, x: i32, y: i32, r: i32, border_color: Color, fill_color: Color);
|
|
fn draw_rect(&mut self, x: i32, y: i32, w: i32, h: i32, color: Color);
|
|
fn draw_square(
|
|
&mut self,
|
|
x: i32,
|
|
y: i32,
|
|
w: i32,
|
|
h: i32,
|
|
border_color: Color,
|
|
fill_color: Color,
|
|
);
|
|
fn draw_horizontal_line(&mut self, x0: i32, x1: i32, y: i32, color: Color);
|
|
fn draw_vertical_line(&mut self, x: i32, y0: i32, y1: i32, color: Color);
|
|
fn present(&mut self);
|
|
/// Render the canonical game frame with no bound scene.
|
|
///
|
|
/// Deferred `gfx.*` overlay/debug primitives are intentionally outside this
|
|
/// contract and are drained by a separate final overlay stage.
|
|
fn render_no_scene_frame(&mut self);
|
|
/// Render the canonical scene-backed game frame from cache/resolver state.
|
|
///
|
|
/// Deferred `gfx.*` overlay/debug primitives are intentionally outside this
|
|
/// contract and are drained by a separate final overlay stage.
|
|
fn render_scene_from_cache(&mut self, cache: &SceneViewportCache, update: &ResolverUpdate);
|
|
fn load_frame_sprites(&mut self, sprites: &[Sprite]);
|
|
/// Submit text into the `gfx.*` primitive path.
|
|
///
|
|
/// Under the accepted runtime contract this is not the canonical game
|
|
/// composition path; it belongs to the deferred final overlay/debug family.
|
|
fn draw_text(&mut self, x: i32, y: i32, text: &str, color: Color);
|
|
fn draw_char(&mut self, x: i32, y: i32, c: char, color: Color);
|
|
|
|
fn sprite(&self, index: usize) -> &Sprite;
|
|
fn sprite_mut(&mut self, index: usize) -> &mut Sprite;
|
|
|
|
fn scene_fade_level(&self) -> u8;
|
|
fn set_scene_fade_level(&mut self, level: u8);
|
|
fn scene_fade_color(&self) -> Color;
|
|
fn set_scene_fade_color(&mut self, color: Color);
|
|
fn hud_fade_level(&self) -> u8;
|
|
fn set_hud_fade_level(&mut self, level: u8);
|
|
fn hud_fade_color(&self) -> Color;
|
|
fn set_hud_fade_color(&mut self, color: Color);
|
|
}
|