borland dos game

This is a discussion on borland dos game within the Game Programming forums, part of the General Programming Boards category; can someone give me a small code for a simple dos game so i can see what functions and modes ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    479

    borland dos game

    can someone give me a small code for a simple dos game
    so i can see what functions and modes there are and how to use them
    i'm not a beginner but i think i'm stuck, and i need help to improve myself
    any help would be apriciated, thanks in advance!

  2. #2
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    If you are tryin to use graphic.h

    GOOD LUCK!!
    What is C++?

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    lol what's the problem

    cna u show me some codes that u have perhaps we can help eachother

  4. #4
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Code:
    #include <iostream.h>
    #include <graphics.h>
    
    int GraphicsDriver;
    int GraphicsMode;
    
    int main()
    {
        initgraph ( &GraphicsDriver, &GraphicsMode, "" )
    
        circle (5, 5, 10 )
    
        cin.get();
        return 0;
    }
    I cant even get that to work... It says make failed and gives no reason

    What is C++?

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    in this case i see u have forgot to put ;
    after your functions

    but i also looked at your previous code
    and found that it gave u errors with the ;
    i think your problem is when u open a new file u should just choose BGI nothing else i dont know how it looks like in yor borland but in my u can choose one thing called no exceptions
    dont choose that one just choose BGI!

  6. #6
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    oops. i just forgot the ";" on my post



    Any who I pick Dos(Standard) and pick the BGI Library.. nothing else.
    What is C++?

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    do u save your files as "ide"?
    example file1.ide

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    what is the Red Dragon Syndicate?

  9. #9
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Yah.. ide is what i always use...

    Must not have seen Cowboy Bebop... Red Dragon Syndycate is off of an anime
    What is C++?

  10. #10
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    see if this works:

    Code:
    #include <iostream.h>
    #include <graphics.h>
    
    int GraphicsDriver = VGA;
    int GraphicsMode = VGAHI;
    
    int main()
    {
        initgraph ( &GraphicsDriver, &GraphicsMode, "" )
    
        circle (5, 5, 10 )
    
        cin.get();
        return 0;
    }

  11. #11
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Error:
    Line 11,11 Statement Missing ;

    What is C++?

  12. #12
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Even if I put ; on the end it runs and says

    BGI Error: Graphics not initialized use 'initgraph'

    What is C++?

  13. #13
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I've tried this with your example and got to work.

    initgraph ( &GraphicsDriver, &GraphicsMode, "<path to bgi directory>" )


    initgraph ( &GraphicsDriver, &GraphicsMode, "c:\\bc45\\bgi" );

  14. #14
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Lamb.. I love you...


    You have solved the problem I have had for a month...

    THANK YOU SOOO MUCH!!!

    So you know any thing about graphics.h? Like how to change the background or make game items.. like make a circle and make it move?
    What is C++?

  15. #15
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I know a little about graphics.h, but thats about it. By background do you mean the color? Cause that's all I know and that's by using setbkcolor().

    Here's some code that modes a circle

    Code:
    #include <graphics.h>
    #include <stdio.h>
    #include <conio.h>
    
    int main()
    {
     int gdriver = VGA, gmode = VGAHI; /* sets graphic mode in VGA 640 x 480 */
     int x = 20, y = 20, quit = 0, move;
     char coord[10]; /* coordinates */
     initgraph(&gdriver,&gmode, "c:\\bc45\\bgi");
    
     while(!quit)
     {
    	sprintf(coord,"x: %d y: %d", x,y);
    	outtextxy(1,1,coord);     /* outputs coordinates */
    	move = getch(); /* gets input */
    	switch(move)
    	{	case 'd' : x++; break;
    		case 'a' : x--; break;
    		case 'w' : y--; break;
    		case 's' : y++; break;
    		case 'q' : quit = 1; break;
    	}
    		cleardevice();
    		circle(x,y,10);
    
     }
    
     closegraph();
    }

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 10:44 AM
  3. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 02:46 PM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21