Thread: graphics.h

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    19

    graphics.h

    I downloaded this graphics library:
    http://www.uniqueness-template.com/devcpp/graphics.h

    and I have figured it out for the most part, but I have one simple question....

    I want to know how to detect if the user clicks inside a circle (I'm fairly certain that this just has something to do with trig which I havn't learned yet)

    I made a function for squares:

    Code:
    bool Squareclick(int x1, int y1, int x2, int y2, int click)
        {
             if(click != 513 & click != 516 & click != 519)
             {
                  click = (click + 1) * 3 + 510;         
             }
             //Click Types WM_LBUTTONDOWN replace L with M or R
             bool h = false;
             if(mousex() > x1 & mousex() < x2 & mousey() > y1 & mousey() < y2 & ismouseclick(click) == true)
             {
                  h = true;            
             }
             else { clearmouseclick(click); }
             return h; 
        }
    So if someone could help me to detect if a click occurs in a circle that would be great

    also, is their a easy way to detect if one of the radii of a circle has come in contact with something? Just a general math algorithm for finding where the radii are would be nice.

    thanks in advance

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The equation of a circle should be a clue.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    19

    hm?

    But how would I find that out??

  4. #4

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    19
    Ahhh many thanks

    Ill impliment this tommorow

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. graphics.h not found?
    By Dauthi in forum C++ Programming
    Replies: 8
    Last Post: 05-17-2003, 08:47 PM
  2. Does graphics.h work with windows??
    By sundeeptuteja in forum C++ Programming
    Replies: 6
    Last Post: 09-13-2002, 09:08 AM
  3. graphics.h
    By scott27349 in forum Game Programming
    Replies: 1
    Last Post: 06-02-2002, 08:24 AM
  4. graphics.h
    By Seti in forum C++ Programming
    Replies: 2
    Last Post: 02-28-2002, 04:11 PM
  5. graphics.h
    By AM in forum C Programming
    Replies: 2
    Last Post: 01-14-2002, 01:11 PM