Archived

This topic is now archived and is closed to further replies.

powerblazer

Need help, total begginer to game programming.

Recommended Posts

powerblazer    122
Okay, I need huge help, I''m a 12 year old that knows c++ pretty well, I know it about up to liniked lists, I still have to finish learning about it, oh and just to say, I go by cprogramming.com''s tutorials, and CodeWarriorU, well anyway, I''ve decided to jump into the dangerous to the head world of game programming, and have decided to do a small project, which will also help me with school. Its like killing 2 birds with one stone, in school I have too make a game concerning math, about what I have learned in it, and I get to learn how to make a PC game. Well, I decided to make a 2d or 3d computer game for the project and need help on where too start. I have a friend helping me on this who is about 13 and is in Pointers in C++, so my question is, where do I start? I mean I have no idea at all where too start, do I learn about DirectDraw, or can I use Nehe''s OpenGl tutorials or something. Can anyone help me? I would prefer to make a 3d game, through. (Aye, I did a lotta yappin didn''t I?)

Share this post


Link to post
Share on other sites
cowsarenotevil    3006
It doesn''t matter what API you use for graphics (well, directdraw doesn''t support 3D graphics). You could choose between OpenGL, Direct3D, or use something else (which I don''t reccomend). But don''t expect to get it done in less than 6 months if you''ve never done anything graphical before.

Share this post


Link to post
Share on other sites
UltimaX    468
Here are some links that will help you a lot.
Game Tutorials
Planet Source Code
Games++
Guess
Google Search
NeHe

Just search for "Game Programming", "OpenGL Tutorials", "DirectX Tutorials", etc. You should find what you're looking for. Good luck.

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"

[edited by - UltimaX on August 11, 2003 11:20:48 PM]

Share this post


Link to post
Share on other sites
cowsarenotevil    3006
Math Pong and Math Tetris? Probably doable in less than 6 months, but it depends. In order to learn a graphics API (3D APIs are usually the best choice now, even for 2D games) it will take quite a bit of time, and it will take quite a long time to get it polished. If you really put your mind to it though, you could probably do it.

Share this post


Link to post
Share on other sites
Aerolithe    122
I don''t know how you''d incorperate math into pong, the real math would be in the programming though, not sure if that applies at all. You could use SDL (www.libsdl.org).

Share this post


Link to post
Share on other sites
powerblazer    122
I''ve decided to make pong using DJGPP/RHIDE, and Allegro, since their already is a tutorial on how to make a pong game I''ll learn from that and create a new one my self.

Share this post


Link to post
Share on other sites
Radagar    148
powerblazer,

DJGPP does not compile correctly with WindowsXP. Many people have problems, since WinXP doesn''t support DOS very well anymore. If you are using XP, I would suggest getting DevC++ with it''s MinGW Compiler.

Using ALLEGRO is a good idea, it''s a wonderful 2d API and easy to learn.

Share this post


Link to post
Share on other sites
powerblazer    122
THANKS TO ALL THAT REPLIED! Kay, I''ve decided to use the Allegro library for the graphics, and may use MSVC or DJGPP if the so called Windows XP versions work, so I''ll reply soon!

Share this post


Link to post
Share on other sites
powerblazer    122
Okay, OpenGL has a problem on my computer, no matter how much I uninstall and reinstall the files. I want to make a simple pong game and I''ve found a great easy to use graphics library named Graphics Magician, at www.graphicsmagician.com. Its one of the easiest to learn and too use, but its too weak for a full scale pong game, I think. Anyways, can anyone suggest an easy to use graphics library that has enough power for a simple pong game? And Allegro has problems with my computer too, even if I link all the Allegro files to my project, so can anyone help me. Please help me find a good graphics library, I don''t care if its a 3d or 2d API.

Share this post


Link to post
Share on other sites
Original Poster: Do you have MSN? I have bee Game Programming for two years now, and im 12 also. If you have any Messenging service, add me:
Yahoo: D_Jild
MSN: D_Jild@hotmail.com
AIM: QuantumVirus700

Mabee we can share Programming stories or something, but i can tell you, i will be able to help you.


______________________________
Quantum
CEO of Quantum Rebound Software
Website Up Soon

Share this post


Link to post
Share on other sites
twix    636
quote:
Original post by powerblazer
Its one of the easiest to learn and too use, but its too weak for a full scale pong game, I think. Anyways, can anyone suggest an easy to use graphics library that has enough power for a simple pong game?

Are you kidding? O___O

I don''t think there exists in the world a graphics library that is so utterly worthless that it can''t handle a game of pong.

Share this post


Link to post
Share on other sites
WiseElben    250
How about DirectX?
If OpenGL doesn''t work for you, then you should try downloading the newest driver for your Graphic Card. Does your OpenGL programs even compile?




WiseElben.com - Game programming tutorials, articles, and community.

E-mail:wiseelben@wiseelben.com
AIM: WiseElben
ICQ: 299127026

[edited by - GameDev Staff on September 27, 1989 9X:58:97 XMS] For violating Article 43 Page 456 Paragraph 251 Line .042]

Share this post


Link to post
Share on other sites
powerblazer    122
No, it doesn''t even compile, it has 3 errors, here they are:

--------------------Configuration: PONG1 - Win32 Debug--------------------
Compiling...
PONG.CPP
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2144: syntax error : missing '';'' before type ''void''
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : error C2501: ''WINGDIAPI'' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\gl\gl.h(1152) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

PONG.OBJ - 3 error(s), 0 warning(s)

Can anyone please help me, on how to fix this?

Share this post


Link to post
Share on other sites
Valderman    513
If you're willing to put some money in, I'd recommend "OpenGL Game Programming". It seems to be perfect for the situation you're in.

Otherwise, perhaps http://www.opengl.org/ has some useful newbie links.


"THREE FOOT TELESCOPING DEMON PENIS"
- Pouya

[edited by - Valderman on August 17, 2003 4:07:46 PM]

Share this post


Link to post
Share on other sites
powerblazer    122
I''ve decided to use Direct X for the API for the game and need help.
I need help on how to intergret math problems into a pong game thats made using DirectX and a library for DirectX, called CDX. I need help with this because I''m making a math computer game for my Math Class and it has too do with math that we have covered, and I decided to use integers in my game. So does anyone have a good idea on how and could you post a sample code on how to do it? Like when someone scores a point a problem pops up about integers and if the person answers it right, they get the point, and if they don''t get the question, they lose the point they had scored. So can anyone help me? heres the source code for the game part of the program, the other parts are star generator thing, and the the main part which does the make window and all that crap part:

#include "main.h"

void Playing();
void Starting();
void Paused();
void Menu();
void Win();

#define FONT_NAME "Ariel"

#define MA 10

////////////////////////////////////////////////////////////////////////////////////////////////

/// Init Game

////////////////////////////////////////////////////////////////////////////////////////////////

/// Initialize all the variables

////////////////////////////////////////////////////////////////////////////////////////////////

void InitGame() {

Engine = new CDXScreen;
if (FAILED(Engine->CreateFullScreen(hWnd, 800, 600, 8)))
CDXError(Engine, "Unable to open fullscreen 800x600x8");

Engine->GetBack()->Fill(0);
Engine->GetFront()->Fill(0);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_BOLD);

Player1 = new CDXSprite;
Player1->Create(Engine,"Player.bmp",64,15,1);
Player1->SetPos((Engine->GetWidth() / 2) - Player1->GetTile()->GetBlockWidth(),
Engine->GetHeight() - 30);
Player1->SetFrame(1);
Player1->SetState(STANDING);
Player1->SetColorKey(0);

Player2 = new CDXSprite;
Player2->Create(Engine,"Player.bmp",64,15,1);
Player2->SetPos((Engine->GetWidth() / 2) - Player2->GetTile()->GetBlockWidth(),60);
Player2->SetFrame(1);
Player2->SetState(STANDING);
Player2->SetColorKey(0);

Stars = new CDXStarField(Engine);
Stars->SetNumberofStars(500);
Stars->m_StarMode = THREED;
Stars->m_Towards = TRUE;
Stars->m_Flashing = TRUE;
Stars->m_Colored = TRUE;
Stars->Create();

Ball = new CDXSprite;
Ball->Create(Engine,"ball.bmp",25,25,1);
Ball->SetPos(Engine->GetWidth() / 2, Engine->GetHeight() / 2);
Ball->SetFrame(1);
Ball->SetColorKey(0);
Ball->SetVel(3,3);
Ball->SetColorKey(0);

Player1Score = 0;
Player2Score = 0;

SoundSystem = new CDXSound;
SoundSystem->Create(hWnd);

Bounce = new CDXSoundBuffer();
Bounce->Load(SoundSystem,"beep.wav",2);

Point = new CDXSoundBuffer();
Point->Load(SoundSystem,"zing.wav",1);

Winner = new CDXSoundBuffer();
Winner->Load(SoundSystem,"win.wav",1);

GameState = MENU;
}

////////////////////////////////////////////////////////////////////////////////////////////////

/// Update Game

////////////////////////////////////////////////////////////////////////////////////////////////

/// Go through the game state switch and go to the appropriate function

////////////////////////////////////////////////////////////////////////////////////////////////

void UpdateGame() {

switch(GameState) {

// If the game is playing update all info...

case PLAYING:
Playing();
break;

// Game is just starting

case STARTING:
Starting();
break;

case PAUSED:
Paused();
break;

case MENU:
Menu();
break;

case WINNER:
Win();
break;

} // case switch


}

void Playing() {

char str[64];

Input.Update();

if(Input.GetKeyState(CDXKEY_RIGHTARROW)) {
Player1->SetPosX(Player1->GetPosX() + MA);
Player1->SetState(MOVING_RIGHT);
}
else if(Input.GetKeyState(CDXKEY_LEFTARROW)) {
Player1->SetPosX(Player1->GetPosX() - MA);
Player1->SetState(MOVING_LEFT);
}
else {
Player1->SetState(STANDING);
}

if(Player2Mode) {
if(Input.GetKeyState(CDXKEY_X)) {
Player2->SetPosX(Player2->GetPosX() + MA);
Player2->SetState(MOVING_RIGHT);
}
else if(Input.GetKeyState(CDXKEY_Z)) {
Player2->SetPosX(Player2->GetPosX() - MA);
Player2->SetState(MOVING_LEFT);
}
else {
Player2->SetState(STANDING);
}
}
else {
if( (Player2->GetPosX() + Player2->GetTile()->GetBlockWidth()) < Ball->GetPosX()) {
Player2->SetPosX(Player2->GetPosX() + MA);
Player2->SetState(MOVING_RIGHT);
}
else if(Player2->GetPosX() > (Ball->GetPosX() + Ball->GetTile()->GetBlockWidth())) {
Player2->SetPosX(Player2->GetPosX() - MA);
Player2->SetState(MOVING_LEFT);
}
else {
Player2->SetState(STANDING);
}
}

if(Input.GetKeyState(CDXKEY_P)) {
GameState = PAUSED;
}

if(Input.GetKeyState(CDXKEY_ESCAPE)) {
GameState = MENU;
Player1->SetPos((Engine->GetWidth() / 2) - Player1->GetTile()->GetBlockWidth(),
Engine->GetHeight() - 30);
Player1->SetState(STANDING);
Player2->SetPos((Engine->GetWidth() / 2) - Player2->GetTile()->GetBlockWidth(),60);
Player2->SetState(STANDING);
Ball->SetVel(3,3);
Ball->SetPos((Engine->GetWidth() / 2),(Engine->GetHeight() / 2));
}

if( (Player1->GetPosX() + Player1->GetTile()->GetBlockWidth()) > Engine->GetWidth() )
Player1->SetPosX(Engine->GetWidth() - Player1->GetTile()->GetBlockWidth());
else if(Player1->GetPosX() < 1) Player1->SetPosX(1);
if( (Player2->GetPosX() + Player2->GetTile()->GetBlockWidth()) > Engine->GetWidth() )
Player2->SetPosX(Engine->GetWidth() - Player2->GetTile()->GetBlockWidth());
else if(Player2->GetPosX() < 1) Player2->SetPosX(1);
Ball->SetPos(Ball->GetPosX() + Ball->GetVelX(), Ball->GetPosY() + Ball->GetVelY());

if((Ball->GetPosX() + Ball->GetTile()->GetBlockWidth()) > Engine->GetWidth() ) {
Ball->SetPosX(Engine->GetWidth() - Ball->GetTile()->GetBlockWidth());
Ball->SetVelX(Ball->GetVelX() * -1);
Bounce->PlayExtended(10,0);
}
else if(Ball->GetPosX() < 1) {
Ball->SetPosX(1);
Ball->SetVelX(Ball->GetVelX() * -1);
Bounce->PlayExtended(-10,0);
}

if((Ball->GetPosY() + Ball->GetTile()->m_BlockHeight) >
Player1->GetPosY() + Player1->GetTile()->m_BlockHeight ) {
Ball->SetPos(Engine->GetWidth() / 2, Engine->GetHeight() / 2);
Ball->SetVel(3,-3);
Player2Score++;
Point->PlayExtended(0,0);
if(Player2Score == 10) GameState = WINNER;
else GameState = STARTING;
}
else if(Ball->GetPosY() < Player2->GetPosY()) {
Ball->SetPos(Engine->GetWidth() / 2, Engine->GetHeight() / 2);
Ball->SetVel(3,3);
Player1Score++;
Point->PlayExtended(0,0);
if(Player1Score == 10) GameState = WINNER;
else GameState = STARTING;
}

if(Ball->SpriteHit(Player1)) {
Ball->SetPosY(Player1->GetPosY() - Ball->GetTile()->m_BlockHeight);
Ball->SetVelY(Ball->GetVelY() * -1);
if(Player1->GetState() == MOVING_RIGHT) {
Ball->SetVelX(Ball->GetVelX() + 3);
}
else if(Player1->GetState() == MOVING_LEFT) {
Ball->SetVelX(Ball->GetVelX() - 3);
}
Bounce->PlayExtended(0,0);
}

if(Ball->SpriteHit(Player2)) {
Ball->SetPosY(Player2->GetPosY() + Player2->GetTile()->m_BlockHeight);
Ball->SetVelY(Ball->GetVelY() * -1);
if(Player2->GetState() == MOVING_RIGHT) {
Ball->SetVelX(Ball->GetVelX() + 3);
}
else if(Player2->GetState() == MOVING_LEFT) {
Ball->SetVelX(Ball->GetVelX() - 3);
}
Bounce->PlayExtended(0,0);
}

Engine->GetBack()->Fill(0);

Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_NORMAL);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d", Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d", Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();
Engine->Flip();

} // Game Playing


void Starting() {
char str[64];
DWORD InitTime, CurrTime, dTime;

InitTime = timeGetTime();
do{

Input.Update();

if(Input.GetKeyState(CDXKEY_RIGHTARROW)) {
Player1->SetPosX(Player1->GetPosX() + MA);
Player1->SetState(MOVING_RIGHT);
}
else if(Input.GetKeyState(CDXKEY_LEFTARROW)) {
Player1->SetPosX(Player1->GetPosX() - MA);
Player1->SetState(MOVING_LEFT);
}
else {
Player1->SetState(STANDING);
}

if(Player2Mode) {
if(Input.GetKeyState(CDXKEY_X)) {
Player2->SetPosX(Player2->GetPosX() + MA);
Player2->SetState(MOVING_RIGHT);
}
else if(Input.GetKeyState(CDXKEY_Z)) {
Player2->SetPosX(Player2->GetPosX() - MA);
Player2->SetState(MOVING_LEFT);
}
else {
Player2->SetState(STANDING);
}
}

if( (Player1->GetPosX() + Player1->GetTile()->GetBlockWidth()) > Engine->GetWidth() )
Player1->SetPosX(Engine->GetWidth() - Player1->GetTile()->GetBlockWidth());
else if(Player1->GetPosX() < 1) Player1->SetPosX(1);

if( (Player2->GetPosX() + Player2->GetTile()->GetBlockWidth()) > Engine->GetWidth() )
Player2->SetPosX(Engine->GetWidth() - Player2->GetTile()->GetBlockWidth());
else if(Player2->GetPosX() < 1) Player2->SetPosX(1);

Engine->GetBack()->Fill(0);

Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_NORMAL);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d",Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d",Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,30,75,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(Engine->GetWidth()/3,Engine->GetHeight()/3,
RGB(255,255,255),"Get");
Engine->GetBack()->TextXY(Engine->GetWidth()/3,Engine->GetHeight()/2,
RGB(255,255,255),"Ready!");
Engine->GetBack()->ReleaseDC();

Engine->Flip();
CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
}
while(dTime < 3000);

GameState = PLAYING;

} // Starting


void Paused() {

char str[64];
BOOL done = FALSE;
DWORD InitTime, CurrTime, dTime;

InitTime = timeGetTime();
CurrTime = dTime = 0;
do{
Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,40,100,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(250,Engine->GetHeight() / 2, RGB(255,255,0), "P");
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d", Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d", Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();

Engine->Flip();

CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
} while(dTime < 100);

InitTime = timeGetTime();
do{
Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,40,100,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(250,Engine->GetHeight() / 2, RGB(255,255,0), "PA");
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d", Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d", Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();

Engine->Flip();

CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
} while(dTime < 100);

InitTime = timeGetTime();
do{
Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,40,100,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(250,Engine->GetHeight() / 2, RGB(255,255,0), "PAU");
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d", Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d", Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();

Engine->Flip();

CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
} while(dTime < 100);

InitTime = timeGetTime();
do{
Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,40,100,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(250,Engine->GetHeight() / 2, RGB(255,255,0), "PAUS");
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d", Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d", Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();

Engine->Flip();

CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
} while(dTime < 100);

InitTime = timeGetTime();
do{
Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,40,100,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(250,Engine->GetHeight() / 2, RGB(255,255,0), "PAUSE");
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d", Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d", Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();

Engine->Flip();

CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
} while(dTime < 100);

do{
Input.Update();
Stars->Update();
Player1->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Player2->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);
Ball->Draw(Engine->GetBack(), 0, 0, CDXBLT_BLK);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,40,100,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(250,Engine->GetHeight() / 2, RGB(255,255,0), "PAUSED");
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,10,25,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
sprintf(str,"Player 1: %d", Player1Score);
Engine->GetBack()->TextXY(5,30,RGB(255,0,0),str);
sprintf(str,"Player 2: %d", Player2Score);
Engine->GetBack()->TextXY(650,30,RGB(255,0,0),str);
Engine->GetBack()->ReleaseDC();

Engine->Flip();

if(Input.GetKeyState(CDXKEY_P)) done = TRUE;
} while(!done);

InitTime = timeGetTime();
CurrTime = dTime = 0;
do{
CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
} while(dTime < 200);

GameState = PLAYING;

}

void Menu() {
BOOL done = FALSE;
BOOL Changing = FALSE;
DWORD InitTime, CurrTime, dTime;

DWORD CurrSelection = 1;

do {
Input.Update();
Stars->Update();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,40,100,FW_BOLD);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(10,0,RGB(0,0,255),"Pong 2000");
Engine->GetBack()->ReleaseDC();

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,20,50,FW_NORMAL);

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
if(CurrSelection == 1) {
Engine->GetBack()->TextXY(200,200,RGB(255,0,0),"1 Player Game");
Engine->GetBack()->TextXY(200,300,RGB(64,64,0),"2 Player Game");
Engine->GetBack()->TextXY(200,400,RGB(64,64,0),"Exit");
}
else if(CurrSelection == 2) {
Engine->GetBack()->TextXY(200,200,RGB(64,64,0),"1 Player Game");
Engine->GetBack()->TextXY(200,300,RGB(255,0,0),"2 Player Game");
Engine->GetBack()->TextXY(200,400,RGB(64,64,0),"Exit");
}
else if(CurrSelection == 3) {
Engine->GetBack()->TextXY(200,200,RGB(64,64,0),"1 Player Game");
Engine->GetBack()->TextXY(200,300,RGB(64,64,0),"2 Player Game");
Engine->GetBack()->TextXY(200,400,RGB(255,0,0),"Exit");
}
Engine->GetBack()->ReleaseDC();

Engine->Flip();

if(Input.GetKeyState(CDXKEY_UPARROW)) {
if(Changing) {
CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
if(dTime > 350) Changing = FALSE;
}
else {
InitTime = timeGetTime();
CurrSelection--;
Changing = TRUE;
}
}
if(Input.GetKeyState(CDXKEY_DOWNARROW)) {
if(Changing) {
CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
if(dTime > 350) Changing = FALSE;
}
else {
InitTime = timeGetTime();
CurrSelection++;
Changing = TRUE;
}
}
if(CurrSelection < 1) CurrSelection = 1;
if(CurrSelection > 3) CurrSelection = 3;

if(Input.GetKeyState(CDXKEY_ENTER)) {
done = TRUE;
}


} while(!done);

if(CurrSelection == 1) {
GameState = STARTING;
Player2Mode = FALSE;
}
if(CurrSelection == 2) {
GameState = STARTING;
Player2Mode = TRUE;
}
if(CurrSelection == 3) {
PostMessage(hWnd,WM_CLOSE,0,0);
}

Player1Score = 0;
Player2Score = 0;

}

void Win() {
DWORD InitTime, CurrTime, dTime;
BOOL response;
BOOL done = FALSE;
DWORD r = 0, g = 50, b = 200;
DWORD rDir = 1, gDir = 0, bDir = 1;

Winner->PlayExtended(0,0);

// if(Engine->GetBack()->m_Font) DeleteObject(Engine->GetBack()->m_Font);

Engine->GetBack()->ChangeFont(FONT_NAME,30,75,FW_NORMAL);

InitTime = timeGetTime();
CurrTime = dTime = 0;
do {
Stars->Update();

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
if(Player1Score == 7)
Engine->GetBack()->TextXY(200,150,RGB(255,0,0),"Player 1");
else Engine->GetBack()->TextXY(200,150,RGB(255,0,0),"Player 2");
Engine->GetBack()->TextXY(300,200,RGB(255,0,0),"Wins!");
Engine->GetBack()->ReleaseDC();

Engine->Flip();

CurrTime = timeGetTime();
dTime = CurrTime - InitTime;
} while(dTime < 3000);

do{
Input.Update();
Stars->Update();
r += rDir;
g += gDir;
b += bDir;
if((r > 254) || (r < 1)) rDir *= -1;
if((g > 254) || (g < 1)) gDir *= -1;
if((b > 254) || (b < 1)) bDir *= -1;

Engine->GetBack()->GetDC();
Engine->GetBack()->SetFont();
Engine->GetBack()->TextXY(100,200,RGB(r,g,b),"Play again? (Y/N)");
Engine->GetBack()->ReleaseDC();

Engine->Flip();

if(Input.GetKeyState(CDXKEY_Y)) {
response = TRUE;
done = TRUE;
}
else if(Input.GetKeyState(CDXKEY_N)){
response = FALSE;
done = TRUE;
}
}while(!done);

if(response == TRUE) {
Player1Score = 0;
Player2Score = 0;

Player1->SetPos((Engine->GetWidth() / 2) - Player1->GetTile()->GetBlockWidth(),
Engine->GetHeight() - 30);
Player1->SetState(STANDING);

Player2->SetPos((Engine->GetWidth() / 2) - Player2->GetTile()->GetBlockWidth(),60);
Player2->SetState(STANDING);

Ball->SetVel(3,3);
Ball->SetPos((Engine->GetWidth() / 2),(Engine->GetHeight() / 2));

GameState = STARTING;
}
else {
Player1Score = 0;
Player2Score = 0;

Player1->SetPos((Engine->GetWidth() / 2) - Player1->GetTile()->GetBlockWidth(),
Engine->GetHeight() - 30);
Player1->SetState(STANDING);

Player2->SetPos((Engine->GetWidth() / 2) - Player2->GetTile()->GetBlockWidth(),60);
Player2->SetState(STANDING);

Ball->SetVel(3,3);
Ball->SetPos((Engine->GetWidth() / 2), (Engine->GetHeight() / 2));

GameState = MENU;
}
}


Share this post


Link to post
Share on other sites
sSimontis    100
I''m 12, too. I say that yoiu use Allegro. I have used it a small bit. It can be hard to install, but is easy to use. You can always switch to Python. If you need help:
e-mail: ageofscott@comcast.net
AIM: ssimontis

Scott Simontis
If it wasn''t for C, we''d be using BASI, PASAL and OBOL

Share this post


Link to post
Share on other sites
cowsarenotevil    3006
Yay, this is turning into another useless age-posting thread. I''m 13, at least for part of this week. Anyway, being fully prepared for flames, I''d say that OpenGL and the Win32 API are a good choice, because they are covered the most (namely on nehe). Good luck

Share this post


Link to post
Share on other sites
powerblazer    122
Na, I don''t flame, and I just decided on using DirectX, by randomly picking one, na seriously, I got a good book on DirectX so I don''t need all the tutorials for right know, and I''m gonna learn how to use OpenGl pretty soon, mostly form the almighty NEHE! ^_^

Share this post


Link to post
Share on other sites
cowsarenotevil    3006
quote:
Original post by powerblazer
Na, I don''t flame, and I just decided on using DirectX, by randomly picking one, na seriously, I got a good book on DirectX so I don''t need all the tutorials for right know, and I''m gonna learn how to use OpenGl pretty soon, mostly form the almighty NEHE! ^_^


What book? As I said in my earlier post, it doesn''t really matter which you use. But using libraries with DirectX is probably a waste of time... which library did you pick?

Share this post


Link to post
Share on other sites
sSimontis    100
Learn 1 or the other. I have decidedf on DirectX because a lot of books are written for it. At least at the bookstores near me.

Scott Simontis
If it wasn''t for C, we''d be using BASI, PASAL and OBOL

Share this post


Link to post
Share on other sites