Examples of GameGrid


Examples of main.ch.morrolan.gibb.snake.GameGrid

@RunWith(JUnit4.class)
public class GameGridTest
{
    public GameGrid gameGrid1() {
        return new GameGrid(10, 5);
    }
View Full Code Here

Examples of main.ch.morrolan.gibb.snake.GameGrid

    public GameGrid gameGrid1() {
        return new GameGrid(10, 5);
    }

    public GameGrid gameGrid2() {
        return new GameGrid(3, 5, 6, 4);
    }
View Full Code Here

Examples of main.ch.morrolan.gibb.snake.GameGrid

        return new GameGrid(3, 5, 6, 4);
    }

    @Test
    public void GameGrid() {
        GameGrid gg;

        gg = gameGrid1();
        assertEquals(10, gg.width);
        assertEquals(5, gg.height);

        gg = new GameGrid(2, 5, 7, 3);
        assertEquals(7, gg.width);
        assertEquals(3, gg.height);

        gg = new GameGrid(new Point(1, 2), 4, 6);
        assertEquals(4, gg.width);
        assertEquals(6, gg.height);

        gg = gameGrid2();
        assertEquals(3, gg.position.x);
View Full Code Here

Examples of main.ch.morrolan.gibb.snake.GameGrid

    }

    @Test
    public void draw() {
        Painter painter = mock(Painter.class);
        GameGrid grid;

        grid = new GameGrid(0, 0, 10, 10);
        grid.draw(painter);
        verify(painter).drawRect(0, 0, 10, 10);
        // Horizontal lines
        for (int i = 0; i <= 10; i++) {
            verify(painter).drawLine(0, i,  10, i);
        }
        // Vertical lines
        for (int i = 0; i <= 10; i++) {
            verify(painter).drawLine(i, 0, i, 10);
        }


        grid = new GameGrid(0, 0, 3, 7);
        grid.draw(painter);
        verify(painter).drawRect(0, 0, 3, 7);
        // Horizontal lines
        for (int i = 0; i <= 7; i++) {
            verify(painter, times(1)).drawLine(0, i, 3, i);
        }
        // Vertical lines
        for (int i = 0; i <= 3; i++) {
            verify(painter).drawLine(i, 0, i, 7);
        }


        grid = gameGrid2();
        grid.draw(painter);
        verify(painter).drawRect(3, 5, 6, 4);
        // Horizontal lines
        for (int i = 5; i <= 9; i++) {
            verify(painter, times(1)).drawLine(3, i, 9, i);
        }
View Full Code Here

Examples of main.ch.morrolan.gibb.snake.GameGrid

        }
    }

    @Test
    public void endPoint() {
        GameGrid gg;

        gg = gameGrid1();
        assertEquals(new Point(10, 5), gg.endPoint());

        gg = gameGrid2();
        assertEquals(new Point(9, 9), gg.endPoint());
    }
View Full Code Here

Examples of squaresgame.GameGrid

   
    //Make the mouse cursor work with in-game objects
    CursorGenerator.setUpCursor();
   
    //Create the logical representation of the game's grid.
    Grid grid = new GameGrid(gridWidth, gridHeight);
   
    //Set up the game controller to manage the turn system, and run in a seperate thread.
    List<Player> players = generatePlayers(numHumanPlayers, numAIPlayers);
    GameControllerGenerator.setUpGameController(grid, players);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.