-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial
TREE is the library. The library itself has a little bit of initialization that needs to be completed before it can be used fully. Always call TREE_Init(); before using the library, and always call TREE_Free(); when done using the library.
Setup:
TREE_Result result;
result = TREE_Init();
if (result)
{
printf("Failed to initialize TREE: %s\n", TREE_Result_ToString(result));
return 1;
}
Teardown:
TREE_Free();
Applications are not required, but are very useful for creating a quick application with some window-styled functionality. Applications allow for a number of controls, which are intractable elements that provide different sorts of functionality.
Setup:
...
// create the application
TREE_Application app;
result = TREE_Application_Init(&app, &surface, 32, ApplicationEventHandler);
if (result)
{
printf("Failed to initialize application: %s\n", TREE_Result_ToString(result));
return 1;
}
Teardown:
TREE_Application_Free(&app);
...
Controls are individual components that can be added to an Application, such as a Button, Label, Dropdown, TextInput, List, or Checkbox.
Labels are a very simple control that shows text, and nothing else. They, however, can be aligned in different ways. By default, labels are word wrapped, and aligned to the top left.
Setup:
...
// create label data
TREE_Control_LabelData labelData;
result = TREE_Control_LabelData_Init(&labelData, "Checkboxes:");
if (result)
{
printf("Failed to initialize label data: %s\n", TREE_Result_ToString(result));
return 1;
}
// create label
TREE_Control label;
result = TREE_Control_Label_Init(&label, NULL, &labelData);
if (result)
{
printf("Failed to initialize label: %s\n", TREE_Result_ToString(result));
return 1;
}
Teardown:
TREE_Control_LabelData_Free(&labelData);
TREE_Control_Free(&label);
...