[graphics c] how to draw a figure with graphics.h??

Hi there
I really need your help, I have a project which simule soda distributor with using turbo c 3.0 and the lib graphics.h, i know how to draw many things like rectangle,circle... but the problem that I want to draw like a soda bottle which is coloured , i made all possible combinations but i didn't get any result unfortunately, is here someone who can help me please?
thanks
«1

Comments

  • : Hi there
    : I really need your help, I have a project which simule soda distributor with using turbo c 3.0 and the lib graphics.h, i know how to draw many things like rectangle,circle... but the problem that I want to draw like a soda bottle which is coloured , i made all possible combinations but i didn't get any result unfortunately, is here someone who can help me please?
    : thanks
    :


    Check the help for setcolor().
    For a list of functions, check the help for graphics.h.
  • thank u for your reply but i checked the help included in turbo c 3.0 but it's not complete, can you tell me about some tutorials about graphic programming in c if you know some url ?

  • : thank u for your reply but i checked the help included in turbo c 3.0 but it's not complete, can you tell me about some tutorials about graphic programming in c if you know some url ?
    :
    :


    The help in TC is very good, everything you need is there, including code examples. Just copy and paste their examples and run them.

  • : : thank u for your reply but i checked the help included in turbo c 3.0 but it's not complete, can you tell me about some tutorials about graphic programming in c if you know some url ?
    : :
    : :
    :
    :
    : The help in TC is very good, everything you need is there, including code examples. Just copy and paste their examples and run them.
    :
    :
    [blue]Do you have this line in your code?
    [code]
    #include
    [/code]
    If so, put a cursor on "graphics" and press CTRL+F1 combination - this should give you the list of ALL possible functions inside graphics.h and code samples for them once you go deeper into Help system.
    [/blue]
  • its so nice to know that there's still some using TC 3.0 (or TC++), nowadays. with all the WYSIWYG/newer IDEs, i really do think having to hardcode the oldfashion way is good foundation in programming (personally speaking). just plain text editor and compiler, no autocomplete/functionhighlight.
    sometimes it makes me wonder what happened to BGI programming and the likes with all this new ways of programming in the Gaming production. we've sure come quite far from Pacman to Counterstrike, from commandprompts to gui, it kinda makes me feel old, and come to think of it i'm only in my early 20's.


    it happens...

    baboy... baboy...

    weaps

  • yeah it's interesting to program with tc 3.0 unless it's old :)
    but for me it's an obligation because we study now graphics programmation in c so i must do that but if i had the choice i woul prefer to program with c++ or something like this it's more easy i think and there are a lot of library to use not like tc u see


  • : its so nice to know that there's still some using TC 3.0 (or TC++), nowadays. with all the WYSIWYG/newer IDEs, i really do think having to hardcode the oldfashion way is good foundation in programming (personally speaking). just plain text editor and compiler, no autocomplete/functionhighlight.
    : sometimes it makes me wonder what happened to BGI programming and the likes with all this new ways of programming in the Gaming production. we've sure come quite far from Pacman to Counterstrike, from commandprompts to gui, it kinda makes me feel old, and come to think of it i'm only in my early 20's.
    :
    :
    : it happens...
    :
    : baboy... baboy...
    :
    : weaps
    :
    :
    [green]
    BGI ughh! Quicker to do your own routines in assembler. Nah, you are not old at all. Give me a call when you get 34. :-)
    [/green]

  • [blue]I have done pretty huge programs with TC 3.0 in my time - early 90s. :-)All kinds: editors, machine controllers, other stuff... - you name it.[/blue]
  • Hi my dear brother i am also using Turbo C++ and now a days i a also trying to make a project. if you send me your email. then i can help you in this regard. i shall send you the code which i have made in my application. and after studying it you can make your desired program.
    Do not worry about it. when i start it i also seems me very difficult but i do a lot with out any teacher.i am waiting for your reply.
    mine email address is [email protected] or [email protected]
    i mine wait starts now.
    be happy all the time
  • hi thanks a lot for your reply
    here's my email adress, you can send me your source code at it: [email protected]
    I'm waiting for your reply
  • indeed, I have a project which is simulating soda automatic distributor, I will do two menus : one for administrator of the distributor who can modify the quantity of bottles and their prices and a menu for customer who can choose which soda and the pieces of money they want to introduce to get the soda, I think it's clear that project for you now
    and thanks for your help
  • i dont kno if any1 answered u yet, but there is a way to make cheep graphics. look at the setpalette function in the help. basically, u set the numbers 0-15 to a 64 bit color (0-63) and each 64 bit color is different

    this code can show u all the colors, its pretty simple. anyways, after u have set the colors, use a 2-d integer. for example, soda[50][100], this is an integer that is 50 down and 100 accros. now, do
    soda[50][100]={
    0,1,2,0,0,2,0,0,3,...
    };
    and that will set the value of all of that integer (u must have all spaces filled for it to work correctly) and then say,
    for(int i=o;i<100;i++){
    for(int j=0;j<50;j++){
    if(soda[j][i]==1){putpixel(i+100,j+100,COLOR1);}
    /*COLOR1 is just an example, the vallue of COLOR1 would be set by the setpalette function*/
    }
    }

    if thats 2 confusing, tell me what part u have troubles on!

    email me at [email protected] (its the best way to contact me)

    good luck!

    #include <stdio.h>
    #include
    #include
    #include
    #include
    #include "tools.h"
    int main(){
    closegraph();
    IGM();
    cleardevice();
    setbkcolor(0);
    int i=0,k,c1=1,c2=2,c3=3,color1=1,color2=2,color3=3;
    char s[50];
    setpalette(c1,color1);
    setpalette(c2,color2);
    setpalette(c3,color3);
    settextstyle(2,0,5);
    do{
    k=getkey();
    switch(k){
    case 72 : color1--; color2--; color3--; setpalette(c1,color1);
    setpalette(c2,color2); setpalette(c3,color3); cleardevice(); break;
    case 80 : color1++; color2++; color3++; setpalette(c1,color1);
    setpalette(c2,color2); setpalette(c3,color3); cleardevice(); break;
    }
    setcolor(15);
    sprintf(s,"%-3i--------",color1); outtextxy(320-85,240-68,s);
    sprintf(s,"%-3i--------",color2); outtextxy(320-85,240-8,s);
    sprintf(s,"%-3i--------",color3); outtextxy(320-85,240+52,s);
    setfillstyle(1,c1); bar(350-20,180-20,350+20,180+20);
    setfillstyle(1,c2); bar(350-20,240-20,350+20,240+20);
    setfillstyle(1,c3); bar(350-20,300-20,350+20,300+20);
    }while(k!=13);
    }
  • : i dont kno if any1 answered u yet, but there is a way to make cheep graphics. look at the setpalette function in the help. basically, u set the numbers 0-15 to a 64 bit color (0-63) and each 64 bit color is different

    [green]
    Each palette entry consist of 3 bytes, rgb. The value 0-63 represent the intensity of each color written to the palette port in 3 byte increments. I wrote a program, in assembler, that dumps the palette table, which is 768 bytes or 256 colors, to a file. You can do some neat tricks by manipulating the palette and writing directly to the port.
    [/green]


  • : [green]
    : Each palette entry consist of 3 bytes, rgb. The value 0-63 represent the intensity of each color written to the palette port in 3 byte increments. I wrote a program, in assembler, that dumps the palette table, which is 768 bytes or 256 colors, to a file. You can do some neat tricks by manipulating the palette and writing directly to the port.
    : [/green]

    hey, could u do that in borland turbo c++ 3.0? if you could, i would much appriciate a sample code. plz! thanx in advance, and i think im learning as much as the guy who wrote this post in the first place =)
  • thanks you very much for you help
    I'll test this code and i'll tell you if it's ok or no
    thanks a lot

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories