summaryrefslogtreecommitdiffstats
path: root/kblackbox/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'kblackbox/util.h')
-rw-r--r--kblackbox/util.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/kblackbox/util.h b/kblackbox/util.h
new file mode 100644
index 00000000..9effb880
--- /dev/null
+++ b/kblackbox/util.h
@@ -0,0 +1,42 @@
+//
+//
+// KBlackBox
+//
+// A simple game inspired by an emacs module
+//
+// File: util.h
+//
+// The definition of the RectOnArray class
+//
+
+#ifndef UTIL_H
+#define UTIL_H
+
+/*
+ This is used for gameBoard and graphicBoard fields
+*/
+
+#define ArrayType int
+
+class RectOnArray
+{
+public:
+ RectOnArray( int w, int h );
+ ~RectOnArray();
+
+ int get( int col, int row );
+ void set( int col, int row, ArrayType type );
+ void fill( ArrayType type );
+
+ int width();
+ int height();
+
+private:
+ int indexOf( int col, int row ) const;
+
+ int w;
+ int h;
+ ArrayType *array;
+};
+
+#endif // UTIL_H