| 266 | -------------------------------------------------------------------------------*/ |
| 267 | |
| 268 | button_t* newButton(void) |
| 269 | { |
| 270 | button_t* button; |
| 271 | |
| 272 | // allocate memory for button |
| 273 | if ( (button = (button_t*) malloc(sizeof(button_t))) == NULL ) |
| 274 | { |
| 275 | printlog( "failed to allocate memory for new button!\n" ); |
| 276 | exit(1); |
| 277 | } |
| 278 | |
| 279 | // add the button to the button list |
| 280 | button->node = list_AddNodeLast(&button_l); |
| 281 | button->node->element = button; |
| 282 | button->node->deconstructor = &defaultDeconstructor; |
| 283 | button->node->size = sizeof(button_t); |
| 284 | |
| 285 | // now set all of my data elements to ZERO or NULL |
| 286 | button->x = 0; |
| 287 | button->y = 0; |
| 288 | button->sizex = 0; |
| 289 | button->sizey = 0; |
| 290 | button->visible = 1; |
| 291 | button->focused = 0; |
| 292 | button->key = 0; |
| 293 | button->joykey = -1; |
| 294 | button->pressed = false; |
| 295 | button->needclick = true; |
| 296 | button->action = NULL; |
| 297 | strcpy(button->label, "nodef"); |
| 298 | |
| 299 | button->outline = false; |
| 300 | |
| 301 | return button; |
| 302 | } |
| 303 | |
| 304 | /*------------------------------------------------------------------------------- |
| 305 |
no test coverage detected