mirror of
https://github.com/FranLMSP/snes.git
synced 2026-08-03 08:30:01 -04:00
wip window for game framebuffer
This commit is contained in:
@@ -41,4 +41,10 @@ impl Emulator {
|
|||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
self.cpu.reset_vector(&mut self.bus);
|
self.cpu.reset_vector(&mut self.bus);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Emulator {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
use eframe::egui;
|
use eframe::egui;
|
||||||
|
use snes_core::emulator::Emulator;
|
||||||
|
|
||||||
pub mod ui;
|
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)]
|
#[derive(Default)]
|
||||||
struct SnesEmulatorApp {}
|
struct SnesEmulatorApp {
|
||||||
|
emulator: Emulator,
|
||||||
|
}
|
||||||
|
|
||||||
impl SnesEmulatorApp {
|
impl SnesEmulatorApp {
|
||||||
fn new(_cc: &eframe::CreationContext<'_>) -> Self {
|
fn new(_cc: &eframe::CreationContext<'_>) -> Self {
|
||||||
@@ -21,6 +20,16 @@ impl eframe::App for SnesEmulatorApp {
|
|||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
ui::menu::build_menu_bar(ui);
|
ui::menu::build_menu_bar(ui);
|
||||||
ui.separator();
|
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))),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
|
pub mod game;
|
||||||
pub mod menu;
|
pub mod menu;
|
||||||
|
|||||||
Reference in New Issue
Block a user