update(screen): bigger screen
This commit is contained in:
parent
56237065d4
commit
bc546a22c8
1 changed files with 11 additions and 4 deletions
15
src/main.rs
15
src/main.rs
|
@ -23,6 +23,7 @@ use sdl2::pixels::Color;
|
||||||
use sdl2::event::Event;
|
use sdl2::event::Event;
|
||||||
use sdl2::keyboard::Keycode;
|
use sdl2::keyboard::Keycode;
|
||||||
use sdl2::rect::Point;
|
use sdl2::rect::Point;
|
||||||
|
use sdl2::rect::Rect;
|
||||||
|
|
||||||
use machine::HEIGHT;
|
use machine::HEIGHT;
|
||||||
use machine::WIDTH;
|
use machine::WIDTH;
|
||||||
|
@ -48,8 +49,8 @@ fn main() {
|
||||||
|
|
||||||
let sdl_context = sdl2::init().unwrap();
|
let sdl_context = sdl2::init().unwrap();
|
||||||
let video_subsystem = sdl_context.video().unwrap();
|
let video_subsystem = sdl_context.video().unwrap();
|
||||||
let window = video_subsystem.window("Chip8 Emulator", WIDTH as u32, HEIGHT as u32)
|
//let window = video_subsystem.window("Chip8 Emulator", 200 + 11 * WIDTH as u32, 11 * HEIGHT as u32)
|
||||||
//let window = video_subsystem.window("Chip8 Emulator", 100 + 10 * WIDTH as u32, 10 * HEIGHT as u32)
|
let window = video_subsystem.window("Chip8 Emulator", 11 * WIDTH as u32, 11 * HEIGHT as u32)
|
||||||
.position_centered()
|
.position_centered()
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -58,6 +59,10 @@ fn main() {
|
||||||
canvas.set_draw_color(Color::RGB(0, 0, 0));
|
canvas.set_draw_color(Color::RGB(0, 0, 0));
|
||||||
canvas.clear();
|
canvas.clear();
|
||||||
canvas.present();
|
canvas.present();
|
||||||
|
//canvas.set_draw_color(Color::RGB(255, 255, 255));
|
||||||
|
//canvas.draw_line(Point::new(74 + 10 * WIDTH as i32, 0),
|
||||||
|
// Point::new(74 + 10 * WIDTH as i32, 42 + 10 * HEIGHT as i32));
|
||||||
|
canvas.present();
|
||||||
|
|
||||||
let mut event_pump = sdl_context.event_pump().unwrap();
|
let mut event_pump = sdl_context.event_pump().unwrap();
|
||||||
|
|
||||||
|
@ -66,12 +71,14 @@ fn main() {
|
||||||
|
|
||||||
for i in 0..t.display_buffer.len() {
|
for i in 0..t.display_buffer.len() {
|
||||||
for j in 0..t.display_buffer[i].len() {
|
for j in 0..t.display_buffer[i].len() {
|
||||||
|
let ti = i * 10 + i;
|
||||||
|
let tj = j * 10 + j;
|
||||||
if t.display_buffer[i][j] == 1 {
|
if t.display_buffer[i][j] == 1 {
|
||||||
canvas.set_draw_color(Color::RGB(255, 255, 255));
|
canvas.set_draw_color(Color::RGB(255, 255, 255));
|
||||||
canvas.draw_point(Point::new(j as i32, i as i32)).unwrap();
|
canvas.fill_rect(Rect::new(tj as i32, ti as i32, 10, 10)).unwrap();
|
||||||
} else {
|
} else {
|
||||||
canvas.set_draw_color(Color::RGB(0, 0, 0));
|
canvas.set_draw_color(Color::RGB(0, 0, 0));
|
||||||
canvas.draw_point(Point::new(j as i32, i as i32)).unwrap();
|
canvas.fill_rect(Rect::new(tj as i32, ti as i32, 10, 10)).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue