-
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();
A surface is a drawable "image" that can easily be printed to the screen. Surfaces contain all of the text and color codes, combined into one value, that can be printed to the terminal in one call. This allows for quick drawing to the terminal.
Setup:
...
// create the surface to draw to
TREE_Surface surface;
result = TREE_Surface_Init(&surface, TREE_Window_GetExtent());
if (result)
{
printf("Failed to initialize surface: %s\n", TREE_Result_ToString(result));
return 1;
}
Teardown:
TREE_Surface_Free(&surface);
...
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.