Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AnimateEventDiceRoll |
|
| 1.0;1 |
1 | /****************************************************************************** | |
2 | * AnimateEventDiceRoll.java - Run the dice roll animation. | |
3 | * $Id$ | |
4 | * | |
5 | * BuckoFIBS - Backgammon by BuckoSoft | |
6 | * Copyright© 2011 - Dick Balaska - BuckoSoft, Corp. | |
7 | * | |
8 | * $Log$ | |
9 | * Revision 1.4 2011/09/23 03:00:57 dick | |
10 | * Lengthen the dice roll to 1.4 seconds. | |
11 | * | |
12 | * Revision 1.3 2011/06/02 19:13:34 dick | |
13 | * Need to define isGui(). | |
14 | * | |
15 | * Revision 1.2 2011/05/31 19:45:37 dick | |
16 | * Javadoc. | |
17 | * | |
18 | * Revision 1.1 2011/05/22 22:56:09 dick | |
19 | * c.b.f.B.g.boardTab.board becomes c.b.f.B.g.boardTab.boardPane . | |
20 | * | |
21 | * Revision 1.2 2011/05/17 22:50:04 dick | |
22 | * AnimateEvent moves to c.b.f.B.g.b.b which is where it is used. | |
23 | * | |
24 | * Revision 1.1 2011/05/16 11:41:37 dick | |
25 | * Run the dice roll animation. | |
26 | * | |
27 | */ | |
28 | ||
29 | /* | |
30 | * This program is free software: you can redistribute it and/or modify | |
31 | * it under the terms of the GNU General Public License as published by | |
32 | * the Free Software Foundation, either version 3 of the License, or | |
33 | * (at your option) any later version. | |
34 | * | |
35 | * This program is distributed in the hope that it will be useful, | |
36 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
37 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
38 | * GNU General Public License for more details. | |
39 | * | |
40 | * You should have received a copy of the GNU General Public License | |
41 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
42 | * | |
43 | * The Original Code is BuckoFIBS, <http://www.buckosoft.com/BuckoFIBS/>. | |
44 | * The Initial Developer of the Original Code is Dick Balaska and BuckoSoft, Corp. | |
45 | * | |
46 | */ | |
47 | package com.buckosoft.fibs.BuckoFIBS.gui.boardTab.boardPane; | |
48 | ||
49 | ||
50 | /** Run the dice roll animation. | |
51 | * @author Dick Balaska | |
52 | * @since 2011/05/15 | |
53 | * @version $Revision$ <br> $Date$ | |
54 | * @see <a href="http://cvs.buckosoft.com/Projects/BuckoFIBS/BuckoFIBS/src/main/java/com/buckosoft/fibs/BuckoFIBS/gui/boardTab/boardPane/AnimateEventDiceRoll.java">cvs AnimateEventDiceRoll.java</a> | |
55 | */ | |
56 | 0 | public class AnimateEventDiceRoll extends AnimateEvent { |
57 | public final static int XL = 0; | |
58 | public final static int XR = 1; | |
59 | public final static int Y = 2; | |
60 | public final static int SIZE = 3; | |
61 | int miniX0; | |
62 | int miniX1; | |
63 | int miniY; | |
64 | int miniSize; | |
65 | int x0; | |
66 | int x1; | |
67 | int y; | |
68 | int dieSize; | |
69 | ||
70 | 0 | private int[] pos = new int[4]; |
71 | ||
72 | 0 | public int[] dice = new int[2]; |
73 | ||
74 | @Override | |
75 | public int getDuration() { | |
76 | 0 | return 1000; |
77 | } | |
78 | ||
79 | @Override | |
80 | public Type getType() { | |
81 | 0 | return(Type.Roll); |
82 | } | |
83 | ||
84 | @Override | |
85 | public boolean isGui() { | |
86 | 0 | return false; |
87 | } | |
88 | ||
89 | /** Set the start and end points for this dice animation | |
90 | * @param miniX0 | |
91 | * @param miniX1 | |
92 | * @param miniY | |
93 | * @param miniSize | |
94 | * @param x0 | |
95 | * @param x1 | |
96 | * @param y | |
97 | * @param dieSize | |
98 | * @return int[0]=XL, [1]=XR, [2]=Y, [3]=SIZE | |
99 | */ | |
100 | public int[] getDiceParms(int miniX0, int miniX1, int miniY, int miniSize, int x0, int x1, int y, int dieSize) { | |
101 | 0 | this.miniX0 = miniX0; |
102 | 0 | this.miniX1 = miniX1; |
103 | 0 | this.miniY = miniY; |
104 | 0 | this.miniSize = miniSize; |
105 | 0 | this.x0 = x0; |
106 | 0 | this.x1 = x1; |
107 | 0 | this.y = y; |
108 | 0 | this.dieSize = dieSize; |
109 | 0 | pos[XL] = (int)(((x0-miniX0)*offset)+miniX0); |
110 | 0 | pos[XR] = (int)(((x1-miniX1)*offset)+miniX1); |
111 | 0 | pos[Y] = (int)(((y-miniY)*offset)+miniY); |
112 | 0 | pos[SIZE] = (int)(((dieSize-miniSize)*offset)+miniSize); |
113 | 0 | return(pos); |
114 | } | |
115 | ||
116 | ||
117 | } |