diff --git a/field.h b/field.h index 7b5406e..e37eada 100644 --- a/field.h +++ b/field.h @@ -27,12 +27,3 @@ typedef enum { } Field_load_error; Field_load_error field_load_file(char const* filepath, Field* field); - -inline Glyph gbuffer_peek_relative(Gbuffer gbuffer, Usz height, Usz width, - Usz y, Usz x, Isz delta_y, Isz delta_x) { - Isz y0 = (Isz)y + delta_y; - Isz x0 = (Isz)x + delta_x; - if (y0 < 0 || x0 < 0 || (Usz)y0 >= height || (Usz)x0 >= width) - return '.'; - return gbuffer[(Usz)y0 * width + (Usz)x0]; -} diff --git a/gbuffer.h b/gbuffer.h new file mode 100644 index 0000000..cfcf06f --- /dev/null +++ b/gbuffer.h @@ -0,0 +1,11 @@ +#pragma once +#include "base.h" + +inline Glyph gbuffer_peek_relative(Gbuffer gbuffer, Usz height, Usz width, + Usz y, Usz x, Isz delta_y, Isz delta_x) { + Isz y0 = (Isz)y + delta_y; + Isz x0 = (Isz)x + delta_x; + if (y0 < 0 || x0 < 0 || (Usz)y0 >= height || (Usz)x0 >= width) + return '.'; + return gbuffer[(Usz)y0 * width + (Usz)x0]; +} diff --git a/sim.c b/sim.c index 07a2fa2..d66f894 100644 --- a/sim.c +++ b/sim.c @@ -1,5 +1,6 @@ #include "field.h" #include "mark.h" +#include "gbuffer.h" #include "sim.h" //////// Utilities