Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "masterinclude.h"
- Card* create_card(char* card_normal[],char* card_frame[],char* card_selected[]) {
- //allocate space for the "object"
- Card* card = (Card* ) malloc ( sizeof(Card));
- if( card == NULL )
- return NULL;
- card->xpm_normal = read_xpm(card_normal, &(card->width), &(card->height));
- card->xpm_frame = read_xpm(card_frame, &(card->width), &(card->height));
- card->xpm_selected = read_xpm(card_selected, &(card->width), &(card->height));
- return card;
- }
- void set_card_position(Card *card, int xi, int yi){
- card->x=xi;
- card->y=yi;
- }
- void display_xpm(Card *card, int n){
- char* map;
- int width=card->width;
- int height=card->height;
- int color=0;
- int xi=card->x;
- int yi=card->y;
- int yt =yi+height;
- switch(n){
- case 1:
- map=card->xpm_normal;
- break;
- case 2:
- map=card->xpm_frame;
- break;
- case 3:
- map=card->xpm_selected;
- break;
- default:
- break;
- }
- for(yi; yi < yt;yi++){
- unsigned int x = xi;
- for(x; x < (xi+width);x++){
- vg_set_pixel(x,yi,map[color]);
- color++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement