| How do you use DrawIcon?

Previous | Graphics and Display | Next

Q: | I don't understand how to use DrawIcon. Do I need to use pICON?
A: | If you want to draw an icon at 50,50 for example, do:
    ICON i = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
    ...
    DrawIcon (50, 50, &i, A_NORMAL);
Of course, change 1, 2, 3... to the real definition of the icon. pICON is necessary only for using with icons which are dynamically allocated (forget it if you are not familiar with dynamic structures in C), like in:
    pICON p = malloc (32);
    ...
    // Here is a code which fill up the icon structure
    ...
    DrawIcon (50, 50, p, A_REPLACE);
Look operator "&" in first example, it is omitted in second example. In fact, "&" converts a variable of ICON type to pICON type (in general, it converts any type to corresponding pointer type).