Thread: problem

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    17

    Unhappy problem

    How can i get the color of a pixel... For example (x=100,y=100,color=1 "random") // color is random !!!!
    and I want to get the color of this pixel.... and if the color=1 bla bla.... and so on... I need this for my game.. please help me...

  2. #2
    What OS? What compiler?
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    411
    Hell, what are you useing to draw the pixel in the first place?

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Let me assume for a second that you are using dos mode 13h. If you want to get a pixel then do something like:
    Code:
    //screen_buffer will be the buffer where I could find pixels
    //SCREE_WIDTH will be the horizonal resolution of the screen.
    unsigned char pixelAt(int x, int y){
        return screen_buffer[y*SCREEN_WIDTH + x];   
    }

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    17

    again

    I hav eBOrland 5.02 and I'm programing in 13h... Thakx for the replys ... But If I got the pixel how can I get the COLOR of this pixel.????? thanx in advance...............

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM