diff options
author | Julien Dessaux | 2021-09-21 00:27:57 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-09-21 00:27:57 +0200 |
commit | 309dcb5a029d9b40c72fa8bc01a3009389b66e8e (patch) | |
tree | 21d3456847ec32c8219c3b7d935f6c3cec5d5058 /pkg/pointer/storage-offset.go | |
parent | Began implementing the Instruction Pointer (diff) | |
download | gofunge98-309dcb5a029d9b40c72fa8bc01a3009389b66e8e.tar.gz gofunge98-309dcb5a029d9b40c72fa8bc01a3009389b66e8e.tar.bz2 gofunge98-309dcb5a029d9b40c72fa8bc01a3009389b66e8e.zip |
Continued implementing the Instruction Pointer
Diffstat (limited to 'pkg/pointer/storage-offset.go')
-rw-r--r-- | pkg/pointer/storage-offset.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/pointer/storage-offset.go b/pkg/pointer/storage-offset.go new file mode 100644 index 0000000..0fcd9ed --- /dev/null +++ b/pkg/pointer/storage-offset.go @@ -0,0 +1,13 @@ +package pointer + +func (p Pointer) GetStorageOffset() (x, y int) { + return p.sox, p.soy +} + +func (p *Pointer) CalculateNewStorageOffset() { + p.sox, p.soy = p.x+p.delta.x, p.y+p.delta.y +} + +func (p *Pointer) SetStorageOffset(x, y int) { + p.sox, p.soy = x, y +} |