Commit fb5eeed6 authored by Fabien Freling's avatar Fabien Freling

Add graphics window

parent 54def17c
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 () =
......
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 }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment