A
download Application.h
Language: C++
LOC: 41
Project Info
TableHockey3D(tablehockey)
Server: SourceForge
Type: cvs
...ey\CVSROOT\tablehockey\src\
   Application.cpp
   Application.h
   Camera.cpp
   Camera.h
   Cube.cpp
   Cube.h
   Data.cpp
   Data.h
   Disk.cpp
   Disk.h
   FloatingText.cpp
   FloatingText.h
   Floor.cpp
   Floor.h
   Input.cpp
   Input.h
   Light.cpp
   Light.h
   log.cpp
   log.h
   main.cpp
   mmgr.cpp
   mmgr.h
   Model.cpp
   Model.h
   nommgr.h
   Puck.cpp
   Puck.h
   Pyramid.cpp
   Pyramid.h
   scene.cpp
   scene.h
   SmartPtr.h
   Sound.cpp
   Sound.h
   TableHockey.dsp
   TableHockey.dsw
   TestScene.cpp
   TestScene.h
   text.cpp
   text.h
   TextHelp.cpp
   TextHelp.h
   texture.cpp
   texture.h
   TexturedCube.cpp
   TexturedCube.h
   timer.cpp
   timer.h
   View.cpp
   View.h

// Application.h: interface for the CApplication class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_APPLICATION_H__CBA6FB23_9DD5_11D4_A9EA_00105A2EAD2D__INCLUDED_)
#define AFX_APPLICATION_H__CBA6FB23_9DD5_11D4_A9EA_00105A2EAD2D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <windows.h>		// Header File For Windows

#include <gl/gl.h>			// Header File For The OpenGL32 Library
#include <gl/glu.h>			// Header File For The GLu32 Library
#include <gl/glaux.h>		// Header File For The Glaux Library

#include "smartptr.h"

#include "data.h"
#include "input.h"
#include "log.h"
#include "sound.h"
#include "view.h"

/**
 * The "heart" of the application.
 *
 * CApplication is the controller of the whole application. It initializes all
 * global variables and contains the main message-loop. Windows messages are 
 * handled separately in the WndProc.
 */
class CApplication  
{
public:
	/// The constructor
	CApplication();
	/// The destructor
	virtual ~CApplication();

	/**
	 * Initialization of the program
	 *
	 * This function allocates the memory for the global pointers (CInput,
	 * CView, CSound etc). Nothing more is needed at the moment.
	 *
	 * @param hInstance Handle to the instance of the application
	 * @returns TRUE if initialization was successful, else FALSE
	 */
	bool Init(HINSTANCE hInstance);

	/**
	 * The main message loop
	 *
	 * This function starts the main message loop. Messages are removed
	 * from the queue with "PeekMessage". After that all modules are 
	 * updated, e.g. it will be checked if the user has pressed a key or
	 * moved the mouse and the whole screen will be redrawn. Finally, a 
	 * timer takes care of a constant framerate. I have set it to 30 FPS
	 * which should look very smooth.
	 *
	 * @returns The final exit-code
	 */
	int Run();

	/**
	 * Termination of the application
	 *
	 * Most cleanup is done here. The "Exit" function of all modules will 
	 * be called but the global pointers are still valid.
	 */
	void Exit();

	/// Signal that the application should end (leaving message-loop)
	void ShouldEnd() {bRun = false; }

	/// flag if program should run
	bool bRun;
	/// flag if application is active, if not no drawing will be done
	bool bActive;
	/// instance handle
	HINSTANCE hInst;
	/// store the current frames per second. Updated after 500ms
	float FramesPerSecond;

/*
	SmartPtr<CLog>			pLog;
	SmartPtr<CApplication>	pApp;
	SmartPtr<CData>			pData;
	SmartPtr<CInput>		pInput;
	SmartPtr<CSound>		pSound;
	SmartPtr<CView>			pView;
*/
	RefCountPtr<CLog>		pLog;
	RefCountPtr<CApplication>	pApp;
	RefCountPtr<CData>			pData;
	RefCountPtr<CInput>		pInput;
	RefCountPtr<CSound>		pSound;
	RefCountPtr<CView>			pView;
private:

};

#define Toggle(a) {a == true ? a = false: a = true;}

extern RefCountPtr<CApplication>	pApp;

extern char szProgName[];
extern char szClassName[];


#endif // !defined(AFX_APPLICATION_H__CBA6FB23_9DD5_11D4_A9EA_00105A2EAD2D__INCLUDED_)

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us