Graphics use addresses?

  • Videogamer555
    16th May 2012 Member 0 Permalink
    I notice the graphics routine for PLSM uses this code:
    *colr = (unsigned char)plasma_data[caddress];
    *colg = (unsigned char)plasma_data[caddress+1];
    *colb = (unsigned char)plasma_data[caddress+2];

    *firea = 255;
    *firer = *colr;
    *fireg = *colg;
    *fireb = *colb;


    The * before the variables means specifying an address and NOT an actual color value. What if I want to change this and specify an actual color value if I want a particular color, rather than having it look up the color at a memory address. Any help here would be great. Thanks in advance.
  • tommig
    16th May 2012 Member 0 Permalink
    You can fiddle with the caddress+ values. I assume you want white, I worked that out earlier, so just set it to this:

    *colr = (unsigned char)plasma_data[caddress];
    *colg = (unsigned char)plasma_data[caddress];
    *colb = (unsigned char)plasma_data[caddress];
  • jacksonmj
    16th May 2012 Developer 0 Permalink
    The graphics function is passed pointers to the variables where the colours should be stored.

    colr is the address of the variable containing the red colour value. *colr dereferences the pointer, and lets you read/write the colour value. Changing the value of *colr changes the colour value.

    So to change the red colour value to 63, just do:
    *colr = 63;