/* ------------------------------------------------------------------
 * GEM - Graphics Environment for Multimedia
 *
 * SPDX-FileCopyrightText: © 2001, IOhannes m zmölnig and the GEM contributors
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * ------------------------------------------------------------------
 */

/*-----------------------------------------------------------------

    play puzzle with a sequence of pixBufs

-----------------------------------------------------------------*/

#ifndef _INCLUDE__GEM_PIXES_PIX_PUZZLE_H_
#define _INCLUDE__GEM_PIXES_PIX_PUZZLE_H_

#include "Base/GemPixObj.h"

/*-----------------------------------------------------------------
  -------------------------------------------------------------------
  CLASS
  pix_puzzle

  shuffle areas of the pixBuf

  KEYWORDS
  pix

  DESCRIPTION

  -----------------------------------------------------------------*/
class GEM_EXTERN pix_puzzle : public GemPixObj
{
  CPPEXTERN_HEADER(pix_puzzle, GemPixObj);

public:

  //////////
  // Constructor
  pix_puzzle();

protected:

  //////////
  // Destructor
  virtual ~pix_puzzle();

  //////////
  // Do the processing
  virtual void  processImage(imageStruct &image);
  virtual void processYUVImage(imageStruct &image);

  imageStruct    myImage;

  //////////
  // Make a puzzle
  virtual void  makePuzzleBlocks(int xsize, int ysize, int csize);
  virtual void  shuffle();
  virtual void  sizeMess(int width, int height);
  virtual void  moveMess(int direction);

  int blockxsize,blockysize,  blocknum, spacepos;
  int blockw, blockh;
  int *blockpos;
  int *blockoffset;
  int marginw, marginh;

  int m_force;

  //////////
  // anyone wants to play the famous puzzle game ?
  int m_game;

private:

  //////////
  // static member functions
  static void bangMessCallback(void *data);
  static void sizeMessCallback(void *data, t_float width, t_float height);
  static void moveMessCallback(void *data, t_float state);
};

#endif  // for header file
