1 /****************************************************************************** 2 * AnimateEventResign - Run the resign animation. 3 * $Id$ 4 * 5 * BuckoFIBS - Backgammon by BuckoSoft 6 * Copyright© 2011 - Dick Balaska - BuckoSoft, Corp. 7 * 8 * $Log$ 9 * Revision 1.2 2011/06/05 06:58:24 dick 10 * Deadwood delete. 11 * 12 * Revision 1.1 2011/06/02 19:14:56 dick 13 * Run the resign animation. 14 * 15 */ 16 17 /* 18 * This program is free software: you can redistribute it and/or modify 19 * it under the terms of the GNU General Public License as published by 20 * the Free Software Foundation, either version 3 of the License, or 21 * (at your option) any later version. 22 * 23 * This program is distributed in the hope that it will be useful, 24 * but WITHOUT ANY WARRANTY; without even the implied warranty of 25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 * GNU General Public License for more details. 27 * 28 * You should have received a copy of the GNU General Public License 29 * along with this program. If not, see <http://www.gnu.org/licenses/>. 30 * 31 * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>. 32 * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp. 33 * 34 */ 35 package com.buckosoft.fibs.BuckoFIBS.gui.boardTab.boardPane; 36 37 import javax.swing.ImageIcon; 38 39 40 /** Run the resign animation 41 * @author Dick Balaska 42 * @since 2011/06/01 43 * @version $Revision$ <br> $Date$ 44 * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/main/java/com/buckosoft/fibs/BuckoFIBS/gui/boardTab/boardPane/AnimateEventResign.java">cvs AnimateEventResign.java</a> 45 */ 46 public class AnimateEventResign extends AnimateEvent { 47 public final static int X = 0; 48 public final static int Y = 1; 49 public final static int WIDTH = 2; 50 public final static int HEIGHT = 3; 51 52 private int[] pos = new int[4]; 53 private ImageIcon imageIcon; 54 55 // size of the original icon 56 private final static int flagWidth = 366; 57 private final static int flagHeight = 353; 58 59 private int resigningPoints; 60 61 62 @Override 63 public int getDuration() { 64 return 1500; 65 } 66 67 @Override 68 public Type getType() { 69 return(Type.Resign); 70 } 71 72 @Override 73 public boolean isGui() { 74 return false; 75 } 76 77 /** Get the icon for this animation 78 * @return the imageIcon 79 */ 80 public ImageIcon getIcon() { 81 return imageIcon; 82 } 83 84 /** Set the icon that this animation will use 85 * @param imageIcon the imageIcon to set 86 */ 87 public void setIcon(ImageIcon imageIcon) { 88 this.imageIcon = imageIcon; 89 } 90 91 /** Get how many points this resign event is for 92 * @return the resigningPoints 93 */ 94 public int getResigningPoints() { 95 return(resigningPoints); 96 } 97 98 /** Set how many points this resign event is for 99 * @param resigningPoints the resigningPoints to set 100 */ 101 public void setResigningPoints(int resigningPoints) { 102 this.resigningPoints = resigningPoints; 103 } 104 105 106 /** Set the start and end points for this dice animation 107 * @param miniX 108 * @param miniY 109 * @param miniSize 110 * @param x 111 * @param y 112 * @param flagSize 113 * @return int[0]=X, [1]=Y, [2]=WIDTH, [3]=HEIGHT 114 */ 115 public int[] getFlagParms(int miniX, int miniY, int miniSize, int x, int y, int flagSize) { 116 pos[X] = (int)(((x-miniX)*offset)+miniX); 117 pos[Y] = (int)(((y-miniY)*offset)+miniY); 118 pos[WIDTH] = (int)(((flagSize-miniSize)*offset)+miniSize); 119 pos[HEIGHT] = (int)(pos[WIDTH] * flagHeight/flagWidth); 120 return(pos); 121 } 122 123 124 }