medfall

A super great game engine
Log | Files | Refs

commit 9f7069f632d04362cf2834fb6d3d629f02e9885b
parent f47b1dd02a0c87590d30fe2a7b508cb738db0f1e
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat May 13 15:30:43 +0300

array2d::row

Diffstat:
array.h | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/array.h b/array.h @@ -115,7 +115,7 @@ public: } array2d( array< T > a, size_t width, size_t height ) { - ASSERT( width * height <= a.n ); + ASSERT( width * height == a.n ); elems = a.ptr(); w = width; h = height; @@ -143,6 +143,14 @@ public: return elems; } + array< T > row( size_t row ) { + return array< T >( elems + row * w, w ); + } + + const array< T > row( size_t row ) const { + return array< T >( elems + row * w, w ); + } + size_t num_bytes() const { return sizeof( T ) * w * h; }