GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Jan-2008, 10:35
Pramann Pramann is offline
New Member
 
Join Date: Nov 2007
Posts: 21
Pramann is on a distinguished road

Problem With Graphics Game


Hi
I'm writing a simple graphics program and Im having trouble
The game is pretty basic
A cannon is in the middle of the screen and u shoot at things moving around the screen.
What im trying to do is when you push up, down, right, left, the program will draw a new cannon pointing that direction
But it won't run

CPP / C++ / C Code:
#include "Graphics.cpp"

string direction;

void GraphicsStart()
{
    // Set the color of the background.
    Window.Draw.SetBackColor( 0, 0, 0 );

    // Set the target frames per second.
    // A value of zero means that it will go as fast as it can.
    Window.SetTargetFramerate(30);

    // Set the color that won't be drawn in a bitmap.
    Window.Bitmap.SetTransparentColor( 0, 255, 0 );
}

int GraphicsFrame()
{
    static int shipx = 285;
    static int shipy = 215;
    static int bx=0, by=0, ex=200, ey=30;
    static bool change=false;

    if( Window.Keyboard.KeyDown( DIK_RIGHT ) == true )
	{
        direction = "cannonRight.bmp";
	}

    if( Window.Keyboard.KeyDown( DIK_LEFT ) == true )
	{
        direction = "cannonLeft.bmp";
	}

    if( Window.Keyboard.KeyDown( DIK_UP ) == true )
	{
        direction = "cannonUp.bmp";
	}

    if ( Window.Keyboard.KeyDown( DIK_DOWN ) == true )
	{
        direction = "cannonDown.bmp";
	}

    // Draw the ship at shipx, shipy
    Window.Bitmap.Draw(direction, shipx, shipy );


    // Must call this once every frame.
    Window.Draw.Clear();    

    // Drawing the enemy at ex, ey and moving it

    // Shooting the Bullet

    // Drawing Bullet & Moving it

    // Drawing the Frames Per Second on the upper right corner
    Window.Draw.SetColor( 0, 255, 0 );
    sprintf( buffer, "FPS: %i", Window.GetActualFramerate() );
    Window.Draw.Text( buffer, 0, 0 );

    // Writting title on screen
    Window.Draw.Text("My Game!",350,5);

    return(0);
}  
  #2  
Old 08-Jan-2008, 10:43
Pramann Pramann is offline
New Member
 
Join Date: Nov 2007
Posts: 21
Pramann is on a distinguished road

Re: Problem With Graphics Game


nevermind figured it out
sry
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Linker Error" problem with C++ The Great Dane C++ Forum 2 10-Nov-2007 16:55
Creating a game with graphics in C++? Rain C++ Forum 5 17-Jul-2007 17:42
game problem using linkedListType.h and random function eureka360 C++ Forum 5 16-Feb-2007 10:48
Typing tutor Game problem suvirj C++ Forum 9 31-Jul-2006 22:38
Tips for game troubleshooting pcxgamer Computer Software Forum - Games 0 02-Jan-2004 05:27

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:47.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.