Thread: drawing lines and rectangles in c++

  1. #16
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    ok looks like i got a long read ahead so ill thank you now this looks like the sort of thing ive been searching for for weeks now lol thank you

  2. #17
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    blimey looks like ill need a degree to install this

  3. #18
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    You may want to use Visual C++ Express Edition from Microsoft.com It's a superior IDE in my opinion. I don't believe anymore versions of Dev-C++ are being made, but if you are comfortable with it, don't change. SDL or Allegro will work the same no matter what compiler/IDE you work with.
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  4. #19
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    ok well i dont have any money so dev-pp is the best i can afford so it will have to do for now.
    if i learn to use sdl in dev will i be able to use the same code in
    visual c++ express or has it got a different accent?

  5. #20
    Registered User
    Join Date
    Sep 2006
    Location
    UK
    Posts
    13
    Hey

    I'm probably gonna get slated for saying this but...

    The MFC framework makes basic graphic drawing very simple.

    Code:
    // Draw a line
    pDC->MoveTo( x, y );
    pDC->LineTo( x, y );
    // Make a filled Rectangle
    pDC->FillRect( CRect( sx,sy,ex,ey), pBrush);
    Maybe you should er.... buy a copy of Visual Studio. it's not difficult to find.

    I know that Watcom C++ contains Microsofts Foundation Classes maybe some of the others do to ??

    As far as i can see your code will work fine in Visual Studio, but if you use MFC and create a windows app you will need to replace the cin with a dialog box and cout with a text string to the view

    Code:
    pDC->TextOut( x, y, "String");
    Creating a dialog box for input is very easy, i can give you an example if you decide to go that way.

    btw: you don't always need loads of cash to find what you need.
    Visual studio is a couple of gigs but it's worth the download time!
    Last edited by spacecadet23; 10-05-2006 at 07:04 PM.

  6. #21
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    Top left corner: char(218)
    Top right corner: char(191)
    Bottom left: char(192)
    Bottom right: char(217)
    vertical line: char(179)
    horizontal line: char(196)

    http://www.adrianxw.dk/SoftwareSite/...Consoles3.html

  7. #22
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    Quote Originally Posted by thestien
    ok well i dont have any money so dev-pp is the best i can afford so it will have to do for now.
    if i learn to use sdl in dev will i be able to use the same code in
    visual c++ express or has it got a different accent?
    It's called 'express' for a reason. This means that it's free to use, and download. Same code, same rules. SDL and other libraries can be used. Just try it out, and if you like the IDE, then stick with it. There isn't a trial period or anything, so check it out!
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  8. #23
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    ok im really confused now i tried installing sdl on dev
    then i downloaded the lesson from that site u gave me
    and now i get this error running the code


    cannot find ISDL-ISDL_image-ISDL_ttf
    id returned 1 exit status
    [build error][sdl_tutorial.exe] error1

    im sure i installed it all correctly and i evan installed it all agin any idea what is going on?
    ahhhh now im getting even more errors

    [linker error] undefined reference to img_load

    there is 22 of these things
    Last edited by thestien; 10-05-2006 at 07:17 PM.

  9. #24
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    That's because the program requires more headers/libs. You have to download SDL_image and SDL_ttf to use the functions. Follow the directions in the tutorial, it tells you everything. Start with first one, then move on.
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  10. #25
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    i did i followed the tutorial but it says put the *.dll in both the bin and system 32 folder so i copied them and put them in both

  11. #26
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You also need libSDL.a and libSDL_image.a and whatever other libraries in Dev-C++'s include directory. (For MSVC, use SDL.lib and SDL_image.lib.) Or better yet, you can just add the directory in which libSDL.a etc are stored to the compiler's library path (-L directory for GCC).

    I do think that you might be better off with simple ASCII graphics.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  12. #27
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    sdl seems to work if i didnt add the -ISDL_image-ISDL_ttf
    to the linker but when i use those it says it cand find them but all the header files lib files and dlls are in the directory
    its so annoying lol ive tried evry thing i can imagine that could be wrong maybe if i wrote a file list of whats in each directory you could reference it aginst your directory and tell me if there is some thing missing
    oh and also i tried the package finder thing and it installed sdl sdl_image and sdl_ttf and still it gives the same errors

  13. #28
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You do realize that you need a space before each -I, right?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  14. #29
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    he he he ok ill try that i never had the spaces there
    thank you

  15. #30
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    nope im still getting
    [linker error] img_load
    [linker error] ttf_init
    and various others i put spaces between them now but still no joy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing program architecture - information needed
    By Marko_D in forum Windows Programming
    Replies: 1
    Last Post: 11-28-2003, 07:46 PM
  2. Drawing a triangle with hatch marks?
    By Bajanine in forum Windows Programming
    Replies: 4
    Last Post: 05-19-2003, 05:42 AM