view LightClone/Source/View.h @ 7:31373c5bd1b9

Start on World refactor
author koryspansel <koryspansel@bendbroadband.com>
date Fri, 09 Sep 2011 13:21:22 -0700
parents 6f227dd9a94f
children
line wrap: on
line source

/*
 * View
 */

#ifndef __VIEW_H__
#define __VIEW_H__

#include "Core.h"
#include "Model.h"
#include "RenderContext.h"
#include "CameraController.h"
#include "Interface.h"

/*
 * View
 */
class View
{
	/*
	 * pView
	 *	Replace this with the Mediator
	 */
	static View* pView;

	/*
	 * pModel
	 *	Remove
	 */
	Model* pModel;

	/*
	 * kWindow
	 *	Move to Mediator; Anything requiring access to the window will need to
	 *	be owned and initialized by the Mediator.
	 */
	HWND kWindow;

	/*
	 * kContext
	 *	Move to Mediator
	 */
	RenderContext kContext;

	/*
	 * kCameraController
	 *	Move to World
	 */
	CameraController kCameraController;

	/*
	 * pBlockEffect
	 *	Move to World
	 */
	ID3DXEffect* pBlockEffect;

	/*
	 * pBlockVertexBuffer
	 *	Move to World
	 */
	IDirect3DVertexBuffer9* pBlockVertexBuffer;

	/*
	 * pBlockTexture
	 *	Move to World
	 */
	IDirect3DTexture9* pBlockTexture;

	/*
	 * kInterface
	 *	Move to World
	 */
	Interface kInterface;

public:

	/*
	 * View
	 */
	View(Model* pModel);

	/*
	 * Initialize
	 */
	ErrorCode Initialize();

	/* 
	 * Terminate
	 */
	void Terminate();

	/*
	 * Render
	 */
	void Render();

	/*
	 * GetWindow
	 */
	HWND GetWindow() const;

	/*
	 * UpdateCameraYaw
	 */
	void UpdateCameraYaw(float fDelta);

	/*
	 * UpdateCameraPitch
	 */
	void UpdateCameraPitch(float fDelta);

	/*
	 * UpdateCameraDistance
	 */
	void UpdateCameraDistance(float fDelta);

private:

	/*
	 * SetupVertexBuffer
	 */
	ErrorCode SetupVertexBuffer();

	/*
	 * Render3D
	 */
	void Render3D();

	/* 
	 * Render2D
	 */
	void Render2D();

	/*
	 * 	RenderEnvironment
	 */
	void RenderEnvironment(Environment* pEnvironment);

	/*
	 * RenderBot
	 */
	void RenderBot(Environment* pEnvironment, Bot* pBot);

	/*
	 * RenderBlock
	 */
	void RenderBlock(const D3DXMATRIX& kWorldMatrix, D3DCOLOR kColor);

	/*
	 * RenderBackground
	 */
	void RenderBackground();

	/*
	 * RenderToolbar
	 */
	void RenderToolbar();

	/*
	 * RenderMain
	 */
	void RenderMain();

	/*
	 * RenderFunction();
	 */
	void RenderFunction();

	/*
	 * RenderControls
	 */
	void RenderControls();

	/*
	 * RenderLevelDialog
	 */
	void RenderLevelDialog();

	/*
	 * RenderGameOverDialog
	 */
	void RenderGameOverDialog();

	/*
	 * RenderCursor
	 */
	void RenderCursor();

	/*
	 * OnMessage
	 */
	LRESULT OnMessage(UINT nMessage, WPARAM wParam, LPARAM lParam);

	/*
	 * MessageRouter
	 */
	static LRESULT CALLBACK MessageRouter(HWND hWnd, UINT nMessage, WPARAM wParam, LPARAM lParam);
};

#endif //__VIEW_H__