Add graphics window

This commit is contained in:
Fabien Freling 2015-08-11 23:06:32 +02:00
parent 54def17c26
commit fb5eeed6ba
2 changed files with 18 additions and 14 deletions

View file

@ -1,8 +1,8 @@
open Printf
let rec run (cpu: Cpu.t) (mem: Memory.map) =
let rec run (cpu: Cpu.t) (mem: Memory.map) (screen: Screen.t) =
Cpu.run cpu mem;
run cpu mem
run cpu mem screen
(** Power up sequence
http://bgb.bircd.org/pandocs.htm#powerupsequence *)
@ -16,7 +16,12 @@ let power_up cartridge =
let cpu = Cpu.init_cpu in
let mem = Memory.init cartridge in
run cpu mem
let screen = Screen.init in
Graphics.open_graph "";
Graphics.resize_window Screen.width Screen.height;
run cpu mem screen
let () =

View file

@ -1,14 +1,15 @@
let width = 160
let height = 144
type pixel = {
r : char;
g : char;
b : char;
a : char;
r : int;
g : int;
b : int;
a : int;
}
type t = {
width : int;
height : int;
data : pixel array;
data : pixel array array;
}
type control = {
@ -45,11 +46,9 @@ let get_lcd_control mem =
bg_display;
}
let init_screen w h =
let init =
{
width = w;
height = h;
data = Array.make_matrix h w { r = 255; g = 255; b = 255; a = 255 }
data = Array.make_matrix width height { r = 255; g = 255; b = 255; a = 255 }
}