This function allows you to specify the image to use as the mouse pointer for the specified window and it's children.
![]() | Pixels that are not set in either the foreground or the background bitmaps will be transparent. |
Type | Name | Description |
---|---|---|
GR_WINDOW_ID | wid | The ID of the window to set the cursor for. |
GR_SIZE | width | The width of the pointer bitmap in pixels. |
GR_SIZE | height | The height of the pointer bitmap in pixels. |
GR_COORD | hotx | The X coordinate within the bitmap used as the target for the pointer. |
GR_COORD | hoty | The Y coordinate within the bitmap used as the target for the pointer. |
GR_COLOR | foreground | The color to use for the foreground bitmap image. |
GR_COLOR | background | The color to use for the background bitmap image. |
GR_BITMAP* | fgbitmap | Pointer to a bitmap data array to use as the foreground bitmap. |
GR_BITMAP* | bgbitmap | Pointer to a bitmap data array to use as the background bitmap. |
Example 2-1. Using GrSetCursor()
void set_x_cursor (GR_WINDOW_ID wid) { GR_BITMAP fg_bitmap[16]; GR_BITMAP bg_bitmap[16]; fg_bitmap[0] = 0x8001; /* X______________X */ fg_bitmap[1] = 0x4002; /* _X____________X_ */ fg_bitmap[2] = 0x2004; /* __X__________X__ */ fg_bitmap[3] = 0x1008; /* ___X________X___ */ fg_bitmap[4] = 0x0810; /* ____X______X____ */ fg_bitmap[5] = 0x0420; /* _____X____X_____ */ fg_bitmap[6] = 0x0240; /* ______X__X______ */ fg_bitmap[7] = 0x0180; /* _______XX_______ */ fg_bitmap[8] = 0x0180; /* _______XX_______ */ fg_bitmap[9] = 0x0240; /* ______X__X______ */ fg_bitmap[10] = 0x0420; /* _____X____X_____ */ fg_bitmap[11] = 0x0810; /* ____X______X____ */ fg_bitmap[12] = 0x1008; /* ___X________X___ */ fg_bitmap[13] = 0x2004; /* __X__________X__ */ fg_bitmap[14] = 0x4002; /* _X____________X_ */ fg_bitmap[15] = 0x8001; /* X______________X */ bg_bitmap[0] = 0x4002; /* _X____________X_ */ bg_bitmap[1] = 0xA005; /* X_X__________X_X */ bg_bitmap[2] = 0x500A; /* _X_X________X_X_ */ bg_bitmap[3] = 0x2814; /* __X_X______X_X__ */ bg_bitmap[4] = 0x1428; /* ___X_X____X_X___ */ bg_bitmap[5] = 0x0A50; /* ____X_X__X_X____ */ bg_bitmap[6] = 0x05A0; /* _____X_XX_X_____ */ bg_bitmap[7] = 0x0240; /* ______X__X______ */ bg_bitmap[8] = 0x0240; /* ______X__X______ */ bg_bitmap[9] = 0x05A0; /* _____X_XX_X_____ */ bg_bitmap[10] = 0x0A50; /* ____X_X__X_X____ */ bg_bitmap[11] = 0x1428; /* ___X_X____X_X___ */ bg_bitmap[12] = 0x2814; /* __X_X______X_X__ */ bg_bitmap[13] = 0x500A; /* _X_X________X_X_ */ bg_bitmap[14] = 0xA005; /* X_X__________X_X */ bg_bitmap[15] = 0x4002; /* _X____________X_ */ GrSetCursor (wid, 16, 16, 8, 8, BLACK, BLACK, fg_bitmap, bg_bitmap); } |