Click here to Skip to main content
15,896,269 members
Articles / Desktop Programming / Win32

TetroGL: An OpenGL Game Tutorial in C++ for Win32 platforms - Part 3

Rate me:
Please Sign up or sign in to vote.
4.98/5 (35 votes)
7 Nov 2008CPOL20 min read 182.1K   12.5K   92  
Learn how to draw text and handle the states of your game.
#include "TetradFactory.h"
#include "Tetrad_O.h"
#include "Tetrad_I.h"
#include "Tetrad_S.h"
#include "Tetrad_Z.h"
#include "Tetrad_T.h"
#include "Tetrad_J.h"
#include "Tetrad_L.h"
#include <time.h>

CTetradFactory::CTetradFactory()
{
	srand ( (unsigned int)time(NULL) );
}

CTetradFactory::~CTetradFactory()
{
}

CTetrad* CTetradFactory::CreateTetrad(CBlocksMatrix* pMatrix)
{
	CTetrad* pNewTetrad = NULL;

	int value = rand()%7;
	switch (value)
	{
	case 0:
		pNewTetrad = new CTetrad_I(pMatrix);
		break;
	case 1:
		pNewTetrad = new CTetrad_O(pMatrix);
		break;
	case 2:
		pNewTetrad = new CTetrad_S(pMatrix);
		break;
	case 3:
		pNewTetrad = new CTetrad_Z(pMatrix);
		break;
	case 4:
		pNewTetrad = new CTetrad_T(pMatrix);
		break;
	case 5:
		pNewTetrad = new CTetrad_J(pMatrix);
		break;
	case 6:
		pNewTetrad = new CTetrad_L(pMatrix);
		break;
	}

	return pNewTetrad;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer
Belgium Belgium
I am a 29 years old guy and I live with my girlfriend in Hoegaarden, little city from Belgium well known for its white beer Smile | :) .
I studied as an industrial engineer in electronics but I oriented myself more towards software development when I started to work.
Currently I am working in a research centre in mechatronica. I mainly develop in C++ but I also do a bit of Java.
When I have so spare time, I like to read (mainly fantasy) and play electric guitar.

Comments and Discussions