Jump to content

  • Log In with Google      Sign In   
  • Create Account


Cryptiik

Member Since 19 Feb 2011
Offline Last Active Today, 05:10 PM

Topics I've Started

Any Developers in the South Jersey Area?

17 March 2014 - 02:48 PM

Just curious, are there any developers in the South Jersey area that might want to meet up or just get a cup of coffee and talk? I don't really have any other friends or people I can talk to about computers, technology, gaming, or programming so this will be a nice change if possible. Who knows? Maybe we can even work together on a project biggrin.png  


Moving to Australia

08 October 2013 - 04:56 PM

Dont know if any of you can help me out with this, but I'm hoping you can. Currently I'm in college studying to get my degree in Computer Science. However after I get my masters, I'm thinking about moving out of the United States and go to Australia. I don't have any family there and it would be a fresh start for me.

Few things Im worried about:

- How hard is it to get a Computer Science related job there? Namely as a programmer or Software Engineer?

- Do they make enough money to live comfortably? I know the cost of living there is higher.

- How big of a transition would it be moving from America to there?

- How does the projected job growth for Comp Sci look over there?

I've been looking at some information about it for a few days and some of the sited I looked at said that computer related stuff was being moved over seas for cheaper labor, and that sort of worries me.

Anyways I'm hoping some of you are from Australia and maybe could help me out with this. Also feel free to include why maybe I SHOULDNT move there? Thanks :)

Sprite won't change position

02 February 2013 - 07:32 PM

When I run the program, all the sprites are in the correct position, however when I press a button to move the paddle it stays in the same place. I know that the input is working because I tested it with system beeps, and I know that the position of the sprite is changing because I had the x and y coordinates sent to a file as I pressed the button. Im not sure why the texture stays in the same place. Here's the code:

 

I also uploaded the entire project incase anyone wanted a closer look

 

 

//WinMain.cpp

Object Ball;
	Ball.setTexture( g.LoadTexture( "Resources/Ball.png" ) );
	Ball.setImageInfo( "Resources/Ball.png" );
	Ball.setPosition( ( ( WindowWidth / 2 ) - Ball.getImageInfo().Width ), ( ( WindowHeight / 2 ) - Ball.getImageInfo().Height ) );

	Object LeftPaddle;
	LeftPaddle.setTexture( g.LoadTexture( "Resources/LeftPaddle.png" ) );
	LeftPaddle.setImageInfo( "Resources/LeftPaddle.png" );
	LeftPaddle.setPosition( 0, ( ( WindowHeight / 2 ) - LeftPaddle.getImageInfo().Height ) );

	Object RightPaddle;
	RightPaddle.setTexture( g.LoadTexture( "Resources/RightPaddle.png" ) );
	RightPaddle.setImageInfo( "Resources/RightPaddle.png " );
	RightPaddle.setPosition( ( WindowWidth - RightPaddle.getImageInfo().Width ), ( WindowHeight / 2 ) - RightPaddle.getImageInfo().Height );

	g.getObjectManager().AddObject( Ball );
	g.getObjectManager().AddObject( LeftPaddle );
	g.getObjectManager().AddObject( RightPaddle );

	Input i;

	i.InitInput( window );

	while ( GameOver != true )
	{
		if ( PeekMessage( &message, NULL, 0, 0, PM_REMOVE ) )
		{
			TranslateMessage( &message );
			DispatchMessage( &message );
		}

		i.RefreshInput();

		if ( i.KeyPressed( DIK_ESCAPE ) )
		{
			GameOver = true;
		}

		if ( i.KeyPressed( DIK_UP ) )
		{
			LeftPaddle.Move( 0.0f, -0.5f );
		}

		if ( i.KeyPressed( DIK_DOWN ) )
		{
			LeftPaddle.Move( 0.0f, 0.5f );
		}

		g.UpdateGraphics();
	}

 

 

//ObjectManager.h

#ifndef OBJECTMANAGER_H
#define OBJECTMANAGER_H

#include "Object.h"
#include <list>
#include <d3dx9.h>

class ObjectManager
{

public:

	//ObjectManager() {}
	//~ObjectManager() {}

	void AddObject( Object &object );

	void ReleaseTextures();

	void UpdateObjectManager( LPD3DXSPRITE &sprite );

private:

	std::list<Object>           Objects;
	std::list<Object>::iterator Iter;
};

#endif  OBJECTMANAGER_H

 

 


//ObjectManager.cpp

#include "ObjectManager.h"
#include "Globals.h"

void ObjectManager::AddObject( Object &object )
{
	Objects.push_back( object );
}

void ObjectManager::ReleaseTextures()
{
	Iter = Objects.begin();

	while ( Iter != Objects.end() )
	{
		RELEASE( Iter -> getTexture() );

		Iter++;
	}
}

void ObjectManager::UpdateObjectManager( LPD3DXSPRITE &sprite )
{
	Iter = Objects.begin();

	while ( Iter != Objects.end() )
	{
		sprite -> Draw( Iter -> getTexture(), NULL, NULL, &Iter -> getPosition(), White );

		Iter++;
	}
}

 

 

 

 

//Graphics.h

#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "DxManager.h"
#include "ObjectManager.h"
#include <d3dx9.h>
#include <string>

class Graphics
{

public:

	bool InitGraphics( HWND &window );

	void StartScene();
	void Render();
	void EndScene();

	void UpdateGraphics();

	void ReleaseTextures();

	LPDIRECT3DTEXTURE9 LoadTexture( std::string file );

	DxManager     &getD3DManager()    { return this -> D3DManager; }
	ObjectManager &getObjectManager() { return this -> ObjManager; }
	HWND          &getWindow()        { return this -> Window; }

private:

	HWND Window;

	DxManager     D3DManager;
	ObjectManager ObjManager;
};

#endif  GRAPHICS_H

 

 

 

//Graphics.cpp

#include "Graphics.h"
#include "Globals.h"

bool Graphics::InitGraphics( HWND &window )
{
	this -> Window = window;

	if( !D3DManager.InitD3D( window ) )
	{
		GameOver = true;
		MessageBox( window, "Error initializing DirectX9", "Error", MB_OK );
		return false;
	}

	return true;
}

void Graphics::StartScene()
{
	D3DManager.getDirect3DDevice() -> Clear( 0, NULL, D3DCLEAR_TARGET, Black, 0.0f, 0 );

	D3DManager.getDirect3DDevice() -> BeginScene();
	D3DManager.getSpriteObject()   -> Begin( D3DXSPRITE_ALPHABLEND );
}

void Graphics::Render()
{
	ObjManager.UpdateObjectManager( D3DManager.getSpriteObject() );
}

void Graphics::EndScene()
{
	D3DManager.getSpriteObject()   -> End();
	D3DManager.getDirect3DDevice() -> EndScene();

	D3DManager.getDirect3DDevice() -> Present( NULL, NULL, NULL, NULL );
}

void Graphics::UpdateGraphics()
{
	StartScene();
	Render();
	EndScene();
}

void Graphics::ReleaseTextures()
{
	ObjManager.ReleaseTextures();
}

LPDIRECT3DTEXTURE9 Graphics::LoadTexture( std::string file )
{
	LPDIRECT3DTEXTURE9 texture = NULL;

	D3DXIMAGE_INFO info;

	D3DXGetImageInfoFromFile( file.c_str(), &info );

	HRESULT hr = D3DXCreateTextureFromFileEx( 
		D3DManager.getDirect3DDevice(),
		file.c_str(),
		info.Width, info.Height,
		1,
		D3DPOOL_DEFAULT,
		D3DFMT_UNKNOWN,
		D3DPOOL_DEFAULT,
		D3DX_DEFAULT,
		D3DX_DEFAULT,
		Transparent,
		&info,
		NULL,
		&texture );

	return texture;
}

How to start Network Programming?

01 February 2013 - 01:37 PM

I've always been interested in learning how to make multiplayer games, or even simple server/client applications that might transfer text between each other sort of like an IM application. However I've never really been able to find a good tutorial or book that teaches network programming in C++. How did you guys learn and maybe you could point me in the right direction to some good resources? Obviously I'm not going to go out and start working on a multiplayer game right away but I want to be able to atleast make a simple program that can send "Instant Messages" back and forth between two users. Or is that still a bit too complicated?


Texture won't load and I get an unhandled exception

28 January 2013 - 05:03 PM

I'm trying to get a sprite to appear on my screen in the pong game I'm making but there seems to be some sort of bug that occurs. Right after the line that loads the texture executes, I get an unhandled exception. Here's the code:

 

Object.h

#ifndef OBJECT_H
#define OBJECT_H

#include <d3d9.h>
#include <d3dx9.h>
#include <string>
#include "Graphics.h"

class Object
{

public:

	Object();
	~Object();

	void setTexture( LPDIRECT3DTEXTURE9 t );

	void setPosition( float x, float y );

	LPDIRECT3DTEXTURE9 getTexture()  { return this -> texture; }
	LPD3DXVECTOR3      getPosition() { return this -> position; }

private:

	LPDIRECT3DTEXTURE9 texture;
	LPD3DXVECTOR3      position;
};

#endif  OBJECT_H

 

 

Object.cpp

 

#include "Object.h"
#include "Globals.h"

Object::Object()
{
	texture  = NULL;
	position = NULL;
}

Object::~Object()
{
	RELEASE( texture );
	
	delete position;
	position = NULL;
}

void Object::setTexture( LPDIRECT3DTEXTURE9 t )
{
	texture = t;
}

void Object::setPosition( float x, float y )
{
	position -> x = x;
	position -> y = y;
}

 

 

Graphics.h

 


#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "DxManager.h"
#include <string>

class Graphics
{

public:

	bool InitGraphics( HWND &window );

	void StartScene();
	void Render();
	void EndScene();

	void Update();

	LPDIRECT3DTEXTURE9 LoadTexture( std::string file );

	DxManager getD3DManager() { return this -> D3DManager; }

private:

	DxManager D3DManager;
};

#endif  GRAPHICS_H

 

 

 

Graphics.cpp

 


#include "Graphics.h"
#include "Globals.h"

bool Graphics::InitGraphics( HWND &window )
{
	if( !D3DManager.InitD3D( window ) )
	{
		GameOver = true;
		MessageBox( window, "Error initializing DirectX9", "Error", MB_OK );
		return false;
	}

	return true;
}

void Graphics::StartScene()
{
	D3DManager.getDirect3DDevice() -> Clear( 0, NULL, D3DCLEAR_TARGET, Black, 0.0f, 0 );

	D3DManager.getDirect3DDevice() -> BeginScene();
	D3DManager.getSpriteObject() -> Begin( D3DXSPRITE_ALPHABLEND );
}

void Graphics::Render()
{

}

void Graphics::EndScene()
{
	D3DManager.getSpriteObject() -> End();
	D3DManager.getDirect3DDevice() -> EndScene();

	D3DManager.getDirect3DDevice() -> Present( NULL, NULL, NULL, NULL );
}

void Graphics::Update()
{
	StartScene();
	Render();
	EndScene();
}

LPDIRECT3DTEXTURE9 Graphics::LoadTexture( std::string file )
{
	LPDIRECT3DTEXTURE9 texture;

	D3DXIMAGE_INFO info;

	D3DXGetImageInfoFromFile( file.c_str(), &info );

	D3DXCreateTextureFromFileEx( 
		D3DManager.getDirect3DDevice(),
		file.c_str(),
		info.Width, info.Height,
		1,
		D3DPOOL_DEFAULT,
		D3DFMT_X8R8G8B8,
		D3DPOOL_DEFAULT,
		D3DX_DEFAULT,
		D3DX_DEFAULT,
		Transparent,
		&info,
		NULL,
		&texture );

	return texture;
}

 

 

 

WinMain.cpp

 

Graphics g;

	g.InitGraphics( window );

	Object Ball;
	Ball.setTexture( g.LoadTexture( "Resources/Ball.png" ) );
	Ball.setPosition( 500, 100 );

	while ( GameOver != true )
	{
		if ( PeekMessage( &message, NULL, 0, 0, PM_REMOVE ) )
		{
			TranslateMessage( &message );
			DispatchMessage( &message );
		}

		//g.Update();

		g.StartScene();

		g.getD3DManager().getSpriteObject() -> Draw( Ball.getTexture(), NULL, NULL, Ball.getPosition(), White );

		g.EndScene();
	}

 

Is there anything that I'm doing wrong? Thanks for the help in advance.


PARTNERS