|
|
|
![]() |
|
Strumenti |
![]() |
#41 |
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Lo stai facendo te o vuoi i test ?
|
![]() |
![]() |
![]() |
#42 |
Senior Member
Iscritto dal: Oct 2002
Città: San Jose, California
Messaggi: 11794
|
Ecco il test che controlla che le gemme siano correttamente animate da Grid:
Codice:
public void testGridUpdatesAnimations() { Grid grid = Grid.createForTesting(new MockGemGenerator()); grid.insertGem(1, 1, gem); gem.addFrame(10, 15, 100); MockTimer timer = new MockTimer(3500); grid.update(timer); assertEquals("Gem animation hasn't been updated", 1, gem.getCurrentFrame()); } Codice:
public void update(AbstractTimer timer) { for(int y = grid.length - 1; y >= 0; y--) { for(int x = 0; x < grid[y].length; x++) { Gem gem = getGemAt(y, x); if (gem != null) { gem.update(timer); } } } [...] }
__________________
"We in the game industry are lucky enough to be able to create our visions" @ NVIDIA |
![]() |
![]() |
![]() |
#43 |
Senior Member
Iscritto dal: Oct 2002
Città: San Jose, California
Messaggi: 11794
|
Ed ora un test per creare l'intera sequena di animazione di una gemma e ne testa la temporizzazione:
Codice:
public void testCreateAnimationSequence() { gem.createAnimationSequence(); MockEngine engine = MockEngine.createForTesting(800, 600); MockTimer timer = new MockTimer(3450 + 100 * 5); gem.update(timer); gem.draw(engine); assertEquals("Last frame of the sequence is wrong", 32 * 5, engine.getTextureRect().top()); } Codice:
public void createAnimationSequence() { for (int i = 1; i <= 5; ++i) { addFrame(0, 32 * i, 100); } }
__________________
"We in the game industry are lucky enough to be able to create our visions" @ NVIDIA |
![]() |
![]() |
![]() |
#44 |
Senior Member
Iscritto dal: Nov 2005
Messaggi: 1545
|
le gemme nel next non vanno animate per ora?
|
![]() |
![]() |
![]() |
#45 | |
Senior Member
Iscritto dal: Oct 2002
Città: San Jose, California
Messaggi: 11794
|
Quote:
Ora e' il momento delle tagliatelle ai funghi per me, mi trasferisco in cucina ![]()
__________________
"We in the game industry are lucky enough to be able to create our visions" @ NVIDIA |
|
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 19:35.