@Override
	public void render(GameContainer container, StateBasedGame game, Graphics g)
			throws SlickException {
		// render background images
		background.draw(0, 0);
		foreground.draw(0, 0);
		
		// draw the pit
        	for(int line=0; line<pit.getNumberOfLines(); line++) {
            		for(int col=0; col<pit.getNumberOfColumns(); col++) {
                		int blockType = pit.getBlockAt(col,line);
                		if(blockType != -1) {
                    			blockImages.get(blockType).draw(col*blockSize+PIT_X, PIT_Y+blockSize*(pit.getNumberOfLines()-line-1));
                		}
            		}
        	}
		
        	// draw the current piece
        	if(currentPiece != null) {
            		for(int i=0; i<4; i++) {
                		Tuple blockPos = currentPiece.getPosOfBlock(i);
                		blockImages.get(currentPiece.getbImageID(i)).draw(PIT_X + (blockPos.x + cursorPos.x) * blockSize,
                    			PIT_Y + (pit.getNumberOfLines() - 1 -(blockPos.y+cursorPos.y)) * blockSize);
            		}
        	}
        
        	// draw nextPiece
	    	if(nextPiece != null) {
	    		int drawX, drawY;
	    		drawX = 114;
	    		drawY = 146;
	    		if(nextPiece.getName().charAt(0) == 'o') {
	    			// adjust next piece display for O piece
	    			drawX -= 15;
	    		}
	    		if(nextPiece.getName().charAt(0) == 'i') {
	    			// adjust next piece display for i piece
	    			drawX -= 1;
	    			drawY -= 27;
	    		}
	    	    for(int i = 0; i < 4; i++) {
	    	        Tuple blockPos = nextPiece.getPosOfBlock(i);
	    	        blockImages.get(nextPiece.getbImageID(i)).draw( drawX + (blockPos.x) * blockSize, drawY + ( ( blockPos.y )) * blockSize );
	    	    }
	    	}
	    	
	    	// draw the level and lines display
	    	font.drawString(180, 230, Integer.toString(level));
	    	font.drawString(176, 282, Integer.toString(linesCountdown));
	}