/*
 * Filename: shape.h
 * Revision: 19981004
 */

#ifndef _SHAPE_H
#define _SHAPE_H

#include <fstream.h>

#include "cubedata.h"
#include "frame.h"
#include "wireframe.h"

// Value for one rotation on axis
#define X_ROT 0x01
#define Y_ROT 0x04
#define Z_ROT 0x10

// Start bits, each axis occupies 2 bits
#define X_BIT 0
#define Y_BIT 2
#define Z_BIT 4


class shape : public frame
{
public:
	// Constructor
	shape (struct wire_frame *);
	shape ();

	// Destructor
	~shape ();

	// Copy all details from another shape to this shape
	void copy (shape *);
	
	// Set the shape after construction
	void set_shape (struct wire_frame *);

	// Set the shape back to the original
	void reset (void);

	// Shape location manipulation functions
	void shift_left (int);
	void shift_back (int);
	void shift_up (int);
	void shift_right (int);
	void shift_forward (int);
	void shift_down (int);

	// Move the shape to the front bottom right of its frame
	void tidy_up (void);

	// Shape orientation manipulation functions
	void orientate (int);
	void next (void);

	// Print all data concerning this shape
	void status (void);

	// Load the shape
	void load (fstream &);

	// Save the shape
	void save (fstream &);

	// Rotational manipulation functions
	void rotate_x (int);
	void rotate_y (int);
	void rotate_z (int);

public:
	int used;
	int shape_x, shape_y, shape_z;
	int width, height, depth;
	int orientation;
	ROW *original;

private:
	// Shape measurement functions
	int get_width (void);
	int get_height (void);
	int get_depth (void);

	// Tidying functions
	void tidy_x (void);
	void tidy_y (void);
	void tidy_z (void);
};

#endif
