summaryrefslogtreecommitdiffstats
path: root/kblackbox/util.h
blob: 9effb88051e988e3016e3cf318764bc8a53d1d64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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