You are viewing the NetWars Project

The entrance (WinMain) to the application is in NetWars.cpp. It is currently utilizing DirectX, D3DX, XInput (360 controller), Box2D and eventually Enet for networking.

Last Updated 5/30/08

B2DWrapper.cpp
B2DWrapper.h
Engine.cpp
Engine.h
GameBorder.cpp
GameBorder.h
LinkedList.h
NetWars.cpp
NetWars.h
SceneObject.cpp
SceneObject.h
Shield.cpp
Shield.h
SimpleWindow.cpp
SimpleWindow.h
SpaceShip.cpp
SpaceShip.h
UserInput.cpp
UserInput.h

Zips :
The zip file contains the exe and the dll's needed to run the application.

NetWars.zip


Syntax Highlighting by: SyntaxHighlighter
//-----------------------------------------------------------------------------
// simpleWindow implementation.
//-----------------------------------------------------------------------------

#include "NetWars.h"

//-----------------------------------------------------------------------------
// The SimpleWindow class constructor.
//-----------------------------------------------------------------------------
SimpleWindow::SimpleWindow( HINSTANCE instance )
{
	m_width=800;
	m_height=600;
	m_name = L"NetWars";
	m_class = L"WindowClass";
	m_instance = instance;

	// Prepare and register the window class.
	WNDCLASSEX wcex;
	wcex.cbSize        = sizeof( WNDCLASSEX );
	wcex.style         = CS_CLASSDC;
	wcex.lpfnWndProc   = WindowProc;
	wcex.cbClsExtra    = 0;
	wcex.cbWndExtra    = 0;
	wcex.hInstance     = instance;
	wcex.hIcon         = LoadIcon( NULL, IDI_APPLICATION );
	wcex.hCursor       = LoadCursor( NULL, IDC_ARROW );
	wcex.hbrBackground = NULL;
	wcex.lpszMenuName  = NULL;
	wcex.lpszClassName = m_class;
	wcex.hIconSm       = LoadIcon( NULL, IDI_APPLICATION );
	RegisterClassEx( &wcex );

	// Initialise the COM using multithreaded concurrency.
	CoInitializeEx( NULL, COINIT_MULTITHREADED );

	m_WindowHWND = CreateWindow( m_class, m_name, WS_OVERLAPPEDWINDOW, 20, 20, 
							m_width, m_height, NULL, NULL, m_instance, NULL );
	
}

//-----------------------------------------------------------------------------
// The SimpleWindow class destructor.
//-----------------------------------------------------------------------------
SimpleWindow::~SimpleWindow( )
{
	// Uninitialise the COM.
	CoUninitialize();

	// Unregister the window class.
	UnregisterClass( m_class, m_instance );
	
}

//-----------------------------------------------------------------------------
// Simply a wrapper for ShowWindow
//-----------------------------------------------------------------------------
void SimpleWindow::Show( )
{
	// Show the window.
	ShowWindow( m_WindowHWND, SW_NORMAL );	
}

//-----------------------------------------------------------------------------
// Getter for instance.
//-----------------------------------------------------------------------------
HINSTANCE SimpleWindow::GetInstance()
{
	return m_instance;
}

//-----------------------------------------------------------------------------
// Getter for instance.
//-----------------------------------------------------------------------------
HWND SimpleWindow::GetHandle()
{
	return m_WindowHWND;
}

RECT SimpleWindow::GetRect()
{
	GetWindowRect( m_WindowHWND, &m_winRect); 
	return m_winRect;
}