mirror of
https://github.com/kirjavascript/trueLMAO.git
synced 2024-06-02 19:47:21 -04:00
window rendering alternatives
This commit is contained in:
parent
783376e11e
commit
065a91be5c
|
@ -20,8 +20,8 @@ pub enum Update {
|
|||
|
||||
fn main() {
|
||||
let app = app::App::default();
|
||||
// let buf: Vec<u8> = include_bytes!("./roms/Window Test by Fonzie (PD).bin").to_vec();
|
||||
let buf: Vec<u8> = include_bytes!("/home/cake/sonic/roms/sspin.bin").to_vec();
|
||||
let buf: Vec<u8> = include_bytes!("./roms/Window Test by Fonzie (PD).bin").to_vec();
|
||||
// let buf: Vec<u8> = include_bytes!("/home/cake/sonic/roms/sspin.bin").to_vec();
|
||||
|
||||
let mut emu = Megadrive::new(buf);
|
||||
|
||||
|
|
|
@ -158,8 +158,6 @@ impl Gfx {
|
|||
|
||||
// do priority last, split up works
|
||||
|
||||
let vram = &emu.core.mem.vdp.VRAM;
|
||||
|
||||
// draw TO left, TO top
|
||||
|
||||
if window_left && window_top && screen_y < window_y * 8 {
|
||||
|
@ -184,48 +182,83 @@ impl Gfx {
|
|||
let hflip = (byte & 0x8) != 0;
|
||||
let palette = (byte & 0x60) >> 5;
|
||||
|
||||
let flip = |cursor| if hflip { cursor ^ 7 } else { cursor };
|
||||
|
||||
let draw = |screen: &mut Screen, screen_x, (r, g, b)| {
|
||||
let screen_offset = (screen_x + (screen_y * screen_width)) * 3;
|
||||
screen[screen_offset] = r;
|
||||
screen[screen_offset + 1] = g;
|
||||
screen[screen_offset + 2] = b;
|
||||
};
|
||||
|
||||
let x = n * 8;
|
||||
let y = screen_y & 7;
|
||||
let y = if vflip { y ^ 7 } else { y };
|
||||
let index = (tile * 32) + (y * 4);
|
||||
|
||||
let line = &vram[index..index+4];
|
||||
|
||||
let mut cursor = 0;
|
||||
for duxel in line {
|
||||
let px = duxel >> 4;
|
||||
//
|
||||
|
||||
for cursor in 0..8 {
|
||||
let duxel = emu.core.mem.vdp.VRAM[index + (cursor / 2)];
|
||||
let px = if cursor & 1 != 0 { duxel & 0xF } else { duxel >> 4 };
|
||||
|
||||
if px != 0 {
|
||||
draw(
|
||||
&mut emu.gfx.screen,
|
||||
flip(cursor) + x,
|
||||
emu.core.mem.vdp.color(palette, px as usize)
|
||||
);
|
||||
let screen_x = if hflip { cursor ^ 7 } else { cursor } + x;
|
||||
let (r, g, b) = emu.core.mem.vdp.color(palette, px as usize);
|
||||
let screen_offset = (screen_x + (screen_y * screen_width)) * 3;
|
||||
emu.gfx.screen[screen_offset] = r;
|
||||
emu.gfx.screen[screen_offset + 1] = g;
|
||||
emu.gfx.screen[screen_offset + 2] = b;
|
||||
}
|
||||
cursor += 1;
|
||||
let px = duxel & 0xF;
|
||||
if px != 0 {
|
||||
draw(
|
||||
&mut emu.gfx.screen,
|
||||
flip(cursor) + x,
|
||||
emu.core.mem.vdp.color(palette, px as usize)
|
||||
);
|
||||
}
|
||||
cursor += 1;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
// let line = &emu.core.mem.vdp.VRAM[index..index+4];
|
||||
|
||||
// let mut cursor = 0;
|
||||
// for i in 0..4 {
|
||||
// let duxel = emu.core.mem.vdp.VRAM[index+i];
|
||||
// let px = duxel >> 4;
|
||||
// if px != 0 {
|
||||
// let screen_x = if hflip { cursor ^ 7 } else { cursor } + x;
|
||||
// let (r, g, b) = emu.core.mem.vdp.color(palette, px as usize);
|
||||
// let screen_offset = (screen_x + (screen_y * screen_width)) * 3;
|
||||
// emu.gfx.screen[screen_offset] = r;
|
||||
// emu.gfx.screen[screen_offset + 1] = g;
|
||||
// emu.gfx.screen[screen_offset + 2] = b;
|
||||
// }
|
||||
// cursor += 1;
|
||||
// let px = duxel & 0xF;
|
||||
// if px != 0 {
|
||||
// let screen_x = if hflip { cursor ^ 7 } else { cursor } + x;
|
||||
// let (r, g, b) = emu.core.mem.vdp.color(palette, px as usize);
|
||||
// let screen_offset = (screen_x + (screen_y * screen_width)) * 3;
|
||||
// emu.gfx.screen[screen_offset] = r;
|
||||
// emu.gfx.screen[screen_offset + 1] = g;
|
||||
// emu.gfx.screen[screen_offset + 2] = b;
|
||||
// }
|
||||
// cursor += 1;
|
||||
// }
|
||||
|
||||
|
||||
//
|
||||
|
||||
// let y = screen_y & 7;
|
||||
// for x in 0..8 { // TODO: 0..4
|
||||
// let screen_x = x + (n * 8);
|
||||
|
||||
// let px = &emu.core.mem.vdp.VRAM[(tile * 32) + (y*4) + (x>>1)];
|
||||
// let px = if x & 1 == 0 { px >> 4 } else { px & 0xF };
|
||||
|
||||
// if px != 0 {
|
||||
// let (r, g, b) = emu.core.mem.vdp.color(palette, px as _);
|
||||
|
||||
// let screen_offset = (screen_x + (screen_y * screen_width)) * 3;
|
||||
|
||||
// emu.gfx.screen[screen_offset] = r;
|
||||
// emu.gfx.screen[screen_offset + 1] = g;
|
||||
// emu.gfx.screen[screen_offset + 2] = b;
|
||||
// }
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
println!("{:?}", (window_left, window_top, window_x, window_y, nametable));
|
||||
// println!("{:?}", (window_left, window_top, window_x, window_y, nametable));
|
||||
// let width = ;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue