package bwyap.familyfeud.render;

import bwyap.familyfeud.game.FamilyFeudGame;
import bwyap.gridgame.engine.FixedTimeStepGameEngine;

/**
 * A custom implementation of a game engine to render 
 * graphics to the game window for Family Feud
 * @author bwyap
 *
 */
public class FFRenderingEngine extends FixedTimeStepGameEngine {

	private RenderingPanel renderSurface;	
	private RenderMachine machine;

	/**
	 * Create a new Family Feud rendering engine
	 * at the specified fps rate
	 * @param fps
	 */
	public FFRenderingEngine(int fpsRate, RenderingPanel renderPanel, FamilyFeudGame game) {
		super(fpsRate);
		this.renderSurface = renderPanel;
		this.machine = new RenderMachine(game);
	}

	@Override
	public void render() {
		renderSurface.render(machine.getState());
	}
	
	@Override
	public void update(float timeElapsed) {
		machine.update(timeElapsed);
		renderSurface.updateFPS(getMeasuredfps());
	}
	
}

@@ -125,16 +125,53 @@
 eEngine;
+%0Aimport bwyap.utility.logging.Logger;
 %0A%0A/**%0A *
@@ -860,16 +860,25 @@
 psed) %7B%0A
+%09%09try %7B%0A%09
 %09%09machin
@@ -902,16 +902,17 @@
 sed);%0A%09%09
+%09
 renderSu
@@ -941,20 +941,148 @@
 suredfps());
+%09%09%09%0A%09%09%7D%0A%09%09catch (Exception e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%09Logger.err(%22Unexpected RuntimeError occured: %22 + e.getMessage());%0A%09%09%7D
 %0A%09%7D%0A%09%0A%7D%0A

Add exception handling to FFRenderingEngine