wip window for game framebuffer

This commit is contained in:
2023-12-10 18:38:39 -05:00
parent d13845c193
commit ebfc0ab2e5
4 changed files with 39 additions and 5 deletions

View File

@@ -41,4 +41,10 @@ impl Emulator {
pub fn reset(&mut self) {
self.cpu.reset_vector(&mut self.bus);
}
}
impl Default for Emulator {
fn default() -> Self {
Self::new()
}
}

View File

@@ -1,14 +1,13 @@
use eframe::egui;
use snes_core::emulator::Emulator;
pub mod ui;
fn main() -> eframe::Result<()> {
let native_options = eframe::NativeOptions::default();
eframe::run_native("SNES Emulator", native_options, Box::new(|cc| Box::new(SnesEmulatorApp::new(cc))))
}
#[derive(Default)]
struct SnesEmulatorApp {}
struct SnesEmulatorApp {
emulator: Emulator,
}
impl SnesEmulatorApp {
fn new(_cc: &eframe::CreationContext<'_>) -> Self {
@@ -21,6 +20,16 @@ impl eframe::App for SnesEmulatorApp {
egui::CentralPanel::default().show(ctx, |ui| {
ui::menu::build_menu_bar(ui);
ui.separator();
// ui::game::build_game_window(ctx, ui);
});
}
}
fn main() -> eframe::Result<()> {
let native_options = eframe::NativeOptions::default();
eframe::run_native(
"SNES Emulator",
native_options,
Box::new(|cc| Box::new(SnesEmulatorApp::new(cc))),
)
}

View File

@@ -0,0 +1,18 @@
use eframe::egui;
pub fn build_game_window(ctx: &egui::Context, ui: &mut egui::Ui) {
egui::Window::new("Game").show(ctx, |ui| {
ui.label("Hello World!");
render_framebuffer(ctx, ui, &[]);
});
}
fn render_framebuffer(ctx: &egui::Context, ui: &mut egui::Ui, framebuffer: &[u8]) {
ui.painter().rect_filled(
ctx.available_rect(),
egui::Rounding::ZERO,
egui::Color32::WHITE,
)
}

View File

@@ -1 +1,2 @@
pub mod game;
pub mod menu;