I hope I got all of that terminology correct and in the correct order.
I've only found how to set up an typedef enum but nothing even close to how to manipulate it in the fashion I want to.
What I got setup to where I am now only getting this warning, but I believe what I have is still not workable. ( because seg faults say a lot)
warning: initialization makes pointer from integer without a cast [-Wint-conversion]|
The basic parts are this:
Code:
typedef enum Tile_Image
{
TILE, TILEH, TILEV, TILEHV, RTILE, RTILEH, RTILEV, RTILEHV, SPACE_TILE
}Tile_Image;
// the elements would be assigned 0 thru 8 by default.
//assigning one of the elements numbers to a char to reference it later.
typedef struct {
unsigned char mode;
}Some_Items;
Tile_Image ti;
Some_items si;
int *i = (rand() % 8);
si.mode = ti[i];
Basically I am trying to get it to randomize 0 ... 8 then whatever element is a match for that random number to be then assigned to the mode in order to reference from it when passed to the function that reads what value si.mode is.
Code:
switch (si.mode)
{
case TILE:
do_something;
break;
case TILEH:
do_something;
break;
.....
default:
break;
}
I am just trying to assign the element number to mode so I can reference it again on the other end to set it in motion.
my logic is because when calling to see what element mode has is.
printf("%d\n", (int)mode); which prints a number or integer and not the actual name of the element.
I hope that makes sense to someone in here.