PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/board.h

#
C Header | 98 lines | 31 code | 11 blank | 56 comment | 0 complexity | 5c77963709e31e00c739e372e4da466a MD5 | raw file
Possible License(s): GPL-3.0, MPL-2.0-no-copyleft-exception
  1. /*
  2. * board.h -- header for XBoard: variables shared by xboard.c and board.c
  3. *
  4. * Copyright 1991 by Digital Equipment Corporation, Maynard,
  5. * Massachusetts.
  6. *
  7. * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
  8. * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
  9. *
  10. * The following terms apply to Digital Equipment Corporation's copyright
  11. * interest in XBoard:
  12. * ------------------------------------------------------------------------
  13. * All Rights Reserved
  14. *
  15. * Permission to use, copy, modify, and distribute this software and its
  16. * documentation for any purpose and without fee is hereby granted,
  17. * provided that the above copyright notice appear in all copies and that
  18. * both that copyright notice and this permission notice appear in
  19. * supporting documentation, and that the name of Digital not be
  20. * used in advertising or publicity pertaining to distribution of the
  21. * software without specific, written prior permission.
  22. *
  23. * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  24. * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  25. * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  26. * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  27. * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  28. * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  29. * SOFTWARE.
  30. * ------------------------------------------------------------------------
  31. *
  32. * The following terms apply to the enhanced version of XBoard
  33. * distributed by the Free Software Foundation:
  34. * ------------------------------------------------------------------------
  35. *
  36. * GNU XBoard is free software: you can redistribute it and/or modify
  37. * it under the terms of the GNU General Public License as published by
  38. * the Free Software Foundation, either version 3 of the License, or (at
  39. * your option) any later version.
  40. *
  41. * GNU XBoard is distributed in the hope that it will be useful, but
  42. * WITHOUT ANY WARRANTY; without even the implied warranty of
  43. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  44. * General Public License for more details.
  45. *
  46. * You should have received a copy of the GNU General Public License
  47. * along with this program. If not, see http://www.gnu.org/licenses/. *
  48. *
  49. *------------------------------------------------------------------------
  50. ** See the file ChangeLog for a revision history. */
  51. /* This magic number is the number of intermediate frames used
  52. in each half of the animation. For short moves it's reduced
  53. by 1. The total number of frames will be factor * 2 + 1. */
  54. #define kFactor 4
  55. /* Variables for doing smooth animation. This whole thing
  56. would be much easier if the board was double-buffered,
  57. but that would require a fairly major rewrite. */
  58. #define DISP 4
  59. typedef enum { Game=0, Player, NrOfAnims } AnimNr;
  60. typedef struct {
  61. short int x, y;
  62. } Pnt;
  63. typedef struct {
  64. Pnt startSquare, prevFrame, mouseDelta;
  65. int startColor;
  66. int dragPiece;
  67. Boolean dragActive;
  68. int startBoardX, startBoardY;
  69. } AnimState;
  70. extern AnimState anims[];
  71. void DrawPolygon P((Pnt arrow[], int nr));
  72. void DrawOneSquare P((int x, int y, ChessSquare piece, int square_color, int marker, char *string, int align));
  73. void DrawDot P((int marker, int x, int y, int r));
  74. void DrawGrid P((void));
  75. int SquareColor P((int row, int column));
  76. void ScreenSquare P((int column, int row, Pnt *pt, int *color));
  77. void BoardSquare P((int x, int y, int *column, int *row));
  78. void FrameDelay P((int time));
  79. void InsertPiece P((AnimNr anr, ChessSquare piece));
  80. void DrawBlank P((AnimNr anr, int x, int y, int startColor));
  81. void CopyRectangle P((AnimNr anr, int srcBuf, int destBuf, int srcX, int srcY, int width, int height, int destX, int destY));
  82. void SetDragPiece P((AnimNr anr, ChessSquare piece));
  83. void DragPieceMove P((int x, int y));
  84. void DrawBorder P((int x, int y, int type));
  85. void FlashDelay P((int flash_delay));
  86. void SwitchWindow P((void));
  87. extern int damage[2][BOARD_RANKS][BOARD_FILES];