Easiest graphics on C++ is...?

Discussion in 'Computer Science & Culture' started by WAJ, May 9, 2002.

Thread Status:
Not open for further replies.
  1. WAJ Registered Member

    Messages:
    22
    Right, I'm new to C++ and I have been given a chellenge, and I have no idea how to go about doing it. I'm using Microsoft Visual C++ and I need to know the easiest way to create graphics on screen.

    Specifically, a square. A 2d outlined square.

    I know it's lame but I haven't done anything graphical before and I want to work up from the easiest

    Please Register or Log in to view the hidden image!



    I'm going into a Computer Games Technology course this year and I want a head start (as far as programming knowledge goes).

    Thanks for any help guys!
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Rick Valued Senior Member

    Messages:
    3,336
    WAJ,
    ZION TO RESCUE!!

    Please Register or Log in to view the hidden image!



    Code:
    #include"stdio.h"
    #include"conio.h"
    #include"graphics.h"
    #include"alloc.h"
    void main()
    {
        int gd=DETECT,gm;
        initgraph(&gd,&gm," c:\\turboc2\\bgi"); /*you can give your path,this function basically initializes the graphics mode,gm is for graphics mode,i had set gd=DETECT in previous statement to autodetect the mode you"re using,wether CGA,VGAHI etc...*/
        rectangle(100,100,100,100);//the above coordinates are the two opposite points of a rectangle,manipulate them to your own use
        closegraph();
    }
    
    anything else you wanna ask,like how to make GUI,point 'n shoot menus,some simple 2D games like Pacman,Mario etc,i"ll help you out...
    (That is if i find time from my Multi-processor ordeal)

    bye!
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. WAJ Registered Member

    Messages:
    22
    Thanks, zion, that simple? Although what is the path you're talking about? Path to what?

    As it stands it "cannot execute program".

    You must excuse my ignorance of c++, i've no idea. If I get this working, I might move onto things like images (or complex shapes, i don't know what you can do), that all sounds groovy.

    If there's one thing I've noticed about C based programs, is that they all seem to work a helluva lot smoother.
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. WAJ Registered Member

    Messages:
    22
    Sorry, I did something wrong. But it turns out that I don't have graphics.h -- am I supposed to? And I still don't know what the path refers to.
     
  8. Rick Valued Senior Member

    Messages:
    3,336
    you need graphics.h file for graphics.i was talking about path to graphics interface,in my case(Turboc 3.0 compiler)it is c:\\turboc2\\bgi",and these double slashes are essential,because a single slash becomes an escape sequence.

    graphics is easy,very easy.
    i have made a project to show a map of U.S with a menu,when you click a choice,you"ll get the result,there is railways,airways,roadways option to show it on the map,while blinking,it looks cool.

    Please Register or Log in to view the hidden image!






    bye!
     
  9. WAJ Registered Member

    Messages:
    22
    Ah thanks, I'll have to look into that (although I can't now because I'm in school - MY LAST DAY!!!). I don't have any of the software here, but I can tell you that I've got Microsoft Visual Basic 6 (at home) and I have no idea what the graphics interface is or where it is or if I have one.

    And since I don't seem to have grpahics.h, I'd better try to download it from somewhere.
     
  10. itchy Registered Senior Member

    Messages:
    47
    You can't use graphics.h in Visual C++. You'll have to learn Windows programming or use the built in MFC classes. Try to search for some tutorial on MFC or look in Visual C++ help. Thats the best way I know of...
     
  11. Ash711 Registered Member

    Messages:
    24
    vc++

    hi everyone

    if you dont want fuss with vc++ and mfc and etc... etc....

    (i think it's not a good idea to start with it, you will have a lot of problem with vc++ if you dont have a good knowledge in c++ and class inheritances)

    you should try a free c/c++ compiler:djggp
    http://www.delorie.com/djgpp/

    with a -relatively- good graphic library, still free and very simple to use:allegro
    http://www.talula.demon.co.uk/allegro/

    you will have a lot of examples that ship with it, from simple square (it takes something like 4 lines, much like zion code) to complete game with advanced controler and sound.
    Once you played with that, made your own demos & games & won prize for your demos

    Please Register or Log in to view the hidden image!

    you should try directX and mfc prog...
    but honest, start with directX and you'll miss a lot of fun.

    hopes it'll helps
     
  12. WAJ Registered Member

    Messages:
    22
    cor, thanks for that. I'll certainly look into it.

    I'm just concerned that a lot of thing s are programmed in advanced c programmes such as visual c++ so i wanted to learn as much as that as i could before going to uni. But of course, you're right, i should work up to whatever level.

    After all, I don't think next generation (or next next generation) games programmers should be dawdling with the petty stuff. But that's how it must be

    Please Register or Log in to view the hidden image!

     
Thread Status:
Not open for further replies.

Share This Page