ref: 76e8e65e138813df02f5f60d16af3e92b64a018b
parent: 56ea948871184712b0bc43fb2d0816eaf24524d6
author: cancel <cancel@cancel.fm>
date: Mon Nov 26 07:33:56 EST 2018
Add gbuffer.h
--- a/field.h
+++ b/field.h
@@ -27,12 +27,3 @@
} 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];
-}
--- /dev/null
+++ b/gbuffer.h
@@ -1,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];
+}
--- a/sim.c
+++ b/sim.c
@@ -1,5 +1,6 @@
#include "field.h"
#include "mark.h"
+#include "gbuffer.h"
#include "sim.h"
//////// Utilities