return color

This is a discussion on return color within the Game Programming forums, part of the General Programming Boards category; What to do if I want to return color of a pixel.... byte get_pixel(int x, int y) { /* y*320 ...

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

    return color

    What to do if I want to return color of a pixel....

    byte get_pixel(int x, int y)
    {
    /* y*320 = y*256 + y*64 = y*2^8 + y*2^6 */
    return VGA[(y<<8)+(y<<6)+x];
    }

    I have the pixel but I want to get the color of the pixel ! ! ? ? ! ! !
    I use Borland 5.02

  2. #2
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    ummm....that function you posted should totally work...is it not working for some reason? make sure that VGA is the buffer you are working off of...
    My Website

    "Circular logic is good because it is."

  3. #3
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    maybe there is another problem... what errors are you getting?
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 07:19 AM
  2. need help program crashing
    By tunerfreak in forum C++ Programming
    Replies: 14
    Last Post: 05-22-2006, 11:29 AM
  3. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  4. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 09:19 AM
  5. Algorithm to walk through a maze.
    By Nutshell in forum C Programming
    Replies: 30
    Last Post: 01-21-2002, 12:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21